Content
# 🧠 Tavily-A2A-Agent
The Tavily-A2A-Agent is an AI agent built with the LangGraph framework, leveraging Agent-to-Agent (A2A) communication and Tavily’s advanced search capabilities via the Tavily MCP Server. It showcases how autonomous agents can collaborate using real-time web search integrated seamlessly into their workflows.
## 🔍 Key Features
- LangGraph-powered multi-agent architecture: Compose complex, controllable agent workflows using LangGraph framework.
- Agent-to-agent protocol (A2A): Enables agents to collaborate, delegate tasks, and exchange results in a modular and scalable manner.
- Tavily MCP integration: Equipped with Tavily search, extract, map, and crawl tools, offering real-time, AI-optimized web search and data extraction.
- Dynamic tool use: Agents automatically decide when to search, extract, or analyze based on task requirements, enabling deep and adaptable workflows
🚀 Why It Matters
- Tavily’s search API is purpose-built for LLMs and agents, delivering AI-friendly, citation-rich results ideal for research or reasoning tasks.
- When combined with LangGraph, which enables structured planning, tool invocation, state management, and agent collaboration, this agent showcases how to build truly intelligent, web-connected systems.
## 📓 Prerequisites
- Python 3.12 or higher
- UV - Python package manager
- Gemini API Key
- Tavily API Key
## 🛠️ Installation Instructions
To install the project, follow these steps:
create a .env in the project directory with the following content
```
GOOGLE_API_KEY="<Your-Gemini-key>"
TAVILY_API_KEY="<Your-Tavily-key>"
```
```bash
git clone https://github.com/Major-wagh/tavily-a2a-agent.git
cd tavily-a2a-agent
# if .env file is not created
export GOOGLE_API_KEY="<Your-Gemini-key>"
export TAVILY_API_KEY="<Your-Tavily-key>"
uv run .
```
## 🚀 Usage Instructions
### Option 1: Using A2A Host Agent
You can test the Tavily agent using the A2A host cli:
```bash
# Clone the A2A samples if you haven't already
git clone https://github.com/a2aproject/a2a-samples.git
cd a2a-samples/samples/python/hosts/cli/
# run cli
uv run . --agent http://localhost:10000
```
This will start an interactive CLI that connects to your Tavily agent server.
### Option 2: Using Direct HTTP Requests
You can also test using curl or any HTTP client:
```bash
curl -X POST http://localhost:10000/ \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "message/send",
"params": {
"message": {
"role": "user",
"parts": [
{
"kind": "text",
"text": "Who is Cristiano Ronaldo?"
}
],
"messageId": "728bc428-5769-4dd6-a97a-96ba42b450b3"
},
"metadata": {}
}
}'
```
## 🤝 Contribution Guidelines
To contribute to the project, follow these steps:
1. Fork the repository.
2. Create a new branch.
3. Make your changes.
4. Submit a pull request.
## 📄 License Information
This project is licensed under the MIT License.