How stitionai/devika works
Project Type and Purpose
• Devika is a full-stack AI application that acts as an autonomous software engineer. It integrates LLMs (like GPT‐4, Claude 3, Gemini, etc.), advanced planning/reasoning, web browsing, and a UI for interactions.
• Key functionalities include parsing high-level objectives, breaking tasks into subtasks, researching, writing code, and project management. Its ambitious goal (mirroring Devin) shows the need to emphasize both the frontend (UI) and a highly modular backend engine.
File Structure and its Architectural Implications
• There’s a clear separation between frontend and backend:
– The “ui” directory comprises a modern web interface built with Svelte (using Vite, Tailwind, bun, etc.).
– The “src” directory contains most of the backend logic.
• Besides the agents, there are specialized modules:
– “llm”: Facilitates communication with various large language model providers (OpenAI, Claude, Gemini, etc.)
– “memory”: Implements knowledge base and retrieval mechanisms.
– “filesystem”, “services”, “sandbox”, “documenter”, and “browser”: Provide additional capabilities such as code reading, integration with external services (Git, GitHub, Netlify), safe code execution (via firejail), and generating documentation or visual representations (graphviz, UML).
• The presence of Dockerfiles, docker-compose.yaml, and Makefile indicates containerization and scripted setups for development and deployment.
• Documentation (docs/ directory) further details installation and architecture—important for verifying component interactions.
a. Main Components:
• Frontend/UI: Represent the web interface (in “ui”) which communicates with the backend API.
• Core Backend Engine: Include the primary server script (devika.py) and higher-level orchestrator (src/project.py, src/init.py) coordinating tasks.
• LLM Integration: Illustrate the “llm” module that encapsulates different client integrations (openai, claude, mistral, etc.).
• Services and External Integrations: Highlight connectors for Git, GitHub, Netlify (from src/services), search via external APIs, and browser interaction.
• Memory & State Management: Include components for memory (knowledge base, RAG) and state tracking.
• Utilities: Represent support modules like filesystem and sandbox (for secure code execution).
• Infrastructure/Containerization: Optionally include Docker and docker-compose components as they are used for deployment/testing.
b. Relationships and Data Flow:
• From the central orchestrator (e.g., devika.py / src/project.py), illustrate how high-level instructions are delegated to specific agent modules.
• That services (browser, file system, sandbox, etc.) are called by agents or the core engine.
c. Architectural Patterns and Design Principles:
• Modular Design: Emphasize that each agent is self-contained yet interacts with a common orchestration backend.
• Separation of Concerns: Clearly divide the UI/Client from backend processing and external integrations.
• Extensibility: Note that new agent types or external service connectors can be added, with clear “pluggable” interfaces.
• Containerization: Reflect the use of Docker and docker-compose for streamlined development and deployment environments.
d. Relevant Technologies and Frameworks:
• Frontend: Svelte, Vite, Tailwind CSS, bun (JavaScript runtime)
• Backend: Python (with uv for environment management), various Python libraries as defined in requirements.txt.
• LLM Integrations: Using API keys for providers (OpenAI, Anthropic, etc.) via dedicated client modules.
• Tooling: Playwright for browser automation; Docker for containerization; GitHub actions (in .github directory) for CI/CD.
Detailed Steps for the Principal Software Engineer
• Lay out the core processing unit (devika.py and project orchestration) in the backend.
• Branch out from the core orchestrator with sub-components for each “agent” (action, answer, coder, etc.) in the agents module.
• Agents to the LLM integration module (src/llm) to represent calls to GPT-4, Claude, etc.
• Supporting modules like “memory”, “filesystem”, and “sandbox” next to the agents, showing that they supply auxiliary functionality.
• Lastly, incorporate containerization elements (Dockerfiles, Compose) to indicate the system deployment environment.
• Verify that each component is clearly labeled and that relevant integrations (e.g., API keys and endpoints) are noted.