A sophisticated multi-agent system that coordinates multiple AI agents, tools, and workflows to accomplish complex tasks.
Instead of relying on a single LLM to handle everything, the orchestrator:
- Understands user goals
- Breaks them into subtasks
- Chooses the best agent/tool for each task
- Tracks execution state
- Handles failures and retries
- Aggregates results
- Returns final responses
- Agent Registry: Dynamic registration and discovery of agents
- Planner Agent: Decomposes goals into task plans with dependencies
- Router Agent: Selects optimal agents for each task
- Workflow Engine: Supports sequential, parallel, and dependency-based execution
- Memory System: Short-term storage + ChromaDB vector database for long-term memory
- State Management: Tracks execution state, completed/failed tasks
- Observability: OpenTelemetry integration and structured logging
- Web Search Tool: Functional DuckDuckGo integration for current information
- File Operations: Read, write, edit, and list directory contents
- Code Execution: Safe Python code execution with restricted operations
- Tool-Agent Integration: Agents can now actually use tools to accomplish tasks
- PlannerAgent: Creates execution plans from user goals
- RouterAgent: Routes tasks to appropriate agents
- SynthesizerAgent: Combines results into final coherent responses
- ResearchAgent: Performs web research using search tools
- FinanceAgent: Analyzes financial data and stock information
- CodingAgent: Writes, runs, and debugs code using Python execution and file operation tools
- CriticAgent: Reviews and critiques outputs from other agents, identifies flaws and suggests improvements
- ReviewerAgent: Performs final validation on outputs, checking completeness, correctness, and consistency
- OpenAI: GPT models
- Anthropic: Claude models
- HuggingFace: Open-compatible models (now the default provider)
# Clone the repository
git clone <repository-url>
cd agent-orchestrator
# Install dependencies
pip install -e .
# Set up environment variables (copy from .env.example)
cp .env.example .env
# Edit .env to add your API keys# Run a single goal
orchestrator run --provider huggingface "Analyze Tesla stock and create a report"
# Interactive mode
orchestrator interactive --provider huggingface
# Start the API server
orchestrator serve --provider huggingface --port 8000Once the server is running (orchestrator serve):
- GET / - API information and endpoint documentation
- POST /run - Execute a goal:
{"goal": "your task here"} - GET /status/{session_id} - Get session results
- POST /agents/register - Register custom agents
- GET /agents - List registered agents
- GET /health - Health check
For the goal: "Analyze Tesla stock, find recent news, compare competitors, and create an investment report."
-
Planner Agent creates execution plan:
- Task 1: Research Tesla company info
- Task 2: Gather latest Tesla news
- Task 3: Analyze Tesla stock metrics
- Task 4: Research competitor companies (Ford, GM, etc.)
- Task 5: Write Python script to compare financial ratios
- Task 6: Review the financial analysis for accuracy
- Task 7: Final validation of the investment report
- Task 8: Generate investment report
-
Router Agent assigns tasks:
- Research tasks → ResearchAgent (with web search tool)
- Finance tasks → FinanceAgent (with web search tool)
- Code tasks → CodingAgent (with Python + file tools)
- Review tasks → CriticAgent (identifies flaws, suggests improvements)
- Validation tasks → ReviewerAgent (final approval gate)
- Report generation → SynthesizerAgent
-
Agents execute using their tools:
- ResearchAgent searches web for company info and news
- FinanceAgent searches for financial data and stock metrics
- CodingAgent writes and runs Python analysis scripts
- CriticAgent reviews outputs for accuracy and completeness
- ReviewerAgent performs final validation before output
-
Synthesizer Agent combines all results into final report
-
State Management tracks progress and handles failures
# Read a file
read_tool = ReadFileTool()
content = await read_tool.execute("config.txt")
# Write a file
write_tool = WriteFileTool()
result = await write_tool.execute("output.txt", "Hello World")
# Edit a file
edit_tool = EditFileTool()
result = await edit_tool.execute("config.txt", "old_value", "new_value")
# List directory
list_tool = ListDirectoryTool()
files = await list_tool.execute("./")# Execute Python code
python_tool = PythonExecutionTool()
result = await python_tool.execute("""
import math
print(f"Square root of 16: {math.sqrt(16)}")
for i in range(5):
print(f"Number: {i}, Square: {i**2}")
""")# Search the web
search_tool = WebSearchTool()
results = await search_tool.execute("latest AI developments 2024", num_results=5)
# Returns list of dicts with title, snippet, urlUser Goal
│
▼
┌─────────────┐
│ Planner │◄────────────┐
└─────────────┘ │
│ ▼
▼ ┌──────────────┐
┌─────────────┐ │ Router │
│ Task 1 │───►│ (Agent │
│ [Research] │ │ Selection) │
└─────────────┘ └──────────────┘
│ ▲
▼ │
┌─────────────┐ │
│ Research │◄────────────┘
│ Agent │
│ (uses web │
│ search tool)│
└─────────────┘
│
▼
┌─────────────┐
│ Result 1 │
└─────────────┘
│
▼
┌─────────────┐
│ Synthesizer│◄───────┐
│ Agent │ │
└─────────────┘ │
│ ▼
▼ ┌─────────────┐
┌─────────────┐│ Research │
│ Final Result│◄────────────│
└─────────────┘│ Agent │
└─────────────┘
- Create a new class inheriting from
Toolinsrc/orchestrator/tools/ - Implement the
executemethod - Add the tool to
src/orchestrator/tools/__init__.py - Add the tool to any agent's
toolslist
- Create a new class inheriting from
BaseAgentinsrc/orchestrator/agents/ - Implement the
runmethod - Add the agent to
src/orchestrator/agents/__init__.py - Register the agent in the orchestrator (automatic for built-ins)
- Create a new class inheriting from
LLMinsrc/orchestrator/llm/ - Implement the
generatemethod - Add the provider to
src/orchestrator/llm/__init__.py - Add the provider to the
create_llmfactory function
Run the test suite:
python -m pytest tests/ -vMIT
Built with:
- FastAPI for the API server
- Pydantic for data validation
- Rich for beautiful CLI output
- ChromaDB for vector storage
- OpenTelemetry for observability
- HuggingFace Hub for LLM access