A2a client

From OrcaQubits/agentic-commerce-skills-plugins · View interactive version

A2a client is an AI agent skill from the GitHub repository OrcaQubits/agentic-commerce-skills-plugins. Build an A2A client — the agent-side code that discovers other agents, sends tasks, handles responses, and manages multi-turn conversations. Use when implementing the client side that delegates work to A2A agents.

How to use this skill

Skill file

A2A Client Implementation

Before writing code

Fetch live docs:

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

Conceptual Architecture

What an A2A Client Does

An A2A client is the requesting side that:

  1. Discovers agents via Agent Cards (fetch /.well-known/agent-card.json)
  2. Sends messages to create or continue tasks
  3. Handles synchronous responses or SSE streams
  4. Manages multi-turn conversations (handles input-required states)
  5. Optionally configures push notifications for long-running tasks

Client Workflow

1. Discover agent → Fetch Agent Card
2. Check capabilities → Verify the agent can handle the task
3. Authenticate → Satisfy the agent's auth requirements
4. Send message → POST JSON-RPC to agent URL
5. Handle response → Process task result or continue conversation
6. Monitor → Poll, stream, or receive push notifications

Discovery

Before sending requests, the client must discover the target agent:

Sending Messages

Two modes:

Client Message Structure

{
  "jsonrpc": "2.0",
  "method": "message/send",
  "id": "request-id",
  "params": {
    "message": {
      "role": "user",
      "parts": [
        { "kind": "text", "text": "Your task description" }
      ]
    },
    "configuration": {
      "acceptedOutputModes": ["text/plain", "application/json"]
    }
  }
}

For continuing a task, include taskId in params.

Handling Responses

The client must handle different task states:

Orchestration Patterns

Sequential delegation: Client sends tasks to agents one at a time, using results from one as input to the next.

Parallel delegation: Client sends tasks to multiple agents concurrently, aggregates results.

Conditional routing: Client reads Agent Cards to decide which agent handles each subtask based on skills.

Fallback: Client tries one agent, falls back to another if the first fails or rejects.

Best Practices

Fetch the SDK documentation for exact client class names, constructor parameters, request builders, and response types before implementing.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.