{"id":1890,"library":"a2a-sdk","title":"A2A Python SDK","description":"The A2A Python SDK is an official library for building agentic applications that comply with the Agent2Agent (A2A) Protocol. It provides foundational building blocks for creating A2A servers and clients, supporting features like multi-turn conversations and streaming responses. The library is actively maintained with regular updates, and the 0.3 version of the protocol is intended to remain stable for a significant period with backward compatibility for SDKs starting at version 0.3. [1, 3, 12, 17, 19]","status":"active","version":"0.3.26","language":"en","source_language":"en","source_url":"https://github.com/a2aproject/a2a-python","tags":["AI agents","protocol","agent-to-agent","SDK","agentic applications","interoperability"],"install":[{"cmd":"pip install a2a-sdk","lang":"bash","label":"Install core SDK"}],"dependencies":[{"reason":"Requires Python 3.10 or newer.","package":"python","optional":false},{"reason":"Commonly used for building A2A servers with HTTP/JSON-RPC, often included in SDK server implementations.","package":"FastAPI","optional":true},{"reason":"Used for data validation and serialization within the SDK, especially with FastAPI.","package":"Pydantic","optional":true}],"imports":[{"note":"Main application class for an A2A server.","symbol":"AgentApp","correct":"from a2a.server.app import AgentApp"},{"note":"Abstract base class for implementing agent logic.","symbol":"AgentExecutor","correct":"from a2a.server.sdk import AgentExecutor"},{"note":"Defines an agent's capabilities and metadata.","symbol":"AgentCard","correct":"from a2a.server.sdk import AgentCard"}],"quickstart":{"code":"import os\nfrom a2a.server.app import AgentApp\nfrom a2a.server.sdk import AgentExecutor, AgentCard\nfrom a2a.server.types import AgentTask, TaskOutput, MessagePart\nfrom a2a.server.exceptions import AgentException\n\n\nclass EchoAgentExecutor(AgentExecutor):\n    \"\"\"A simple agent that echoes back the input message.\"\"\"\n\n    async def invoke(self, task: AgentTask) -> TaskOutput:\n        input_message = \"\"\n        # Extract text from the first message part\n        for part in task.input.parts:\n            if part.text:\n                input_message += part.text.text\n                break # Only process the first text part for simplicity\n        \n        if not input_message:\n            raise AgentException(\"No text message received.\")\n\n        response_parts = [MessagePart(text=f\"Echo: {input_message}\")]\n        return TaskOutput(output=response_parts)\n\n\n# Define the agent's capabilities\nagent_card = AgentCard(\n    agent_id=\"echo-agent\",\n    display_name=\"Echo Agent\",\n    description=\"An agent that echoes back any message it receives.\",\n    skills=[{\"name\": \"echo\", \"description\": \"Echoes the input.\"}]\n)\n\n# Create the A2A application instance\napp = AgentApp(\n    agent_card=agent_card,\n    agent_executor=EchoAgentExecutor()\n)\n\n# To run this application (e.g., using uvicorn):\n# 1. Save the code above as `main.py`\n# 2. Run from your terminal: `uvicorn main:app --host 0.0.0.0 --port 8000`\n#    (Install uvicorn first: `pip install uvicorn`)","lang":"python","description":"This quickstart demonstrates how to create a basic 'Echo' A2A agent. It defines an `AgentExecutor` to handle incoming tasks, an `AgentCard` to describe the agent's capabilities, and then initializes an `AgentApp`. The example code shows how to process a simple text message and return an echoed response. To run this, you would typically use a ASGI server like Uvicorn. [21, 9]"},"warnings":[{"fix":"Review the A2A 1.0 specification and official migration guides when upgrading to ensure compatibility with new proto-based types and API changes.","message":"The SDK is being upgraded to align with the A2A 1.0 protocol specification, introducing proto-based types. This will likely involve significant changes to existing classes and data structures. [10]","severity":"breaking","affected_versions":"Transitioning from 0.3.x to 1.0.x (alpha releases from March 2026)."},{"fix":"Update all code accessing SDK object fields to use `snake_case` instead of `camelCase` or other conventions.","message":"Class fields within the SDK are being refactored to be more Pythonic, adopting `snake_case` conventions. This affects how properties and fields are accessed. [12]","severity":"breaking","affected_versions":"0.3.x (roadmap states this is part of 0.3 release, though specifics depend on minor versions)."},{"fix":"Ensure your A2A servers correctly serve the Agent Card at the new `/.well-known/agent-card.json` endpoint.","message":"The standard path for hosting Agent Cards has been updated from `/.well-known/agent.json` to `/.well-known/agent-card.json` based on IANA feedback. [12]","severity":"breaking","affected_versions":"0.3.x (roadmap states this is part of 0.3 release, though specifics depend on minor versions)."},{"fix":"Design your agent's core logic to be framework-agnostic, separating business rules from A2A protocol handling. Use a clean architectural pattern (e.g., hexagonal architecture) to prevent protocol knowledge from leaking into your agent's core components.","message":"The SDK's `AgentExecutor` signature and `DefaultRequestHandler` often lead to agent logic being tightly coupled to A2A protocol details (e.g., `Task`, `TaskOutput`, `MessagePart`). This can hinder testability, reusability, and readability of core agent intelligence. [15, 16]","severity":"gotcha","affected_versions":"All versions up to 0.3.x."},{"fix":"Implement robust authentication and authorization for Agent Card endpoints. Prefer dynamic credentials obtained out-of-band over static secrets in the card.","message":"If an `AgentCard` contains sensitive information, the endpoint serving it *must* be protected by appropriate access controls (e.g., mTLS, network restrictions, authentication). It is generally *not recommended* to include plaintext secrets (like static API keys) directly in an `AgentCard`. [20]","severity":"gotcha","affected_versions":"All versions."}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}