A unified AI agent system integrating Retrieval-Augmented Generation (RAG), Agent-to-Agent (A2A) communication, and Model Context Protocol (MCP) for document processing, web search, and intelligent task delegation.
agentic-rag-a2a-mcp is an early-stage Python project in the AI payments / x402 ecosystem, focused on a2a-mcp, a2a-protocol, agent-to-agent, agentic-ai. It currently has 1 GitHub stars and 3 forks, and sits alongside related tools like aser, join.cloud, summoner-agents, awesome-a2a-libraries, a2a-demos, the-academy.
A comprehensive AI agent system that combines Model Context Protocol (MCP), Agent-to-Agent (A2A) communication, and Agentic RAG capabilities into one powerful platform for intelligent document processing, web search, and task automation.
If you're using Python 3.13, you may see some harmless warnings during shutdown:
RuntimeError: Attempted to exit cancel scope in a different task than it was entered in
These are expected warnings due to anyio/MCP compatibility with Python 3.13 and do not affect system functionality. The system will still:
┌─────────────────────────────────────────────────────────────────┐
│ MCPxA2AxAgentic-RAG System │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Host Agent │◄──►│ Agentic RAG │ │
│ │ (Port 10001) │ │ Agent │ │
│ │ │ │ (Port 10002) │ │
│ │ • Orchestrates │ │ │ │
│ │ • Coordinates │ │ • Document RAG │ │
│ │ • Integrates │ │ • Q&A System │ │
│ └─────────────────┘ └─────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ MCP Tools Layer │ │
│ │ │ │
│ │ ┌─────────────┐ ┌─────────────┐ │ │
│ │ │Web Search │ │Terminal │ │ │
│ │ │Server │ │Server │ │ │
│ │ │ │ │ │ │ │
│ │ │• SerpAPI │ │• Commands │ │ │
│ │ │• Real-time │ │• File Ops │ │ │
│ │ │• Search │ │• System │ │ │
│ │ └─────────────┘ └─────────────┘ │ │
│ └─────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
model.py for consistency# Required API Keys
export SERPAPI_KEY="your_serpapi_key_here"
export GOOGLE_API_KEY="your_google_api_key_here"
# Clone and setup
git clone <repository-url>
cd mcp_a2a_agentic_rag
pip install -r requirements.txt
Start the system:
python main.py
Once started, access the system at:
streamlit run app/streamlit_ui.pyCreate a .env file in the project root:
GOOGLE_API_KEY=your_google_api_key
SERPAPI_KEY=your_serpapi_key
{
"query": "latest AI developments",
"max_results": 5
}
{
"command": "ls",
"args": ["-la"]
}
mcp_a2a_agentic_rag/
├── 📄 main.py # System entry point
├── 📄 model.py # Centralized model configuration
├── 📄 requirements.txt # Dependencies
├── 📄 mcp_config.json # MCP server configuration
├── 📄 .env.example # Environment variables template
├── 📄 kill_services.sh # Service management script
│
├── 📁 agents/ # A2A Agent implementations
│ ├── 📁 host_agent/ # Central orchestrator agent
│ │ ├── 📄 main.py # Host agent server
│ │ ├── 📄 agent.py # Host agent logic
│ │ ├── 📄 agent_executor.py
│ │ ├── 📄 instructions.txt # Agent instructions
│ │ └── 📄 description.txt # Agent description
│ │
│ └── 📁 agentic_rag_agent/ # Specialized RAG agent
│ ├── 📄 main.py # RAG agent server
│ ├── 📄 agent.py # RAG agent logic
│ ├── 📄 agent_executor.py
│ ├── 📄 rag_orchestrator.py
│ ├── 📄 instructions.txt
│ └── 📄 description.txt
│
├── 📁 mcp/ # MCP Server implementations
│ └── 📁 servers/
│ ├── 📁 web_search_server/ # SerpAPI web search
│ │ └── 📄 web_search_server.py
│ └── 📁 terminal_server/ # Terminal command execution
│ └── 📄 terminal_server.py
│
├── 📁 utilities/ # Shared utilities
│ ├── 📁 a2a/ # A2A communication utilities
│ │ ├── 📄 agent_connect.py
│ │ ├── 📄 agent_discovery.py
│ │ └── 📄 agent_registry.json
│ │
│ ├── 📁 mcp/ # MCP utilities
│ │ ├── 📄 mcp_connect.py
│ │ └── 📄 mcp_discovery.py
│ │
│ └── 📁 common/ # Common utilities
│ └── 📄 file_loader.py
│
└── 📁 app/ # Web interface
└── 📄 streamlit_ui.py # Streamlit web UI
model.py)All models are centrally configured for easy switching:
MODEL_INFO = {
"llm_model": "gemini-2.0-flash-exp",
"llm_provider": "Google AI",
"embed_model": "nomic-ai/nomic-embed-text-v1.5",
"embed_provider": "HuggingFace"
}
mcp_config.json){
"mcpServers": {
"web_search": {
"command": "python",
"args": ["mcp/servers/web_search_server/web_search_server.py"]
},
"terminal": {
"command": "python",
"args": ["mcp/servers/terminal_server/terminal_server.py"]
}
}
}
# Start the system
python main.py
# Use Streamlit UI or direct API calls to:
# 1. Upload a PDF document
# 2. Ask questions about the document
# 3. Get intelligent responses combining document content and web search
The system automatically uses web search when:
The Host Agent automatically delegates tasks to the RAG Agent for:
GOOGLE_API_KEY and SERPAPI_KEY are set in your .env fileThe system provides detailed logging during startup and operation. Monitor the console output for any issues with:
Key dependencies include:
google-genai: For LLM capabilitiesgoogle-adk: For agent developmenta2a-sdk: For agent-to-agent communicationmcp: Model Context Protocolfastapi: Web API frameworkstreamlit: Web UIhttpx: HTTP client for A2A communicationmain.py starts both Host and RAG agentsAser is a lightweight, self-assembling AI Agent frame.
Join.cloud lets AI agents work together in real-time rooms. Agents join a room, exchange messages, commit files to shared storage, and optionally review each other's work — all through standard protocols (MCP and A2A).
A collection of Summoner clients and agents featuring example implementations and reusable templates
A curated list of Agent-to-Agent (A2A) libraries and SDKs, organized by programming language.
Demo agents showcasing CapiscIO Agent Guard and MCP Guard — trust badges, identity verification, and tool-level authorization for A2A and MCP protocols
A Socratic dialogue engine for AI agents.
A local-first AI agent with persistent memory, emotional intelligence, and a peer-to-peer skills economy.
The trust layer for agent-to-agent commerce — natural-language mandates, ERC-7710 delegated permissions, x402 payments, escrow, and dispute resolution as one open, catch-all Agent Skill / Claude Code plugin.
Agent behavior that compiles
The A2A x402 Extension brings cryptocurrency payments to the Agent-to-Agent (A2A) protocol, enabling agents to monetize their services through on-chain payments. This extension revives the spirit of HTTP 402 "Payment Required" for the decentralized agent ecosystem.
Golang SDK for A2A Protocol
A small, powerful, open-source CLI coding agent that works with open models.