How themanojdesai/python-a2a works
Project Type and Purpose
• Python A2A is an open-source Python library implementing Google’s Agent-to-Agent (A2A) protocol with Model Context Protocol (MCP) integration, plus CLI tools, discovery registry, workflow engine, LangChain bridges, and a visual UI for building agent networks.
• It’s not a monolithic web app but a modular SDK + microservice-style framework. It can be embedded in Python apps, run as standalone servers, or orchestrated via CLI/UI.
Key Architectural Components (nine modules from README & file tree)
A. Models
• Data classes for messages, tasks, agent cards (python_a2a/models).
B. Client
• HTTP/streaming clients for talking to A2A servers, building agent networks, routing (python_a2a/client + StreamingClient + A2AClient).
C. Server
• Base A2A servers that expose skills as REST/SSE endpoints (python_a2a/server, A2AServer, HTTP handlers, LLM providers).
D. Discovery
• Agent registry and discovery microservice (python_a2a/discovery, AgentRegistry, DiscoveryClient).
E. MCP
• MCP server/client tool framework for tool-using agents (python_a2a/mcp).
F. LangChain Integration
• Bridges to convert between LangChain tools/agents and A2A/MCP servers (python_a2a/langchain).
G. Workflow Engine
• Fluent API to orchestrate multi-agent workflows with branching/parallelism (python_a2a/workflow, python_a2a/agent_flow/engine).
H. Agent Flow UI
• Frontend (JS/CSS) + backend for visual workflow editor (python_a2a/agent_flow/server + static assets).
I. CLI
• Command-line entry points for sending messages, launching servers, running workflows, and starting UI (python_a2a/cli.py, start_ui.py).
Relationships & Interactions
• Clients → call → Servers (HTTP/SSE).
• Servers ↔ Discovery Registry (register and query capabilities).
• Servers → invoke → MCP tools (if configured).
• Workflow Engine & Agent Network orchestrate calls to multiple servers.
• CLI & UI → use → Client modules / Workflow Engine to drive interactions.
• LangChain bridges can sit between Client/Server and LangChain pipelines.
• All components share common Models and Utils.
Architectural Patterns
• Modular design: each major feature is a subpackage.
• Microservice style: servers (A2A, MCP, registry) communicate over REST/SSE.
• pluggable protocol layers: A2A core, MCP, LangChain.
• MVC for UI: backend API + static frontend.