A collaborative Agent-to-Agent (A2A) system built using LangChain and LangGraph, designed to generate detailed and well-structured research reports through intelligent agent cooperation.

System architecture built with LangGraph illustrating multi-agent collaboration.
multi_agent_researcher/
├── assets/
│ └── (graph visualizations saved here)
├── .env
├── requirements.txt
├── prompts.py
├── agents.py
├── graph.py
├── visualize_graph.py
├── app.py
└── README.md
- Python 3.9 or higher
- pip package manager
- (Optional) Graphviz for graph visualization
mkdir multi_agent_researcher
cd multi_agent_researcherpip install -r requirements.txtCreate a .env file in the root directory:
# Get API key from https://www.together.ai/
TOGETHER_API_KEY=your_together_api_key_here
# Get API key from https://tavily.com/
TAVILY_API_KEY=your_tavily_api_key_hereGetting API Keys:
- Together AI: Sign up at together.ai and create an API key
- Tavily: Sign up at tavily.com and get your API key
Ubuntu/Debian:
sudo apt-get install graphviz graphviz-devmacOS:
brew install graphvizWindows:
choco install graphviz
python visualize_graph.pyThis creates a visual diagram of the agent workflow in assets/research_graph.png
streamlit run app.pyThe app will open in your browser at http://localhost:8501
The system uses four specialized AI agents that work together:
-
** Supervisor Agent**
- Coordinates the entire workflow
- Decides which agent should work next
- Manages task delegation
-
** Researcher Agent**
- Searches the web for relevant information
- Uses Tavily search API
- Gathers and compiles research findings
-
** Writer Agent**
- Creates research reports from findings
- Revises drafts based on feedback
- Ensures coherent and well-structured output
-
** Critiquer Agent**
- Reviews drafts for quality
- Provides actionable feedback
- Approves final reports
Start → Supervisor → Researcher → Supervisor → Writer → Critiquer → Supervisor
↑ ↓
└────────────────── (loop until approved) ──────────────┘
1. Import Errors
# Reinstall all dependencies
pip install -r requirements.txt --upgrade2. API Key Errors
- Verify your
.envfile is in the project root - Check that API keys are correct and active
- Ensure no extra spaces in the
.envfile
3. Together AI Connection Issues
- The code uses Together AI's OpenAI-compatible endpoint
- Ensure your API key has sufficient credits
- Check network connectivity
4. Graphviz Installation Issues
- Graphviz is optional for visualization
- The app will work without it
- If needed, follow