How eigent-ai/eigent works
Project type and purpose
• This is a self-hosted, full-stack desktop application built on Electron.
• The user interface is powered by React (TypeScript, Tailwind, Radix UI, Zustand), packaged in an Electron renderer process.
• The application embeds a FastAPI backend (Uvicorn/uv) that implements a multi-agent workforce using the CAMEL framework.
• Agents use plugin-style “toolkits” for tasks (web search, code execution, file I/O, 3rd-party APIs like Google, Slack, Notion).
High-level file-structure analysis
• Top-level directories:
• backend/: FastAPI application (app/command, controller, service, component, middleware, utils, model)
• electron/: Electron main/preload scripts (TypeScript)
• src/: React frontend (components/, pages/, routers/, store/, hooks/, lib/)
• package/, @stackframe/, @stackframe/stack-shared/: Published UI libraries and shared utilities
• Config and build artifacts: tsconfig, vite.config, electron-builder.json, GitHub workflows.
• docs/, resources/scripts: docs and installer scripts.
README insights
• Tech stack: Frontend: React + Electron + TypeScript; Backend: FastAPI + Uvicorn; Multi‐agent via CAMEL; OAuth 2.0; no external DB.
• Features: Multi‐agent coordination, human-in-loop, local model support, MCP tool integration.
Main components
a. Client layer (Electron desktop app)
• Renderer process: React UI, Zustand stores, React Flow for workflow editing
• Preload script: securely exposes IPC / HTTP bridge
• Main process: window lifecycle, updater, native shell interactions
b. API layer (FastAPI server)
• Controllers (chat_controller, task_controller, model_controller, tool_controller)
• Services (chat_service, task_service) orchestrating multi-agent workflows
• Components: Camel-AI core, Pydantic validation, encryption, environment loader, debug
• Middleware & exception handlers: logging, error translation
c. Multi-Agent Core & Toolkits
• Multi-agent engine (CAMEL) coordinates agents in parallel
• Toolkit plugins (audio, image, browser, code execution, Slack, Google, GitHub, file I/O, etc.)
• Workforce manager (sync_step, single_agent_worker)
d. External integrations
• Third-party REST APIs: OpenAI or local model endpoints, Google Calendar/Drive/Gmail, Notion, Slack, Twitter, LinkedIn, etc.
• Local OS: file system, terminal (for code execution toolkit)
e. Data flow / storage
• In-memory stores (Zustand in UI; Python objects in FastAPI)
• Local file store for user data, logs, report HTML (no external database shown)
Relationships & interactions
1. User clicks in the React UI → React sends HTTP requests (via http.ts) through Electron’s preload to FastAPI endpoints.
2. FastAPI controller routes the request → invokes the appropriate service.
3. Service initializes a multi-agent “workforce” → divides task into subtasks, spins up agents via Camel.
4. Each agent uses toolkit components to perform actions (web requests, code runs, file reads/writes, human-in-loop prompts).
5. Agents emit events/results back to the service → aggregated results returned via controller to UI.
Architectural patterns & design principles
• Layered architecture: Presentation (UI), API (controllers), Business (services), Core (Camel engine), Plugins (toolkits)
• Plugin pattern for toolkits: each toolkit implements a common abstract interface
• MVC-style separation (controller → service → component)
• Event-driven multi-agent orchestration
• Local first / zero-setup: backend runs locally via uv, no external infra required