a2a-server

Build an A2A server — the agent-side endpoint that receives JSON-RPC requests, processes tasks, manages state, and returns results. Use when implementing the server side of an A2A agent.

17 stars

Best use case

a2a-server is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Build an A2A server — the agent-side endpoint that receives JSON-RPC requests, processes tasks, manages state, and returns results. Use when implementing the server side of an A2A agent.

Teams using a2a-server should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/a2a-server/SKILL.md --create-dirs "https://raw.githubusercontent.com/OrcaQubits/agentic-commerce-skills-plugins/main/a2a-multi-agent/skills/a2a-server/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/a2a-server/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How a2a-server Compares

Feature / Agenta2a-serverStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Build an A2A server — the agent-side endpoint that receives JSON-RPC requests, processes tasks, manages state, and returns results. Use when implementing the server side of an A2A agent.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# A2A Server Implementation

## Before writing code

**Fetch live docs**:
1. Fetch `https://a2a-protocol.org/latest/specification/` for the server-side protocol requirements
2. Web-search `site:github.com a2aproject a2a-python server` or `a2aproject a2a-js server` for SDK server classes
3. Web-search `site:github.com a2aproject a2a-samples server` for reference server implementations
4. Fetch the target SDK README for server setup patterns

## Conceptual Architecture

### What an A2A Server Does

An A2A server is the **agent's network endpoint** that:
1. Serves the Agent Card at `/.well-known/agent-card.json`
2. Accepts JSON-RPC 2.0 requests at the agent's URL
3. Routes requests to the appropriate method handler
4. Manages task state (creation, updates, terminal states)
5. Executes the agent's logic (the "brain" — typically an LLM or deterministic logic)
6. Returns responses in the correct JSON-RPC format

### Request Processing Flow

```
HTTP POST → JSON-RPC parse → Method routing → Handler execution → Task state update → JSON-RPC response
```

### Methods to Implement

Every A2A server must handle:

| Method | Required | Description |
|--------|----------|-------------|
| `message/send` | Yes | Receive a message, create/update task, return result |
| `message/stream` | If streaming | Same as send but returns SSE stream |
| `tasks/get` | Yes | Return task by ID |
| `tasks/cancel` | Yes | Cancel a task |
| `tasks/resubscribe` | If streaming | Re-subscribe to task's SSE stream |
| Push notification methods | If supported | Configure/manage push notification callbacks |

### Task State Management

The server is responsible for task state transitions:
- Create tasks in `submitted` state when receiving new messages
- Transition to `working` when processing begins
- Transition to `input-required` when more input is needed
- Transition to terminal state (`completed`, `failed`, `canceled`, `rejected`) when done
- Never transition from a terminal state to a non-terminal state

### Handler Pattern

The SDK typically provides a handler interface you implement:

```
class MyAgentHandler:
    async def handle_message(task_id, message) -> TaskResult:
        # Your agent logic here
        # 1. Parse the input message parts
        # 2. Process with LLM or business logic
        # 3. Return result with updated task state
```

### Server Components

1. **HTTP Server** — Handles HTTP requests (FastAPI, Express, built-in SDK server)
2. **JSON-RPC Router** — Parses JSON-RPC and routes to method handlers
3. **Task Store** — Persists task state (in-memory for dev, database for production)
4. **Agent Handler** — Your custom logic that processes tasks
5. **Agent Card Endpoint** — Serves the discovery document

### Task Storage

- **In-memory** — Dict/Map of task IDs to task objects (development only)
- **Redis** — Fast key-value storage for task state (good for single-region)
- **Database** — PostgreSQL, MongoDB, etc. (production, multi-region)
- **SDK built-in** — Some SDKs provide task store abstractions

### Concurrency

A2A servers must handle concurrent requests:
- Multiple tasks running simultaneously
- Same task receiving updates while processing
- Streaming responses held open while processing continues
- Proper locking/synchronization for task state updates

### Best Practices

- Use the SDK's built-in server utilities rather than implementing raw JSON-RPC
- Implement proper task state validation — reject invalid transitions
- Add request logging with task IDs for debugging
- Set reasonable timeouts for long-running tasks
- Handle graceful shutdown — complete or cancel in-flight tasks
- Return proper JSON-RPC errors for invalid requests
- Validate incoming messages against expected input modes
- Use async/await for I/O-bound operations (LLM calls, external APIs)

Fetch the SDK documentation for exact server class names, constructor parameters, middleware patterns, and handler interfaces before implementing.

Related Skills

mpp-server-middleware

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement MPP server-side middleware for Hono, Express, Next.js, and Elysia. Use when protecting API routes with HTTP 402 payment gates, configuring payment methods, or setting up the Mppx server instance.

nlweb-mcp-server

17
from OrcaQubits/agentic-commerce-skills-plugins

Expose NLWeb as an MCP (Model Context Protocol) server — JSON-RPC 2.0 endpoint at /mcp, the `ask` / `list_sites` / `who` tools, MCP protocol version 2024-11-05, and integration with ChatGPT, Claude, Gemini, and other agent clients. Use when wiring NLWeb to an AI agent via MCP or building an MCP client that consumes an NLWeb site.

ap2-mcp-server

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement AP2 MCP servers — payment tools exposed via Model Context Protocol for agent access to payment capabilities. Use when building MCP-based payment tool integrations for AP2.

woo-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Test WooCommerce extensions — PHPUnit unit/integration tests, WP test suite, WooCommerce test helpers, E2E with Playwright, and WP-CLI test scaffolding. Use when writing tests for WooCommerce plugins or setting up a test environment.

woo-shipping

17
from OrcaQubits/agentic-commerce-skills-plugins

Build WooCommerce shipping methods — WC_Shipping_Method, shipping zones, shipping classes, rate calculation, tracking, and integration with carriers. Use when creating custom shipping integrations or configuring shipping logic.

woo-setup

17
from OrcaQubits/agentic-commerce-skills-plugins

Install WooCommerce, configure the development stack, and set up a local dev environment with WP-CLI, Docker, or wp-env. Use when setting up a new WooCommerce project or development environment.

woo-security

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement WooCommerce security — nonces, capabilities, input sanitization, output escaping, data validation, PCI compliance considerations, and WordPress security best practices. Use when hardening a WooCommerce store or reviewing security posture.

woo-plugin-dev

17
from OrcaQubits/agentic-commerce-skills-plugins

Create WooCommerce extensions/plugins — file structure, main plugin file, activation/deactivation hooks, custom database tables, autoloading, and WordPress plugin API. Use when building new WooCommerce extensions or structuring plugin code.

woo-performance

17
from OrcaQubits/agentic-commerce-skills-plugins

Optimize WooCommerce performance — object caching, transients, HPOS, database optimization, Action Scheduler, lazy loading, and query optimization. Use when improving store performance or diagnosing slowness.

woo-payments

17
from OrcaQubits/agentic-commerce-skills-plugins

Build WooCommerce payment gateways — WC_Payment_Gateway, direct/redirect/hosted integrations, tokenization, subscriptions support, refunds, and PCI compliance. Use when creating custom payment method integrations.

woo-hooks-filters

17
from OrcaQubits/agentic-commerce-skills-plugins

Master the WordPress hook system for WooCommerce — actions, filters, hook priorities, WooCommerce-specific hooks, and extensibility patterns. Use when adding functionality via hooks or understanding the WooCommerce execution flow.

woo-frontend

17
from OrcaQubits/agentic-commerce-skills-plugins

Customize WooCommerce frontend — template overrides, theme integration, shortcodes, hooks for product/cart/checkout display, and WooCommerce block themes. Use when modifying the storefront appearance or building WooCommerce themes.