A sophisticated autonomous multi-agent system built with Google's Agent Development Kit (ADK). This system enables multiple AI agents to work together autonomously to accomplish complex tasks through intelligent task decomposition and coordination.
The ORC (Orchestration) system is a peer-to-peer multi-agent architecture where agents autonomously monitor a shared workspace, claim tasks they're equipped to handle, and coordinate through file-based communication. No central orchestrator is needed - agents self-organize through intelligent decision making.
- Autonomous Operation: Agents decide independently what tasks to take
- Natural Equilibrium: Specialist agents prevent infinite task breakdown loops
- LLM-Based Intelligence: Each agent uses three LLMs for execution, evaluation, and metacognition
- Atomic Coordination: Race-condition-free task claiming using
os.rename() - Goal Preservation: Original objectives are maintained through task decomposition chains
- Purpose: Decomposes complex tasks into actionable sequential steps
- Capabilities:
task_decomposition,orchestration,planning - Key Features:
- Analyzes task complexity before breakdown
- Creates subtasks with proper dependencies
- Prevents infinite breakdown loops through intelligence
- Preserves original goal context throughout decomposition
- Purpose: Handles all web search and research operations
- Capabilities:
web_search,google_search,research - Key Features:
- Multiple search types (general, news, academic, tutorials, local)
- Result analysis and summarization
- Research task coordination
- Purpose: Manages all file operations and code generation
- Capabilities:
file_operations,code_analysis,text_processing,agent_generation - Key Features:
- Complete file operations (read, write, create, delete, copy)
- Code analysis and syntax checking
- New agent code generation
- Text processing and document creation
- Purpose: Executes system commands and manages environments
- Capabilities:
command_execution,system_operations,cli_navigation - Key Features:
- Safe command execution with built-in safety checks
- System information gathering
- Environment setup and package installation
- Process management and monitoring
Each agent contains three specialized LLMs:
- Executor LLM: Performs the actual task work
- Evaluator LLM: Assesses task fitness and capability matching
- Metacognition LLM: Provides self-reflection and prevents infinite loops
workspace/
โโโ tasks/
โ โโโ pending/ # New tasks waiting to be claimed
โ โโโ active/ # Tasks currently being processed
โ โโโ completed/ # Successfully completed tasks
โ โโโ failed/ # Failed tasks (with retry logic)
โโโ agents/ # Agent heartbeat/status files
โโโ context/ # Task results for future reference
โโโ results/ # Final outputs and artifacts
- Task Creation: User drops JSON task files in
workspace/tasks/pending/ - Agent Monitoring: All agents continuously scan for new tasks
- Capability Evaluation: Agents assess if they can handle each task
- Atomic Claiming: First suitable agent atomically claims task via
os.rename() - Task Processing: Agent processes task with metacognitive oversight
- Result Storage: Completed tasks moved to appropriate folder with results
- Context Preservation: Results saved for future task context
Complex Task โ TaskBreakdownAgent โ Subtasks โ Specialist Agents โ Results
- Python 3.8+
- Google API Key (Gemini) or Vertex AI access
- ADK installed (
pip install google-adk)
-
Clone and Setup Environment:
git clone <repository> cd orc python3 setup_multi_agent.py
-
Configure Environment:
- Copy
.env.exampleto.env - Add your Google API keys:
GOOGLE_API_KEY=your_api_key_here # OR for Vertex AI: GOOGLE_GENAI_USE_VERTEXAI=true
- Copy
-
Start Agents (each in separate terminal):
# Terminal 1 - Task Breakdown cd task-breakdown-agent python3 run_autonomous.py # Terminal 2 - Search Operations cd google-search-agent python3 run_autonomous.py # Terminal 3 - File Operations cd file-agent python3 run_autonomous.py # Terminal 4 - Terminal Operations cd terminal-agent python3 run_autonomous.py
Create test tasks to see the agents in action:
# Create complex tasks for breakdown
cd task-breakdown-agent
python3 create_test_task.py
# Create file operation tasks
cd file-agent
python3 create_test_task.py
# Create search tasks
cd google-search-agent
python3 create_test_task.py
# Create terminal tasks
cd terminal-agent
python3 create_test_task.pyTasks are JSON files placed in workspace/tasks/pending/. Example:
{
"id": "unique-uuid",
"description": "Research Python web frameworks and create comparison document",
"type": "complex_goal",
"requirements": ["task_decomposition", "orchestration"],
"priority": "high",
"context": {
"original_goal": "Learn about web frameworks",
"deadline": "2024-01-15"
},
"created_at": "2024-01-01T10:00:00Z",
"max_retries": 3
}complex_goal: Multi-step tasks requiring breakdownweb_search: Search and research tasksfile_operations: File system and code tasksterminal_operations: Command execution tasks
Environment variables (.env):
# Required: Google API access
GOOGLE_API_KEY=your_key_here
# OR
GOOGLE_GENAI_USE_VERTEXAI=true
# Optional: System tuning
WORKSPACE_PATH=./workspace
MAX_CONCURRENT_TASKS=3
POLLING_INTERVAL=2Check workspace/agents/ for agent heartbeat files showing:
- Agent status and capabilities
- Active task count
- Last heartbeat timestamp
Monitor task folders:
pending/: Tasks waiting to be claimedactive/: Tasks being processed (prefixed with agent ID)completed/: Finished tasks with resultsfailed/: Failed tasks with error details
Check workspace/context/ for task results and context information that agents use for future tasks.
- Command Safety: TerminalAgent blocks dangerous commands
- Timeout Protection: All operations have timeout limits
- Retry Logic: Failed tasks automatically retry with backoff
- Metacognitive Oversight: Agents self-reflect before taking actions
- Loop Prevention: Natural equilibrium prevents infinite task breakdown
The system is designed for easy extension:
- New Agent Types: Follow the BaseAgent pattern
- Custom Tools: Extend ADK BaseTool for agent capabilities
- Task Types: Add new task schemas and processing logic
- Coordination Patterns: Implement new agent interaction patterns
- Complete Documentation - Comprehensive system documentation
- Quick Reference - Essential commands and troubleshooting
- Architecture Design - Detailed system architecture
- Agent Types - Full agent capability matrix
- Final Architecture - Implementation architecture
- ADK Exploration - ADK research and documentation
Priority 2 Agents (ready for implementation):
- GitAgent, TestAgent, DatabaseAgent, APIAgent
Priority 3 Agents:
- EmailAgent, SlackAgent, DataAnalysisAgent, DocumentAgent
Advanced Features:
- Web UI for monitoring and control
- Agent performance analytics
- Dynamic agent spawning
- Cross-agent memory sharing
[Add your license here]
[Add contribution guidelines here]
Built with Google's Agent Development Kit (ADK)
Autonomous. Intelligent. Coordinated.