[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6C5D9WHCX7TTE11WRBWNQ1E":3,"skill-same:01M6C5D9WHCX7TTE11WRBWNQ1E":74},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":35,"linkOnly":36,"markdownContent":37,"markdownBody":38,"frontMatter":39,"refName":41,"commitSha":42,"skillDirectory":43,"forksCount":14,"repositoryHtmlUrl":44,"repositoryHomepageUrl":6,"ownerHtmlUrl":45,"ownerBlogUrl":46,"ownerDescription":6,"updatedAt":47,"install":48,"resources":61},"01M6C5D9WHCX7TTE11WRBWNQ1E","a2a-protocol",null,"Comprehensive guide and utilities for building AI agents using the Agent2Agent (A2A) Protocol. Use when implementing agent-to-agent communication, creating A2A servers\u002Fclients, or working with JSON-RPC based agent systems.","CoralShades\u002Facm-ai","CoralShades","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F220297585?v=4","01M6C5211QSJHZ8HXSDDWCR507","Coral Shades AI Agency","01M6C52161FNQDRQ0FRR8DAA9D",0,"MIT","https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fa2a-protocol\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34],"a2a","a2a protocol","protocol","ai agents","communication","rpc","server","json","guide","use","agent communication","2026-11-10 10:12:30",false,"---\nname: a2a-protocol\ndescription: Comprehensive guide and utilities for building AI agents using the Agent2Agent (A2A) Protocol. Use when implementing agent-to-agent communication, creating A2A servers\u002Fclients, or working with JSON-RPC based agent systems.\nargument-hint: \"[agent-type: server|client]\"\n---\n\n# A2A Protocol Implementation Guide\n\nThis skill provides comprehensive knowledge for building, deploying, and interacting with agents using the **Agent2Agent (A2A) Protocol v0.3.0**.\n\n> **Reference**: https:\u002F\u002Fa2a-protocol.org\u002Flatest\u002Fdefinitions\u002F\n\n---\n\n## Protocol Overview\n\nA2A is a standard protocol enabling AI agents to communicate and collaborate. It operates across three layers:\n\n| Layer | Description |\n|-------|-------------|\n| **Data Model** | Core structures (Task, Message, AgentCard, Part, Artifact) |\n| **Abstract Operations** | Protocol-agnostic capabilities (SendMessage, GetTask, etc.) |\n| **Protocol Bindings** | Concrete implementations (JSON-RPC 2.0, gRPC, HTTP\u002FREST) |\n\n---\n\n## Core Data Structures\n\n### 1. AgentCard\n\nSelf-describing manifest hosted at `\u002F.well-known\u002Fagent-card.json`:\n\n```json\n{\n  \"name\": \"my_agent\",\n  \"description\": \"Agent description\",\n  \"url\": \"http:\u002F\u002Flocalhost:8080\u002F\",\n  \"version\": \"1.0.0\",\n  \"protocolVersion\": \"0.3.0\",\n  \"defaultInputModes\": [\"text\"],\n  \"defaultOutputModes\": [\"text\"],\n  \"capabilities\": {\n    \"streaming\": true,\n    \"pushNotifications\": false,\n    \"extendedAgentCard\": false\n  },\n  \"skills\": [\n    {\n      \"id\": \"skill_id\",\n      \"name\": \"Skill Name\",\n      \"description\": \"What this skill does\",\n      \"examples\": [\"Example query 1\", \"Example query 2\"],\n      \"tags\": []\n    }\n  ],\n  \"securitySchemes\": {},\n  \"security\": []\n}\n```\n\n### 2. Task\n\nThe core unit of work with lifecycle management:\n\n```json\n{\n  \"id\": \"task_123\",\n  \"contextId\": \"context_456\",\n  \"status\": {\n    \"state\": \"working\",\n    \"timestamp\": \"2024-01-01T00:00:00Z\"\n  },\n  \"artifacts\": [],\n  \"history\": [],\n  \"metadata\": {}\n}\n```\n\n**Task States:**\n\n| State | Description |\n|-------|-------------|\n| `submitted` | Task received, not yet processing |\n| `working` | Active processing |\n| `input-required` | Awaiting client response |\n| `auth-required` | Awaiting authentication |\n| `completed` | Successfully finished |\n| `failed` | Terminated with error |\n| `cancelled` | Client-requested cancellation |\n| `rejected` | Agent refused processing |\n\n### 3. Message\n\nCommunication unit between client and server:\n\n```json\n{\n  \"messageId\": \"msg_789\",\n  \"role\": \"user\",\n  \"parts\": [\n    {\n      \"type\": \"text\",\n      \"text\": \"Hello, agent!\"\n    }\n  ],\n  \"contextId\": \"context_456\",\n  \"taskId\": \"task_123\",\n  \"metadata\": {}\n}\n```\n\n**Roles:** `user` | `agent`\n\n### 4. Part\n\nContent container supporting multiple types:\n\n| Type | Structure | Description |\n|------|-----------|-------------|\n| **Text** | `{\"type\": \"text\", \"text\": \"...\"}` | Plain text, markdown, HTML |\n| **File** | `{\"type\": \"file\", \"uri\": \"...\", \"mimeType\": \"...\"}` | File reference |\n| **Data** | `{\"type\": \"data\", \"data\": {...}}` | Structured JSON |\n\n### 5. Artifact\n\nTask output representation:\n\n```json\n{\n  \"id\": \"artifact_001\",\n  \"name\": \"Result\",\n  \"description\": \"Calculation result\",\n  \"parts\": [\n    {\"type\": \"text\", \"text\": \"42\"}\n  ],\n  \"metadata\": {}\n}\n```\n\n---\n\n## JSON-RPC 2.0 Operations\n\n### Method List\n\n| Method | Description |\n|--------|-------------|\n| `message\u002Fsend` | Send message, returns Task or Message |\n| `message\u002Fstream` | Streaming variant with SSE |\n| `tasks\u002Fget` | Retrieve task state by ID |\n| `tasks\u002Flist` | List tasks with filtering\u002Fpagination |\n| `tasks\u002Fcancel` | Cancel an active task |\n| `tasks\u002Fsubscribe` | Stream updates for existing task |\n| `tasks\u002FpushNotificationConfig\u002Fcreate` | Create webhook config |\n| `tasks\u002FpushNotificationConfig\u002Fget` | Get webhook config |\n| `tasks\u002FpushNotificationConfig\u002Flist` | List webhook configs |\n| `tasks\u002FpushNotificationConfig\u002Fdelete` | Delete webhook config |\n| `agent\u002FgetExtendedCard` | Get authenticated agent card |\n\n### Request Format\n\n```json\n{\n  \"jsonrpc\": \"2.0\",\n  \"id\": \"request_id\",\n  \"method\": \"message\u002Fsend\",\n  \"params\": {\n    \"message\": {\n      \"role\": \"user\",\n      \"parts\": [{\"type\": \"text\", \"text\": \"Hello\"}],\n      \"messageId\": \"msg_001\"\n    }\n  }\n}\n```\n\n### Response Format\n\n**Success:**\n```json\n{\n  \"jsonrpc\": \"2.0\",\n  \"id\": \"request_id\",\n  \"result\": {\n    \"task\": { ... }\n  }\n}\n```\n\n**Error:**\n```json\n{\n  \"jsonrpc\": \"2.0\",\n  \"id\": \"request_id\",\n  \"error\": {\n    \"code\": -32000,\n    \"message\": \"Task not found\",\n    \"data\": { \"taskId\": \"invalid_id\" }\n  }\n}\n```\n\n### Error Codes\n\n| Code | Name | Description |\n|------|------|-------------|\n| `-32700` | Parse Error | Invalid JSON |\n| `-32600` | Invalid Request | Invalid JSON-RPC structure |\n| `-32601` | Method Not Found | Unknown method |\n| `-32602` | Invalid Params | Invalid method parameters |\n| `-32603` | Internal Error | Server error |\n| `-32000` | TaskNotFoundError | Task does not exist |\n| `-32001` | PushNotificationNotSupportedError | Webhooks not supported |\n| `-32002` | UnsupportedOperationError | Feature not available |\n| `-32003` | ContentTypeNotSupportedError | Unsupported media type |\n| `-32004` | VersionNotSupportedError | Protocol version mismatch |\n\n---\n\n## Streaming (Server-Sent Events)\n\n### Stream Response Format\n\n```\nevent: message\ndata: {\"task\": {...}}\n\nevent: message\ndata: {\"statusUpdate\": {\"taskId\": \"...\", \"state\": \"working\"}}\n\nevent: message\ndata: {\"artifactUpdate\": {\"taskId\": \"...\", \"artifact\": {...}}}\n\nevent: done\ndata: {\"status\": \"complete\"}\n```\n\n### Event Types\n\n| Event | Description |\n|-------|-------------|\n| `task` | Initial task state |\n| `message` | Direct response message |\n| `statusUpdate` | Task state change |\n| `artifactUpdate` | New or updated artifact |\n\n**Ordering Guarantee:** Events MUST be delivered in generation order.\n\n---\n\n## Security Schemes\n\n### Supported Authentication\n\n| Scheme | Description |\n|--------|-------------|\n| **API Key** | Header, query, or cookie |\n| **HTTP Auth** | Bearer, Basic, Digest |\n| **OAuth 2.0** | Authorization Code, Client Credentials, Device Code |\n| **OpenID Connect** | Identity layer on OAuth 2.0 |\n| **Mutual TLS** | Certificate-based auth |\n\n### Example Security Declaration\n\n```json\n{\n  \"securitySchemes\": {\n    \"apiKey\": {\n      \"type\": \"apiKey\",\n      \"in\": \"header\",\n      \"name\": \"X-API-Key\"\n    },\n    \"oauth2\": {\n      \"type\": \"oauth2\",\n      \"flows\": {\n        \"clientCredentials\": {\n          \"tokenUrl\": \"https:\u002F\u002Fauth.example.com\u002Ftoken\",\n          \"scopes\": {\n            \"agent:read\": \"Read agent data\",\n            \"agent:write\": \"Execute tasks\"\n          }\n        }\n      }\n    }\n  },\n  \"security\": [{\"apiKey\": []}, {\"oauth2\": [\"agent:read\"]}]\n}\n```\n\n---\n\n## Implementation Guide\n\n### Dependencies\n\n```bash\npip install a2a-sdk uvicorn python-dotenv\n```\n\n### Server Implementation (3-File Pattern)\n\n#### 1. agent.py - Agent Definition\n\n```python\nfrom a2a.types import AgentCapabilities, AgentSkill, AgentCard, ContentTypes\n\ndef create_agent_card(url: str) -> AgentCard:\n    return AgentCard(\n        name=\"my_agent\",\n        description=\"Agent description\",\n        url=url,\n        version=\"1.0.0\",\n        protocolVersion=\"0.3.0\",\n        defaultInputModes=[ContentTypes.TEXT],\n        defaultOutputModes=[ContentTypes.TEXT],\n        capabilities=AgentCapabilities(\n            streaming=True,\n            pushNotifications=False,\n        ),\n        skills=[\n            AgentSkill(\n                id=\"main_skill\",\n                name=\"Main Skill\",\n                description=\"What this agent does\",\n                examples=[\"Example query\"],\n                tags=[\"category\"],\n            )\n        ],\n    )\n```\n\n#### 2. agent_executor.py - Business Logic\n\n```python\nfrom a2a.server.agent_execution import AgentExecutor, RequestContext\nfrom a2a.server.events import EventQueue\nfrom a2a.types import Part, TextPart, Task, TaskState, TaskStatus\nfrom a2a.utils import completed_task, new_artifact, working_task\n\nclass MyAgentExecutor(AgentExecutor):\n    async def execute(\n        self,\n        context: RequestContext,\n        event_queue: EventQueue\n    ) -> None:\n        user_input = context.get_user_input()\n\n        # Signal working state (optional, for long tasks)\n        await event_queue.enqueue_event(\n            working_task(context.task_id, context.context_id)\n        )\n\n        # --- YOUR AGENT LOGIC HERE ---\n        result = await self.process(user_input)\n        # ------------------------------\n\n        # Create response parts\n        parts = [Part(root=TextPart(text=result))]\n\n        # Complete task with artifact\n        await event_queue.enqueue_event(\n            completed_task(\n                context.task_id,\n                context.context_id,\n                artifacts=[new_artifact(parts, f\"result_{context.task_id}\")],\n                history=[context.message],\n            )\n        )\n\n    async def cancel(\n        self,\n        context: RequestContext,\n        event_queue: EventQueue\n    ) -> Task | None:\n        # Handle cancellation request\n        return None\n\n    async def process(self, input_text: str) -> str:\n        # Implement your logic\n        return f\"Processed: {input_text}\"\n```\n\n#### 3. __main__.py - Server Entry Point\n\n```python\nimport uvicorn\nfrom a2a.server.request_handlers import DefaultRequestHandler\nfrom a2a.server.apps import A2AStarletteApplication\nfrom a2a.server.tasks import InMemoryTaskStore\nfrom .agent import create_agent_card\nfrom .agent_executor import MyAgentExecutor\n\ndef main():\n    host = \"0.0.0.0\"\n    port = 8080\n    url = f\"http:\u002F\u002F{host}:{port}\u002F\"\n\n    agent_card = create_agent_card(url)\n\n    handler = DefaultRequestHandler(\n        agent_executor=MyAgentExecutor(),\n        task_store=InMemoryTaskStore(),\n    )\n\n    app = A2AStarletteApplication(\n        agent_card=agent_card,\n        http_handler=handler,\n    )\n\n    print(f\"A2A Agent running at {url}\")\n    print(f\"Agent Card: {url}.well-known\u002Fagent-card.json\")\n\n    uvicorn.run(app.build(), host=host, port=port)\n\nif __name__ == \"__main__\":\n    main()\n```\n\n### Client Implementation\n\n```python\nimport httpx\nfrom a2a.client import A2ACardResolver, A2AClient\nfrom a2a.types import (\n    SendMessageRequest,\n    MessageSendParams,\n    Message,\n    Part,\n    TextPart,\n)\n\nasync def call_agent(agent_url: str, query: str):\n    async with httpx.AsyncClient(timeout=60.0) as http:\n        # 1. Discover agent\n        resolver = A2ACardResolver(\n            base_url=agent_url,\n            httpx_client=http\n        )\n        card = await resolver.get_agent_card()\n        print(f\"Connected to: {card.name} v{card.version}\")\n\n        # 2. Create client\n        client = A2AClient(http, card, url=agent_url)\n\n        # 3. Build message\n        message = Message(\n            role=\"user\",\n            parts=[Part(root=TextPart(text=query))],\n        )\n\n        # 4. Send request\n        request = SendMessageRequest(\n            params=MessageSendParams(message=message)\n        )\n\n        response = await client.send_message(request)\n        return response\n\n# Streaming client\nasync def call_agent_streaming(agent_url: str, query: str):\n    async with httpx.AsyncClient(timeout=None) as http:\n        resolver = A2ACardResolver(base_url=agent_url, httpx_client=http)\n        card = await resolver.get_agent_card()\n        client = A2AClient(http, card, url=agent_url)\n\n        message = Message(\n            role=\"user\",\n            parts=[Part(root=TextPart(text=query))],\n        )\n        request = SendMessageRequest(\n            params=MessageSendParams(message=message)\n        )\n\n        async for event in client.send_message_streaming(request):\n            if hasattr(event, 'task'):\n                print(f\"Task: {event.task.status.state}\")\n            elif hasattr(event, 'artifact'):\n                print(f\"Artifact: {event.artifact}\")\n```\n\n---\n\n## Best Practices\n\n### 1. Agent Discovery\nAlways fetch `AgentCard` before interaction to adapt to capability changes.\n\n### 2. Streaming\nUse SSE for long-running tasks to provide real-time updates.\n\n### 3. Artifacts vs Messages\n- **Artifacts**: Final deliverables (files, structured data)\n- **Messages**: Conversational updates, status information\n\n### 4. Error Handling\n```python\ntry:\n    response = await client.send_message(request)\nexcept A2AError as e:\n    if e.code == -32000:\n        print(\"Task not found\")\n    elif e.code == -32602:\n        print(\"Invalid parameters\")\n```\n\n### 5. Pagination\n```python\n# List tasks with pagination\nparams = TaskQueryParams(\n    contextId=\"ctx_123\",\n    status=[\"completed\", \"failed\"],\n    pageSize=50,\n    pageToken=None,  # For first page\n)\nresponse = await client.list_tasks(params)\nnext_page_token = response.nextPageToken\n```\n\n### 6. Push Notifications\n```python\n# Configure webhook for async updates\nconfig = PushNotificationConfig(\n    url=\"https:\u002F\u002Fmyserver.com\u002Fwebhook\",\n    authentication={\n        \"type\": \"bearer\",\n        \"token\": \"secret_token\"\n    }\n)\nawait client.create_push_notification_config(task_id, config)\n```\n\n---\n\n## Quick Reference\n\n### Endpoints\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `\u002F.well-known\u002Fagent-card.json` | GET | Public agent card |\n| `\u002F` | POST | JSON-RPC endpoint |\n\n### Headers\n\n| Header | Description |\n|--------|-------------|\n| `Content-Type` | `application\u002Fjson` |\n| `Accept` | `application\u002Fjson` or `text\u002Fevent-stream` |\n| `A2A-Version` | Protocol version (e.g., `0.3.0`) |\n\n### SDK Utilities\n\n```python\nfrom a2a.utils import (\n    completed_task,    # Create completed task event\n    failed_task,       # Create failed task event\n    working_task,      # Create working status event\n    input_required,    # Request user input\n    new_artifact,      # Create new artifact\n    new_message,       # Create new message\n)\n```\n\n---\n\n## References\n\n- **Official Spec**: https:\u002F\u002Fa2a-protocol.org\u002Flatest\u002Fspecification\u002F\n- **Definitions**: https:\u002F\u002Fa2a-protocol.org\u002Flatest\u002Fdefinitions\u002F\n- **Python SDK**: https:\u002F\u002Fpypi.org\u002Fproject\u002Fa2a-sdk\u002F\n- **GitHub**: https:\u002F\u002Fgithub.com\u002Fa2a-protocol\u002Fa2a-python\n","# A2A Protocol Implementation Guide\n\nThis skill provides comprehensive knowledge for building, deploying, and interacting with agents using the **Agent2Agent (A2A) Protocol v0.3.0**.\n\n> **Reference**: https:\u002F\u002Fa2a-protocol.org\u002Flatest\u002Fdefinitions\u002F\n\n---\n\n## Protocol Overview\n\nA2A is a standard protocol enabling AI agents to communicate and collaborate. It operates across three layers:\n\n| Layer | Description |\n|-------|-------------|\n| **Data Model** | Core structures (Task, Message, AgentCard, Part, Artifact) |\n| **Abstract Operations** | Protocol-agnostic capabilities (SendMessage, GetTask, etc.) |\n| **Protocol Bindings** | Concrete implementations (JSON-RPC 2.0, gRPC, HTTP\u002FREST) |\n\n---\n\n## Core Data Structures\n\n### 1. AgentCard\n\nSelf-describing manifest hosted at `\u002F.well-known\u002Fagent-card.json`:\n\n```json\n{\n  \"name\": \"my_agent\",\n  \"description\": \"Agent description\",\n  \"url\": \"http:\u002F\u002Flocalhost:8080\u002F\",\n  \"version\": \"1.0.0\",\n  \"protocolVersion\": \"0.3.0\",\n  \"defaultInputModes\": [\"text\"],\n  \"defaultOutputModes\": [\"text\"],\n  \"capabilities\": {\n    \"streaming\": true,\n    \"pushNotifications\": false,\n    \"extendedAgentCard\": false\n  },\n  \"skills\": [\n    {\n      \"id\": \"skill_id\",\n      \"name\": \"Skill Name\",\n      \"description\": \"What this skill does\",\n      \"examples\": [\"Example query 1\", \"Example query 2\"],\n      \"tags\": []\n    }\n  ],\n  \"securitySchemes\": {},\n  \"security\": []\n}\n```\n\n### 2. Task\n\nThe core unit of work with lifecycle management:\n\n```json\n{\n  \"id\": \"task_123\",\n  \"contextId\": \"context_456\",\n  \"status\": {\n    \"state\": \"working\",\n    \"timestamp\": \"2024-01-01T00:00:00Z\"\n  },\n  \"artifacts\": [],\n  \"history\": [],\n  \"metadata\": {}\n}\n```\n\n**Task States:**\n\n| State | Description |\n|-------|-------------|\n| `submitted` | Task received, not yet processing |\n| `working` | Active processing |\n| `input-required` | Awaiting client response |\n| `auth-required` | Awaiting authentication |\n| `completed` | Successfully finished |\n| `failed` | Terminated with error |\n| `cancelled` | Client-requested cancellation |\n| `rejected` | Agent refused processing |\n\n### 3. Message\n\nCommunication unit between client and server:\n\n```json\n{\n  \"messageId\": \"msg_789\",\n  \"role\": \"user\",\n  \"parts\": [\n    {\n      \"type\": \"text\",\n      \"text\": \"Hello, agent!\"\n    }\n  ],\n  \"contextId\": \"context_456\",\n  \"taskId\": \"task_123\",\n  \"metadata\": {}\n}\n```\n\n**Roles:** `user` | `agent`\n\n### 4. Part\n\nContent container supporting multiple types:\n\n| Type | Structure | Description |\n|------|-----------|-------------|\n| **Text** | `{\"type\": \"text\", \"text\": \"...\"}` | Plain text, markdown, HTML |\n| **File** | `{\"type\": \"file\", \"uri\": \"...\", \"mimeType\": \"...\"}` | File reference |\n| **Data** | `{\"type\": \"data\", \"data\": {...}}` | Structured JSON |\n\n### 5. Artifact\n\nTask output representation:\n\n```json\n{\n  \"id\": \"artifact_001\",\n  \"name\": \"Result\",\n  \"description\": \"Calculation result\",\n  \"parts\": [\n    {\"type\": \"text\", \"text\": \"42\"}\n  ],\n  \"metadata\": {}\n}\n```\n\n---\n\n## JSON-RPC 2.0 Operations\n\n### Method List\n\n| Method | Description |\n|--------|-------------|\n| `message\u002Fsend` | Send message, returns Task or Message |\n| `message\u002Fstream` | Streaming variant with SSE |\n| `tasks\u002Fget` | Retrieve task state by ID |\n| `tasks\u002Flist` | List tasks with filtering\u002Fpagination |\n| `tasks\u002Fcancel` | Cancel an active task |\n| `tasks\u002Fsubscribe` | Stream updates for existing task |\n| `tasks\u002FpushNotificationConfig\u002Fcreate` | Create webhook config |\n| `tasks\u002FpushNotificationConfig\u002Fget` | Get webhook config |\n| `tasks\u002FpushNotificationConfig\u002Flist` | List webhook configs |\n| `tasks\u002FpushNotificationConfig\u002Fdelete` | Delete webhook config |\n| `agent\u002FgetExtendedCard` | Get authenticated agent card |\n\n### Request Format\n\n```json\n{\n  \"jsonrpc\": \"2.0\",\n  \"id\": \"request_id\",\n  \"method\": \"message\u002Fsend\",\n  \"params\": {\n    \"message\": {\n      \"role\": \"user\",\n      \"parts\": [{\"type\": \"text\", \"text\": \"Hello\"}],\n      \"messageId\": \"msg_001\"\n    }\n  }\n}\n```\n\n### Response Format\n\n**Success:**\n```json\n{\n  \"jsonrpc\": \"2.0\",\n  \"id\": \"request_id\",\n  \"result\": {\n    \"task\": { ... }\n  }\n}\n```\n\n**Error:**\n```json\n{\n  \"jsonrpc\": \"2.0\",\n  \"id\": \"request_id\",\n  \"error\": {\n    \"code\": -32000,\n    \"message\": \"Task not found\",\n    \"data\": { \"taskId\": \"invalid_id\" }\n  }\n}\n```\n\n### Error Codes\n\n| Code | Name | Description |\n|------|------|-------------|\n| `-32700` | Parse Error | Invalid JSON |\n| `-32600` | Invalid Request | Invalid JSON-RPC structure |\n| `-32601` | Method Not Found | Unknown method |\n| `-32602` | Invalid Params | Invalid method parameters |\n| `-32603` | Internal Error | Server error |\n| `-32000` | TaskNotFoundError | Task does not exist |\n| `-32001` | PushNotificationNotSupportedError | Webhooks not supported |\n| `-32002` | UnsupportedOperationError | Feature not available |\n| `-32003` | ContentTypeNotSupportedError | Unsupported media type |\n| `-32004` | VersionNotSupportedError | Protocol version mismatch |\n\n---\n\n## Streaming (Server-Sent Events)\n\n### Stream Response Format\n\n```\nevent: message\ndata: {\"task\": {...}}\n\nevent: message\ndata: {\"statusUpdate\": {\"taskId\": \"...\", \"state\": \"working\"}}\n\nevent: message\ndata: {\"artifactUpdate\": {\"taskId\": \"...\", \"artifact\": {...}}}\n\nevent: done\ndata: {\"status\": \"complete\"}\n```\n\n### Event Types\n\n| Event | Description |\n|-------|-------------|\n| `task` | Initial task state |\n| `message` | Direct response message |\n| `statusUpdate` | Task state change |\n| `artifactUpdate` | New or updated artifact |\n\n**Ordering Guarantee:** Events MUST be delivered in generation order.\n\n---\n\n## Security Schemes\n\n### Supported Authentication\n\n| Scheme | Description |\n|--------|-------------|\n| **API Key** | Header, query, or cookie |\n| **HTTP Auth** | Bearer, Basic, Digest |\n| **OAuth 2.0** | Authorization Code, Client Credentials, Device Code |\n| **OpenID Connect** | Identity layer on OAuth 2.0 |\n| **Mutual TLS** | Certificate-based auth |\n\n### Example Security Declaration\n\n```json\n{\n  \"securitySchemes\": {\n    \"apiKey\": {\n      \"type\": \"apiKey\",\n      \"in\": \"header\",\n      \"name\": \"X-API-Key\"\n    },\n    \"oauth2\": {\n      \"type\": \"oauth2\",\n      \"flows\": {\n        \"clientCredentials\": {\n          \"tokenUrl\": \"https:\u002F\u002Fauth.example.com\u002Ftoken\",\n          \"scopes\": {\n            \"agent:read\": \"Read agent data\",\n            \"agent:write\": \"Execute tasks\"\n          }\n        }\n      }\n    }\n  },\n  \"security\": [{\"apiKey\": []}, {\"oauth2\": [\"agent:read\"]}]\n}\n```\n\n---\n\n## Implementation Guide\n\n### Dependencies\n\n```bash\npip install a2a-sdk uvicorn python-dotenv\n```\n\n### Server Implementation (3-File Pattern)\n\n#### 1. agent.py - Agent Definition\n\n```python\nfrom a2a.types import AgentCapabilities, AgentSkill, AgentCard, ContentTypes\n\ndef create_agent_card(url: str) -> AgentCard:\n    return AgentCard(\n        name=\"my_agent\",\n        description=\"Agent description\",\n        url=url,\n        version=\"1.0.0\",\n        protocolVersion=\"0.3.0\",\n        defaultInputModes=[ContentTypes.TEXT],\n        defaultOutputModes=[ContentTypes.TEXT],\n        capabilities=AgentCapabilities(\n            streaming=True,\n            pushNotifications=False,\n        ),\n        skills=[\n            AgentSkill(\n                id=\"main_skill\",\n                name=\"Main Skill\",\n                description=\"What this agent does\",\n                examples=[\"Example query\"],\n                tags=[\"category\"],\n            )\n        ],\n    )\n```\n\n#### 2. agent_executor.py - Business Logic\n\n```python\nfrom a2a.server.agent_execution import AgentExecutor, RequestContext\nfrom a2a.server.events import EventQueue\nfrom a2a.types import Part, TextPart, Task, TaskState, TaskStatus\nfrom a2a.utils import completed_task, new_artifact, working_task\n\nclass MyAgentExecutor(AgentExecutor):\n    async def execute(\n        self,\n        context: RequestContext,\n        event_queue: EventQueue\n    ) -> None:\n        user_input = context.get_user_input()\n\n        # Signal working state (optional, for long tasks)\n        await event_queue.enqueue_event(\n            working_task(context.task_id, context.context_id)\n        )\n\n        # --- YOUR AGENT LOGIC HERE ---\n        result = await self.process(user_input)\n        # ------------------------------\n\n        # Create response parts\n        parts = [Part(root=TextPart(text=result))]\n\n        # Complete task with artifact\n        await event_queue.enqueue_event(\n            completed_task(\n                context.task_id,\n                context.context_id,\n                artifacts=[new_artifact(parts, f\"result_{context.task_id}\")],\n                history=[context.message],\n            )\n        )\n\n    async def cancel(\n        self,\n        context: RequestContext,\n        event_queue: EventQueue\n    ) -> Task | None:\n        # Handle cancellation request\n        return None\n\n    async def process(self, input_text: str) -> str:\n        # Implement your logic\n        return f\"Processed: {input_text}\"\n```\n\n#### 3. __main__.py - Server Entry Point\n\n```python\nimport uvicorn\nfrom a2a.server.request_handlers import DefaultRequestHandler\nfrom a2a.server.apps import A2AStarletteApplication\nfrom a2a.server.tasks import InMemoryTaskStore\nfrom .agent import create_agent_card\nfrom .agent_executor import MyAgentExecutor\n\ndef main():\n    host = \"0.0.0.0\"\n    port = 8080\n    url = f\"http:\u002F\u002F{host}:{port}\u002F\"\n\n    agent_card = create_agent_card(url)\n\n    handler = DefaultRequestHandler(\n        agent_executor=MyAgentExecutor(),\n        task_store=InMemoryTaskStore(),\n    )\n\n    app = A2AStarletteApplication(\n        agent_card=agent_card,\n        http_handler=handler,\n    )\n\n    print(f\"A2A Agent running at {url}\")\n    print(f\"Agent Card: {url}.well-known\u002Fagent-card.json\")\n\n    uvicorn.run(app.build(), host=host, port=port)\n\nif __name__ == \"__main__\":\n    main()\n```\n\n### Client Implementation\n\n```python\nimport httpx\nfrom a2a.client import A2ACardResolver, A2AClient\nfrom a2a.types import (\n    SendMessageRequest,\n    MessageSendParams,\n    Message,\n    Part,\n    TextPart,\n)\n\nasync def call_agent(agent_url: str, query: str):\n    async with httpx.AsyncClient(timeout=60.0) as http:\n        # 1. Discover agent\n        resolver = A2ACardResolver(\n            base_url=agent_url,\n            httpx_client=http\n        )\n        card = await resolver.get_agent_card()\n        print(f\"Connected to: {card.name} v{card.version}\")\n\n        # 2. Create client\n        client = A2AClient(http, card, url=agent_url)\n\n        # 3. Build message\n        message = Message(\n            role=\"user\",\n            parts=[Part(root=TextPart(text=query))],\n        )\n\n        # 4. Send request\n        request = SendMessageRequest(\n            params=MessageSendParams(message=message)\n        )\n\n        response = await client.send_message(request)\n        return response\n\n# Streaming client\nasync def call_agent_streaming(agent_url: str, query: str):\n    async with httpx.AsyncClient(timeout=None) as http:\n        resolver = A2ACardResolver(base_url=agent_url, httpx_client=http)\n        card = await resolver.get_agent_card()\n        client = A2AClient(http, card, url=agent_url)\n\n        message = Message(\n            role=\"user\",\n            parts=[Part(root=TextPart(text=query))],\n        )\n        request = SendMessageRequest(\n            params=MessageSendParams(message=message)\n        )\n\n        async for event in client.send_message_streaming(request):\n            if hasattr(event, 'task'):\n                print(f\"Task: {event.task.status.state}\")\n            elif hasattr(event, 'artifact'):\n                print(f\"Artifact: {event.artifact}\")\n```\n\n---\n\n## Best Practices\n\n### 1. Agent Discovery\nAlways fetch `AgentCard` before interaction to adapt to capability changes.\n\n### 2. Streaming\nUse SSE for long-running tasks to provide real-time updates.\n\n### 3. Artifacts vs Messages\n- **Artifacts**: Final deliverables (files, structured data)\n- **Messages**: Conversational updates, status information\n\n### 4. Error Handling\n```python\ntry:\n    response = await client.send_message(request)\nexcept A2AError as e:\n    if e.code == -32000:\n        print(\"Task not found\")\n    elif e.code == -32602:\n        print(\"Invalid parameters\")\n```\n\n### 5. Pagination\n```python\n# List tasks with pagination\nparams = TaskQueryParams(\n    contextId=\"ctx_123\",\n    status=[\"completed\", \"failed\"],\n    pageSize=50,\n    pageToken=None,  # For first page\n)\nresponse = await client.list_tasks(params)\nnext_page_token = response.nextPageToken\n```\n\n### 6. Push Notifications\n```python\n# Configure webhook for async updates\nconfig = PushNotificationConfig(\n    url=\"https:\u002F\u002Fmyserver.com\u002Fwebhook\",\n    authentication={\n        \"type\": \"bearer\",\n        \"token\": \"secret_token\"\n    }\n)\nawait client.create_push_notification_config(task_id, config)\n```\n\n---\n\n## Quick Reference\n\n### Endpoints\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `\u002F.well-known\u002Fagent-card.json` | GET | Public agent card |\n| `\u002F` | POST | JSON-RPC endpoint |\n\n### Headers\n\n| Header | Description |\n|--------|-------------|\n| `Content-Type` | `application\u002Fjson` |\n| `Accept` | `application\u002Fjson` or `text\u002Fevent-stream` |\n| `A2A-Version` | Protocol version (e.g., `0.3.0`) |\n\n### SDK Utilities\n\n```python\nfrom a2a.utils import (\n    completed_task,    # Create completed task event\n    failed_task,       # Create failed task event\n    working_task,      # Create working status event\n    input_required,    # Request user input\n    new_artifact,      # Create new artifact\n    new_message,       # Create new message\n)\n```\n\n---\n\n## References\n\n- **Official Spec**: https:\u002F\u002Fa2a-protocol.org\u002Flatest\u002Fspecification\u002F\n- **Definitions**: https:\u002F\u002Fa2a-protocol.org\u002Flatest\u002Fdefinitions\u002F\n- **Python SDK**: https:\u002F\u002Fpypi.org\u002Fproject\u002Fa2a-sdk\u002F\n- **GitHub**: https:\u002F\u002Fgithub.com\u002Fa2a-protocol\u002Fa2a-python\n",{"name":5,"description":7,"argument-hint":40},"[agent-type: server|client]","main","1ca81b0a7de199942400f965edd4d7544077ac5d",".claude\u002Fskills\u002Fa2a-protocol","https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai","https:\u002F\u002Fgithub.com\u002FCoralShades","coralshades.com.au","2026-04-18 00:45:07",{"source":8,"skillName":5,"commands":49,"prompt":59,"zipAvailable":60},[50,53,56],{"tool":51,"command":52},"npx","npx skills add CoralShades\u002Facm-ai --skill a2a-protocol",{"tool":54,"command":55},"bunx","bunx skills add CoralShades\u002Facm-ai --skill a2a-protocol",{"tool":57,"command":58},"pnpm","pnpm dlx skills add CoralShades\u002Facm-ai --skill a2a-protocol","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fa2a-protocol\u002FSKILL.md",true,[62,68],{"path":63,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":66,"sourceHtmlUrl":67},"examples\u002Fsimple_calculator_agent.py","SCRIPT","脚本",3188,"https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fa2a-protocol\u002Fexamples\u002Fsimple_calculator_agent.py",{"path":69,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":73},"reference.md","REFERENCE","参考文档",10407,"https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fa2a-protocol\u002Freference.md",[75,96,109,125,147,157],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":84,"publishedAt":35},"01M6C63HKXA890HHV47WBAX0TB","uncodixfy","Prevents generic AI\u002FCodex UI patterns when generating frontend code. Use this skill whenever generating HTML, CSS, React, Vue, Svelte, or any frontend UI code to enforce clean, human-designed aesthetics inspired by Linear, Raycast, Stripe, and GitHub instead of typical AI-generated UI.","https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai\u002Fblob\u002Fmain\u002F.qwen\u002Fskills\u002Funcodixfy\u002FSKILL.md",[81],{"categoryNo":82,"categoryName":83,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发",[77,85,86,87,88,89,90,91,92,93,94,33,95],"github","frontend","css","codex","react","code","linear","ui","vue","generated","html",{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":100,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":35},"01M6C63FJ2GEBBGZ5XSMV40KXB","runpodctl","Runpod CLI to manage your GPU workloads.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai\u002Fblob\u002Fmain\u002F.qwen\u002Fskills\u002Frunpodctl\u002FSKILL.md",[],[98,104,105,106,107,108],"macos","cli","linux","gpu","Bash",{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":35},"01M6C63DPAV46TFVQ01SFYPJ7X","langgraph-persistence","INVOKE THIS SKILL when your LangGraph needs to persist state, remember conversations, travel through history, or configure subgraph checkpointer scoping. Covers checkpointers, thread_id, time travel, Store, and subgraph persistence modes.","https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai\u002Fblob\u002Fmain\u002F.qwen\u002Fskills\u002Flanggraph-persistence\u002FSKILL.md",[],[116,117,118,119,120,121,122,123,124],"langgraph persistence","langgraph","persistence","travel","history","scoping","remember","state","configure",{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":129,"categories":130,"keywords":136,"publishedAt":35},"01M6C63BNS9CQEBTB8RNSSBFPA","langgraph-human-in-the-loop","INVOKE THIS SKILL when implementing human-in-the-loop patterns, pausing for approval, or handling errors in LangGraph. Covers interrupt(), Command(resume=...), approval\u002Fvalidation workflows, and the 4-tier error handling strategy.","https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai\u002Fblob\u002Fmain\u002F.qwen\u002Fskills\u002Flanggraph-human-in-the-loop\u002FSKILL.md",[131],{"categoryNo":132,"categoryName":133,"taxonomyType":134,"taxonomyTypeDesc":135},"01JBSEEDCAT000000000000038","人力资源","PROFESSION","适用职业",[137,138,117,139,140,141,142,143,144,145,146],"langgraph human in the loop","loop","workflows","error handling","validation","human-in-the-loop","command","strategy","approval","resume",{"skillNo":148,"name":149,"nameZh":6,"description":150,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":151,"categories":152,"keywords":153,"publishedAt":35},"01M6C639GVYZFX3NFPV5FBDR4F","langgraph-fundamentals","INVOKE THIS SKILL when writing ANY LangGraph code. Covers StateGraph, state schemas, nodes, edges, Command, Send, invoke, streaming, and error handling.","https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai\u002Fblob\u002Fmain\u002F.qwen\u002Fskills\u002Flanggraph-fundamentals\u002FSKILL.md",[],[154,117,140,123,155,156,143,90],"langgraph fundamentals","streaming","writing",{"skillNo":158,"name":159,"nameZh":6,"description":160,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":161,"categories":162,"keywords":163,"publishedAt":35},"01M6C6375N34YX2GZ3SD3R7XR2","langchain-rag","INVOKE THIS SKILL when building ANY retrieval-augmented generation (RAG) system. Covers document loaders, RecursiveCharacterTextSplitter, embeddings (OpenAI), and vector stores (Chroma, FAISS, Pinecone).","https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai\u002Fblob\u002Fmain\u002F.qwen\u002Fskills\u002Flangchain-rag\u002FSKILL.md",[],[164,165,166,167,168,169,170,171,172,173],"rag","langchain rag","langchain","embeddings","vector","openai","chroma","faiss","vector stores","system"]