Home - themanojdesai/python-a2a GitHub Wiki

Python A2A: Agent-to-Agent Protocol Library

Building interoperable AI agent ecosystems through protocol standardization

Python A2A is a comprehensive implementation of Google's Agent-to-Agent (A2A) protocol with Model Context Protocol (MCP) integration, enabling developers to build sophisticated multi-agent systems that can collaborate to solve complex problems while maintaining compatibility with the broader AI agent ecosystem.

Key Features

  • 🌐 Complete A2A Protocol Implementation: Full compliance with Google's A2A specification
  • 🔌 First-class MCP Support: Native integration with Model Context Protocol
  • 🔄 Bidirectional LangChain Integration: Seamless interoperability with LangChain ecosystem
  • 🌊 Advanced Streaming: Real-time response streaming with error recovery
  • 🔍 Agent Discovery: Built-in registry and discovery mechanisms
  • 🔄 Workflow Engine: Orchestrate complex agent interactions with conditional logic
  • 🚀 Framework Agnostic: Works with Flask, FastAPI, Django, or standalone
  • 🧩 LLM Provider Flexibility: Native support for OpenAI, Anthropic, AWS Bedrock
  • ⚠️ Production-Ready Error Handling: Comprehensive error handling for robustness

Why Python A2A?

  • Standardization: Implement the official A2A specification for future-proof agent systems
  • Interoperability: Connect seamlessly with different agent ecosystems
  • Flexibility: Support for various LLM providers and Python frameworks
  • Modularity: Compose agents with specialized capabilities into complex systems
  • Developer Experience: Comprehensive documentation and working examples
  • Enterprise Ready: Production-quality implementation with robust error handling

Getting Started

To install the library:

pip install python-a2a  # Basic installation
pip install "python-a2a[all]"  # All features

For more installation options, see the Installation Guide.

Quick Example: Creating an A2A Agent

from python_a2a import A2AServer, skill, agent, run_server

@agent(
    name="Weather Agent",
    description="Provides weather information"
)
class WeatherAgent(A2AServer):
    
    @skill(
        name="Get Weather",
        description="Get current weather for a location"
    )
    def get_weather(self, location):
        return f"It's sunny and 75°F in {location}"
    
    def handle_task(self, task):
        return {"output": self.get_weather(task.input)}

# Run the server
agent = WeatherAgent()
run_server(agent, port=5000)

Quick Example: Connecting to an Agent

from python_a2a import HTTPClient

client = HTTPClient("http://localhost:5000")
response = client.send_message("What's the weather in New York?")
print(response.content)

For more examples, see the Examples Guide.

Documentation Structure

Use Cases

  • Research Assistants: Network of specialized knowledge agents
  • Enterprise Systems: AI orchestration across departments
  • Customer Service: Multi-step assistants with specialized capabilities
  • Education: Agent collaboration for learning environments
  • Development: Rapid prototyping of AI-powered systems

License

This project is licensed under the MIT License - see the LICENSE file for details.