A system demonstrating collaboration between specialized AI agents using LangGraph and LangChain. Implementation is derived from the following sources:
This project implements a workflow where multiple AI agents collaborate to complete complex tasks. The current implementation features two specialized agents:
- A Research Agent that can search for information
- A Chart Generator Agent that can create data visualizations
- Multi-Agent Workflow: Uses LangGraph to coordinate between agents
- Specialized Agents: Each agent has specific capabilities and tools
- State Management: Maintains conversation state between agents
- Conditional Routing: Smart routing between agents based on task completion
- Python 3.9+
- Required packages:
- langchain
- langchain-anthropic
- langgraph
- matplotlib
- jupyter
- IPython
The following API keys need to be set as environment variables:
ANTHROPIC_API_KEY
- for Claude 3.5 SonnetTAVILY_API_KEY
- for web search capabilities
- Open the Jupyter notebook:
jupyter notebook multi-agent-collaboration.ipynb
-
Run all cells in order
-
The system will:
- Initialize the agents and tools
- Set up the workflow graph
- Execute the specified task
- Display results with proper formatting
The notebook includes an example task where the agents:
- Research UK's GDP data for the past 5 years
- Create a line chart visualization of the data
The system consists of:
- Research Node: Handles data gathering using Tavily search
- Chart Node: Creates visualizations using matplotlib
- Router: Manages workflow between agents
- State Graph: Coordinates the overall agent collaboration
The system provides:
- Detailed state tracking of agent interactions
- Visual output (charts/graphs) when generated
- Structured conversation history
- Clear indication of task completion