This project implements a 3-sub-agent workflow for research and report writing using LlamaIndex and Google Gemini AI.
The workflow consists of three specialized agents that work together:
- Purpose: Searches for information on the web and records research notes
- Tools:
search_web: Performs Google searches for relevant informationrecord_notes: Saves research findings with titles
- Output: Research notes stored in the workflow state
- Purpose: Creates professional reports based on research notes
- Tools:
write_report: Generates Markdown-formatted reports
- Output: Report content stored in the workflow state
- Purpose: Evaluates report quality and provides feedback
- Tools:
review_report: Records evaluation and feedback
- Output: Review feedback stored in the workflow state
User Request → ResearchAgent → WriteAgent → ReviewAgent → Final Response
↓ ↓ ↓ ↓
Orchestrator Web Search Report Writing Quality Review
multi-agent/
├── config.py # Agent configurations and tool definitions
├── workflow.py # Main workflow orchestration logic
├── main.py # Complete workflow example
├── simple_test.py # Simple test script
├── test_workflow.py # Setup verification script
├── requirements.txt # Python dependencies
└── README.md # This file
-
Install Dependencies
pip install -r requirements.txt
-
Set Environment Variables Create a
.envfile in the project root:GOOGLE_API_KEY=your_google_api_key_here -
Test Setup
python test_workflow.py
-
Run Simple Test
python simple_test.py
-
Run Complete Example
python main.py
from config import research_agent_config, write_agent_config, review_agent_config
from workflow import ConciergeAgent
from llama_index.llms.google_genai import GoogleGenAI
# Initialize components
llm = GoogleGenAI(model="gemini-2.0-flash", temperature=0.3)
workflow = ConciergeAgent()
# Run workflow
handler = workflow.run(
agent_configs=[research_agent_config, write_agent_config, review_agent_config],
user_msg="Viết báo cáo về xu hướng AI 2024",
chat_history=[],
initial_state={
"research_notes": {},
"report_content": "",
"review": "",
},
llm=llm,
)
# Get results
result = await handler
print(result["response"])Each agent is configured in config.py with:
- Name: Agent identifier
- Description: What the agent does
- System Prompt: Instructions for the agent
- Tools: Available functions the agent can use
- Human Confirmation: Tools requiring approval
The workflow maintains state across agents:
research_notes: Dictionary of research findingsreport_content: Generated report textreview: Evaluation feedback
- Research Report: "Viết báo cáo về xu hướng AI 2024"
- Update Report: "Cập nhật báo cáo với thông tin mới nhất về AI 2025"
- Topic Research: "Nghiên cứu về blockchain technology"
Agents can transfer control to other agents using the request_transfer() tool. The orchestrator decides which agent to activate next based on:
- Current workflow state
- User request
- Agent capabilities
The workflow provides real-time progress updates:
- Tool execution status
- Agent transfers
- State changes
- Error handling
-
API Key Missing
❌ Please set your GOOGLE_API_KEY in the .env fileSolution: Create a
.envfile with your Google API key -
Import Errors
ModuleNotFoundError: No module named 'llama_index'Solution: Install dependencies with
pip install -r requirements.txt -
Tool Execution Issues
Encountered error in tool callSolution: Check that all tools are properly defined in
config.py -
State Not Updating
Research Notes: 0 itemsSolution: Ensure tools are being called and approved by the workflow
To enable verbose logging, set verbose=True when creating the workflow:
workflow = ConciergeAgent(verbose=True)✅ Working Features:
- 3 sub-agent workflow architecture
- Agent orchestration and transfers
- Tool execution and approval system
- State management across agents
- Progress monitoring and logging
🔄 In Development:
- Real Google Search integration (currently using mock data)
- Persistent state storage
- Enhanced error handling
- Web UI interface
- Add real Google Search API integration
- Implement agent memory persistence
- Add web UI for interaction
- Support for different report formats
- Integration with external data sources
- Add more specialized agents (e.g., Data Analysis Agent)
For issues or questions:
- Check the troubleshooting section above
- Verify your Google API key is set correctly
- Ensure all dependencies are installed
- Run the test scripts to verify setup
When the workflow is working correctly, you should see:
- Progress messages with emojis (📢, 🔧, ✅)
- Tool execution confirmations
- Agent transfer notifications
- Final response with state information
- Non-zero values for research notes, report content, and review