How timecyber/deepmanus works
Main Components
• Core Engine/Workflow:
• Entry points: main.py and server.py (API server using FastAPI)
• Workflow management from src/workflow.py and the orchestration mechanics in src/service/workflow_service.py
• Multi-Agent System:
• Agents: code under src/agents/agents.py along with role-specific prompts in src/prompts (each markdown file for Supervisor, Researcher, Coder, etc.)
• Coordination mechanism: the hierarchical layering (Coordinator, Planner, Supervisor) as described in README and reflected in the agent modules.
• LLM Integration:
• Several LLM integration components under src/llms for reasoning (litellm_v2.py, litellm_config.py) and the general llm.py
• Configurable through configuration files in src/config and the conf.yaml example.
• Web and API Layer:
• API endpoints are implemented in src/api/app.py with streaming capabilities.
• The project includes Docker and Docker Compose configurations for running both backend and a separate web UI (frontend) provided in the documentation.
• Auxiliary Components:
• Crawler: Modules in src/crawler for web scraping, handling article extraction, and interacting with external web services via browser automations (Playwright).
• Tools: Utility modules in src/tools for bash tools, file management, and search functions.
• Graph: Visualization or task workflow graph construction in src/graph.
• Config and environment management in src/config, complemented by .env and conf.yaml for flexible configuration.
• Testing and quality assurance scripts in tests/ and integration set up via Makefile and pre-commit.
Relationships and Interactions
• The API server (backend) acts as an entry point for external requests. It will forward tasks to the multi-agent system that uses the hierarchical agent roles.
• The Coordinator (entry agent) receives a task request and delegates specific portions to specialized agents (e.g., Planner, Supervisor, Researcher, Coder).
• Each agent interacts with the LLM layer to generate responses or execute actions.
• The crawler and browser components employ Playwright (via src/playwright_manager.py and browser_use) to retrieve external data.
• The configuration modules (under src/config) provide standardized parameters and environment setups for agents and LLM integrations.
• Tools and utilities enrich functionality, while testing and pre-commit hooks ensure code quality.
Architectural Patterns and Design Principles
• Modular design: The project is organized into clear modules (agents, api, config, crawler, tools, utils), reflecting a separation of concerns.
• Multi-agent orchestration: Hierarchical multi-agent system where responsibilities are divided among specialized agents.
• Extensibility: Role-based prompt templates allow addition or customization of agent behavior without changing core logic.
• Integration-oriented design: Built-in support for multiple LLM providers (via litellm), external tools, and browser automation.
• Configuration flexibility: Use of environment variables and layered configuration (conf.yaml vs. .env), making the system adaptable to different deployment scenarios.
Relevant Technologies, Frameworks, and Libraries
• Python 3.12+ for the core implementation.
• FastAPI (in src/api/app.py) for the REST API server.
• Playwright integration (see src/playwright_manager.py and browser_use folder) for browser automation.
• Docker and docker-compose for containerized deployment.
• uv package manager for dependency management.
• Pre-commit hooks for linting and formatting, ensuring code quality.
Elements
• Clear labels for each primary component: API Server, Workflow Manager, Multi-Agent System (with individual agent roles like Coordinator, Planner, Supervisor, Researcher, Coder, Browser, Reporter), LLM Integration, Configuration Manager, Crawler/Browser Modules, and Auxiliary Tools.
• User/API requests flowing into the API server, then to the Coordinator.
• Task delegation from the Coordinator to other agents.
• Data coming from external sources (via crawler/browser) feeding into agents for processing.
• Final responses being routed back to the API server for client delivery.
• Core application logic (e.g., multi-agent orchestration modules)
• External interfaces (API endpoints, browser automation components)
• Configuration and utility layers.
• Important integration points such as database connections (if any), LLM service configurations, and Docker components.