Skip to content

Devika is the first open-source implementation of an Agentic Software Engineer. Initially started as an open-source alternative to Devin.

Python

Update: README and config

ARajgorb17ad66ddc3b
diff --cc README.md
index 0479aac,0100ee4..67e7276
--- a/README.md
+++ b/README.md
@@@ -73,12 -73,10 +73,12 @@@ Read [**ARCHITECTURE.md**](https://gith
The easiest way to run the project locally:
1. Install `uv` - Python Package manager (https://github.com/astral-sh/uv)
-2. Install `bun` - JavaScript runtime (https://bun.sh/)
-3. Install and setup `Ollama` (https://ollama.com/)
+2. Install `bun` - JavaScript runtime (https://bun.sh/docs/installation)
- 3. Install and setup `Ollama` (https://ollama.com/)
++3. Install and setup `Ollama` (https://ollama.com/) (if you want don't want to use the local models then you can skip this step)
- For ollama you need to install the [models](https://ollama.com/models)
-Set the API Keys in the `config.toml` file (Rename `sample.config.toml` to `config.toml`). (This will soon be moving to the UI where you can set these keys from the UI itself without touching the command-line, want to implement it? See this issue: https://github.com/stitionai/devika/issues/3)
++For ollama you need to install the [models](https://ollama.com/models)<br>
+For API models, configure the API keys in the `config.toml` file. For this, we provide `sample.config.toml` <br><br>
- create and set the API Keys in the `config.toml` file. (This will soon be moving to the UI where you can set these keys from the UI itself without touching the command-line, want to implement it? See this issue: https://github.com/stitionai/devika/issues/3)
++create and set the API Keys in the `config.toml` file. you can also set the API keys via the settings page in the UI.<br>
Then execute the following set of command:
@@@ -124,8 -117,8 +124,8 @@@ To install Devika, follow these steps
pip install -r requirements.txt
playwright install --with-deps # installs browsers in playwright (and their deps) if required
```
- 5. Set up the necessary API keys and configuration (see [Configuration](#configuration) section).
-4. Set up the necessary API keys and configuration (see [Configuration](#configuration) section).
-5. Start the Devika server:
++5. Set up the necessary API keys and [Configuration](#configuration)
+6. Start the Devika server:
```bash
python devika.py
```
@@@ -152,19 -145,36 +152,33 @@@ To start using Devika, follow these ste
## Configuration
- Devika requires certain configuration settings and API keys to function properly. use the `sample.config.toml` file with the following information:
-Devika requires certain configuration settings and API keys to function properly. Rename the `sample.config.toml` to `config.toml` and update the file with the following information:
-
-- `SQLITE_DB`: The path to the SQLite database file for storing Devika's data.
-- `SCREENSHOTS_DIR`: The directory where screenshots captured by Devika will be stored.
-- `PDFS_DIR`: The directory where PDF files processed by Devika will be stored.
-- `PROJECTS_DIR`: The directory where Devika's projects will be stored.
-- `LOGS_DIR`: The directory where Devika's logs will be stored.
-- `REPOS_DIR`: The directory where Git repositories cloned by Devika will be stored.
-- `WEB_SEARCH`: This determines the default web search method for browsing the web. Accepted values are: google, bing, or ddgs.
-- `BING`: Your Bing Search API key for web searching capabilities.
-- `GOOGLE_SEARCH`: Your Google Search API key for web searching capabilities.
-- `GOOGLE_SEARCH_ENGINE_ID`: Your Google Search Engine Id for web searching using google.
-- `CLAUDE`: Your Anthropic API key for accessing Claude models.
-- `NETLIFY`: Your Netlify API key for deploying and managing web projects.
-- `OPENAI`: Your OpenAI API key for accessing GPT models.
-
++Devika requires certain configuration settings and API keys to function properly. use the `sample.config.toml` file and create `config.toml`:
++
++- STORAGE
++ - `SQLITE_DB`: The path to the SQLite database file for storing Devika's data.
++ - `SCREENSHOTS_DIR`: The directory where screenshots captured by Devika will be stored.
++ - `PDFS_DIR`: The directory where PDF files processed by Devika will be stored.
++ - `PROJECTS_DIR`: The directory where Devika's projects will be stored.
++ - `LOGS_DIR`: The directory where Devika's logs will be stored.
++ - `REPOS_DIR`: The directory where Git repositories cloned by Devika will be stored.
++ - `WEB_SEARCH`: This determines the default web search method for browsing the web. Accepted values are: google, bing, or ddgs.
++
++- API KEYS
++ - `BING`: Your Bing Search API key for web searching capabilities.
++ - `GOOGLE_SEARCH`: Your Google Search API key for web searching capabilities.
++ - `GOOGLE_SEARCH_ENGINE_ID`: Your Google Search Engine Id for web searching using google.
++ - `OPENAI`: Your OpenAI API key for accessing GPT models.
++ - `GEMINI`: Your Gemini API key for accessing Gemini models.
++ - `CLAUDE`: Your Anthropic API key for accessing Claude models.
++ - `MISTRAL`: Your Mistral API key for accessing Mistral models.
++ - `GROQ`: Your Groq API key for accessing Groq models.
++ - `NETLIFY`: Your Netlify API key for deploying and managing web projects.
++
+ Make sure to keep your API keys secure and do not share them publicly.
- - create a `config.toml` file in the root directory of the project.
- - `OPENAI_API_KEY`: Your OpenAI API key for accessing GPT models.
- - `CLAUDE_API_KEY`: Your Anthropic API key for accessing Claude models.
- - `GEMINI_API_KEY`: Your Gemini API key for accessing Gemini models.
- - `MISTRAL_API_KEY`: Your Mistral API key for accessing Mistral models.
- - `BING_API_KEY`: Your Bing Search API key for web searching capabilities.
- - `DATABASE_URL`: The URL for your database connection.
- - `LOG_DIRECTORY`: The directory where Devika's logs will be stored.
- - `PROJECT_DIRECTORY`: The directory where Devika's projects will be stored.
+ ### Configuring web search method
- Make sure to keep your API keys secure and do not share them publicly.
-Devika currently supports Bing, Google, and DuckDuckGo for web searches. You can configure the web search method using the following options:
-
-1. **Using config.toml**: Modify the value of WEB_SEARCH in config.toml to your preferred method.
-2. **Using CLI**: Change the web search method using the command line interface by specifying the --websearch attribute when starting the server.
-```bash
- python devika.py --websearch bing
-```
-3. **Using rest api**: Change the web search method through the REST API. Simply include the web_search parameter in the /api/execute-agent endpoint.
-
-Accepted values are `bing`,`google` and `ddgs`.
++Devika currently supports Bing, Google, and DuckDuckGo for web searches. You can configure the web search method via UI.
## Under The Hood
diff --cc sample.config.toml
index 03de6c3,43e66ea..0a09258
--- a/sample.config.toml
+++ b/sample.config.toml
@@@ -1,22 -1,21 +1,21 @@@
[STORAGE]
-SQLITE_DB = "db/devika.db"
-SCREENSHOTS_DIR = "screenshots"
-PDFS_DIR = "pdfs"
-PROJECTS_DIR = "projects"
-LOGS_DIR = "logs"
-REPOS_DIR = "repos"
-WEB_SEARCH = "ddgs"
+SQLITE_DB = "data/db/devika.db"
+SCREENSHOTS_DIR = "data/screenshots"
+PDFS_DIR = "data/pdfs"
+PROJECTS_DIR = "data/projects"
+LOGS_DIR = "data/logs"
+REPOS_DIR = "data/repos"
- WEB_SEARCH = "ddgs"
[API_KEYS]
- NETLIFY = "<YOUR_NETLIFY_API_KEY>"
BING = "<YOUR_BING_API_KEY>"
- GOOGLE = "<YOUR_GOOGLE_SEARCH_API_KEY>"
+ GOOGLE_SEARCH = "<YOUR_GOOGLE_SEARCH_API_KEY>"
GOOGLE_SEARCH_ENGINE_ID = "<YOUR_GOOGLE_SEARCH_ENGINE_ID>"
CLAUDE = "<YOUR_CLAUDE_API_KEY>"
-NETLIFY = "<YOUR_NETLIFY_API_KEY>"
OPENAI = "<YOUR_OPENAI_API_KEY>"
-GROQ = "<YOUR_GROQ_API_KEY>"
GEMINI = "<YOUR_GEMINI_API_KEY>"
+MISTRAL = "<YOUR_MISTRAL_API_KEY>"
+GROQ = "<YOUR_GROQ_API_KEY>"
++NETLIFY = "<YOUR_NETLIFY_API_KEY>"
[API_ENDPOINTS]
BING = "https://api.bing.microsoft.com/v7.0/search"
diff --cc src/config.py
index f72547e,d7d6aa1..3b1ab35
--- a/src/config.py
+++ b/src/config.py
@@@ -1,5 -1,5 +1,5 @@@
import toml
--from os import environ
++import os
class Config:
@@@ -8,69 -8,74 +8,74 @@@
def __new__(cls):
if cls._instance is None:
cls._instance = super().__new__(cls)
-- cls._instance.config = toml.load("config.toml")
++ cls._instance._load_config()
return cls._instance
- def __init__(self):
++ def _load_config(self):
++ # If the config file doesn't exist, copy from the sample
++ if not os.path.exists("config.toml"):
++ with open("sample.config.toml", "r") as f_in, open("config.toml", "w") as f_out:
++ f_out.write(f_in.read())
++
+ self.config = toml.load("config.toml")
+
def get_config(self):
return self.config
- def get_bing_api_key(self):
- return environ.get("BING_API_KEY", self.config["API_KEYS"]["BING"])
-
def get_bing_api_endpoint(self):
- return environ.get("BING_API_ENDPOINT", self.config["API_ENDPOINTS"]["BING"])
+ return self.config["API_ENDPOINTS"]["BING"]
+
+ def get_bing_api_key(self):
+ return self.config["API_KEYS"]["BING"]
def get_google_search_api_key(self):
- return environ.get("GOOGLE_SEARCH_API_KEY", self.config["API_KEYS"]["GOOGLE_SEARCH"])
+ return self.config["API_KEYS"]["GOOGLE_SEARCH"]
def get_google_search_engine_id(self):
- return environ.get("GOOGLE_SEARCH_ENGINE_ID", self.config["API_KEYS"]["GOOGLE_SEARCH_ENGINE_ID"])
+ return self.config["API_KEYS"]["GOOGLE_SEARCH_ENGINE_ID"]
def get_google_search_api_endpoint(self):
- return environ.get("GOOGLE_SEARCH_API_ENDPOINT", self.config["API_ENDPOINTS"]["GOOGLE_SEARCH"])
-
+ return self.config["API_ENDPOINTS"]["GOOGLE"]
+
def get_ollama_api_endpoint(self):
- return environ.get(
- "OLLAMA_API_ENDPOINT", self.config["API_ENDPOINTS"]["OLLAMA"]
- )
+ return self.config["API_ENDPOINTS"]["OLLAMA"]
def get_claude_api_key(self):
- return environ.get("CLAUDE_API_KEY", self.config["API_KEYS"]["CLAUDE"])
+ return self.config["API_KEYS"]["CLAUDE"]
def get_openai_api_key(self):
- return environ.get("OPENAI_API_KEY", self.config["API_KEYS"]["OPENAI"])
-
- def get_gemini_api_key(self):
- return environ.get("GEMINI_API_KEY", self.config["API_KEYS"]["GEMINI"])
-
+ return self.config["API_KEYS"]["OPENAI"]
+
def get_gemini_api_key(self):
return self.config["API_KEYS"]["GEMINI"]
-
- def get_netlify_api_key(self):
- return environ.get("NETLIFY_API_KEY", self.config["API_KEYS"]["NETLIFY"])
-
+
+ def get_mistral_api_key(self):
+ return self.config["API_KEYS"]["MISTRAL"]
+
def get_groq_api_key(self):
- return environ.get("GROQ_API_KEY", self.config["API_KEYS"]["GROQ"])
-
+ return self.config["API_KEYS"]["GROQ"]
+
+ def get_netlify_api_key(self):
+ return self.config["API_KEYS"]["NETLIFY"]
+
def get_sqlite_db(self):
- return environ.get("SQLITE_DB_PATH", self.config["STORAGE"]["SQLITE_DB"])
+ return self.config["STORAGE"]["SQLITE_DB"]
def get_screenshots_dir(self):
- return environ.get("SCREENSHOTS_DIR", self.config["STORAGE"]["SCREENSHOTS_DIR"])
+ return self.config["STORAGE"]["SCREENSHOTS_DIR"]
def get_pdfs_dir(self):
- return environ.get("PDFS_DIR", self.config["STORAGE"]["PDFS_DIR"])
+ return self.config["STORAGE"]["PDFS_DIR"]
def get_projects_dir(self):
- return environ.get("PROJECTS_DIR", self.config["STORAGE"]["PROJECTS_DIR"])
+ return self.config["STORAGE"]["PROJECTS_DIR"]
def get_logs_dir(self):
- return environ.get("LOGS_DIR", self.config["STORAGE"]["LOGS_DIR"])
+ return self.config["STORAGE"]["LOGS_DIR"]
def get_repos_dir(self):
- return environ.get("REPOS_DIR", self.config["STORAGE"]["REPOS_DIR"])
+ return self.config["STORAGE"]["REPOS_DIR"]
-- def get_web_search(self):
- return self.config["STORAGE"]["WEB_SEARCH"]
- return environ.get("WEB_SEARCH", self.config["STORAGE"]["WEB_SEARCH"])
--
def get_logging_rest_api(self):
return self.config["LOGGING"]["LOG_REST_API"] == "true"
@@@ -157,10 -154,10 +162,6 @@@
self.config["LOGGING"]["LOG_PROMPTS"] = "true" if value else "false"
self.save_config()
-- def set_web_search(self, value):
-- self.config["STORAGE"]["WEB_SEARCH"] = value
-- self.save_config()
--
def save_config(self):
with open("config.toml", "w") as f:
toml.dump(self.config, f)
diff --cc ui/src/routes/settings/+page.svelte
index 5490393,d028452..0406880
--- a/ui/src/routes/settings/+page.svelte
+++ b/ui/src/routes/settings/+page.svelte
@@@ -1,127 -1,5 +1,139 @@@
-<script lang="ts">
- import Settings from "./Settings/Settings.svelte";
+<script>
+ import { updateSettings, fetchSettings } from "$lib/api";
+ import { onMount } from "svelte";
+
+ let settings = {};
+ let editMode = false;
+ let original = {};
+
+ onMount(async () => {
+ settings = await fetchSettings();
++ // this is for correcting order of apis shown in the settings page
++ settings["API_KEYS"] = {
++ "BING": settings["API_KEYS"]["BING"],
++ "GOOGLE_SEARCH": settings["API_KEYS"]["GOOGLE_SEARCH"],
++ "GOOGLE_SEARCH_ENGINE_ID": settings["API_KEYS"]["GOOGLE_SEARCH_ENGINE_ID"],
++ "CLAUDE": settings["API_KEYS"]["CLAUDE"],
++ "OPENAI": settings["API_KEYS"]["OPENAI"],
++ "GEMINI": settings["API_KEYS"]["GEMINI"],
++ "MISTRAL": settings["API_KEYS"]["MISTRAL"],
++ "GROQ": settings["API_KEYS"]["GROQ"],
++ "NETLIFY": settings["API_KEYS"]["NETLIFY"]
++ };
+ // make a copy of the original settings
+ original = JSON.parse(JSON.stringify(settings));
+
+ });
+
+ const save = async () => {
+ let updated = {};
+ for (let key in settings) {
+ if (settings[key] !== original[key]) {
+ updated[key] = settings[key];
+ }
+ }
+ await updateSettings(updated);
+
+ editMode = !editMode;
+ };
+
+ const edit = () => {
+ editMode = !editMode;
+ };
</script>
-<div><Settings /></div>
+<div class="p-4 h-full w-full gap-8 flex flex-col overflow-y-auto">
+ <h1 class="text-3xl">Settings</h1>
+ <div class="flex flex-col w-full">
+ {#if settings["API_KEYS"]}
+ <div class="flex gap-4 w-full">
+
+ <div class="flex flex-col gap-4 w-full">
+ <h2 class="text-xl">API Keys</h2>
+ <div class="flex flex-col gap-4">
+ {#each Object.entries(settings["API_KEYS"]) as [key, value]}
+ <div class="flex gap-1 items-center">
+ <p class="w-48 text-sm">{key.toLowerCase()}</p>
+ <input
+ type="text"
+ bind:value={settings["API_KEYS"][key]}
+ name={key}
+ class="p-2 border-2 w-1/2 rounded-lg {editMode ? '' : 'bg-gray-100 text-gray-500'}"
+ readonly={!editMode}
+ on:change={settings["API_KEYS"][key] = $event.target.value}
+ />
+ </div>
+ {/each}
+ </div>
+ </div>
+
+ <div class="flex flex-col gap-8 w-full">
+
+ <div class="flex flex-col gap-2">
+ <h2 class="text-xl">API Endpoints</h2>
+ <div class="flex flex-col gap-4">
+ {#each Object.entries(settings["API_ENDPOINTS"]) as [key, value]}
+ <div class="flex gap-3 items-center">
+ <p class="w-28">{key.toLowerCase()}</p>
+ <input
+ type="text"
+ bind:value={settings["API_ENDPOINTS"][key]}
+ name={key}
+ class="p-2 w-1/2 border-2 rounded-lg {editMode ? '' : 'bg-gray-100 text-gray-500'}"
+ readonly={!editMode}
+ on:change={settings["API_ENDPOINTS"][key] = $event.target.value}
+ />
+ </div>
+ {/each}
+ </div>
+
+ </div>
+ <div class="flex flex-col gap-2">
+ <h2 class="text-xl">Logging</h2>
+ <div class="flex flex-col gap-4">
+ {#each Object.entries(settings["LOGGING"]) as [key, value]}
+ <div class="flex gap-3 items-center">
+ <p class="w-28">{key.toLowerCase()}</p>
+ <input
+ type="text"
+ bind:value={settings["LOGGING"][key]}
+ name={key}
+ class="p-2 border-2 rounded-lg {editMode ? '' : 'bg-gray-100 text-gray-500'}"
+ readonly={!editMode}
+ placeholder="true/false"
+ on:change={settings["LOGGING"][key] = $event.target.value}
+ />
+ </div>
+ {/each}
+ </div>
+
+ </div>
+
+ <!-- edit and save button -->
+ <div class="flex gap-4">
+ {#if !editMode}
+ <button
+ id="btn-edit"
+ class="p-2 border-2 rounded-lg flex gap-3 items-center hover:bg-gray-200"
+ on:click={edit}
+ >
+ <i class="fas fa-edit"></i>
+ Edit
+ </button>
+ {:else}
+ <button
+ id="btn-save"
+ class="p-2 border-2 rounded-lg flex gap-3 items-center hover:bg-gray-200"
+ on:click={save}
+ >
+ <i class="fas fa-save"></i>
+ Save
+ </button>
+ {/if}
+ </div>
+ </div>
+
+ </div>
+ {/if}
+ </div>
+</div>