Skip to main content

LangGraph A2A Client

A2A (Agent-to-Agent) Protocol Client Tool for LangGraph.

Overview

This library provides functionality to discover and communicate with A2A-compliant agents in LangGraph applications.

Key Features

  • Agent discovery through agent cards from multiple URLs
  • Message sending to specific A2A agents
  • LangChain tool integration for easy use in LangGraph workflows

Installation

pip install langgraph-a2a-client

Or with uv:

uv add langgraph-a2a-client

Usage

from langgraph_a2a_client import A2AClientToolProvider

# Initialize the A2A client
a2a_client = A2AClientToolProvider(
    known_agent_urls=["https://example.com/agent"],
    timeout=300,
    webhook_url="https://your-webhook.com/notify",
    webhook_token="your-webhook-token",
    headers={
        "https://example.com/agent": {"X-API-Key": "your-api-key"}
    }  # Optional: Per-URL headers for authentication
)

# Get the tools for use in LangGraph
tools = a2a_client.tools

# Use in your LangGraph application
# ...

API

A2AClientToolProvider

Main class that provides A2A client functionality.

Parameters

  • known_agent_urls (list[str] | None): List of A2A agent URLs to discover initially
  • timeout (int): Timeout for HTTP operations in seconds (default: 300)
  • webhook_url (str | None): Optional webhook URL for push notifications
  • webhook_token (str | None): Optional authentication token for webhook notifications
  • headers (dict[str, dict[str, str]] | None): Optional per-URL HTTP headers for authentication. Format: {"https://agent-url.com": {"X-API-Key": "key", "Authorization": "Bearer token"}}

Tools

The provider exposes three tools:

  1. a2a_discover_agent: Discover an A2A agent and return its agent card
  2. a2a_list_discovered_agents: List all discovered A2A agents and their capabilities
  3. a2a_send_message: Send a message to a specific A2A agent

Authentication

The client supports configuring HTTP headers per agent URL for authentication:

API Key Authentication (Per URL)

a2a_client = A2AClientToolProvider(
    known_agent_urls=["https://agent1.example.com", "https://agent2.example.com"],
    headers={
        "https://agent1.example.com": {"X-API-Key": "api-key-for-agent1"},
        "https://agent2.example.com": {"X-API-Key": "api-key-for-agent2"}
    }
)

Bearer Token Authentication

a2a_client = A2AClientToolProvider(
    known_agent_urls=["https://example.com/agent"],
    headers={
        "https://example.com/agent": {"Authorization": "Bearer your-token"}
    }
)

Custom Headers (Per URL)

a2a_client = A2AClientToolProvider(
    known_agent_urls=["https://example.com/agent"],
    headers={
        "https://example.com/agent": {
            "X-Custom-Header": "custom-value",
            "X-Client-ID": "client-123",
            "Authorization": "Bearer token"
        }
    }
)

Multiple Agents with Different Authentication

a2a_client = A2AClientToolProvider(
    known_agent_urls=[
        "https://public-agent.example.com",
        "https://secure-agent.example.com"
    ],
    headers={
        # Secure agent requires authentication
        "https://secure-agent.example.com": {
            "X-API-Key": "secret-key",
            "X-Tenant-ID": "tenant-123"
        }
        # Public agent has no entry, so no headers are added
    }
)

Examples

Basic Usage

uv run examples/basic_usage.py

Authentication Usage

uv run examples/authentication_usage.py

Supervisor Agent Example

export OPENAI_API_KEY="your-openai-api"
uv run --extra examples examples/supervisor_agent.py

License

MIT

Metadata

Release files for langgraph-a2a-client 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langgraph-a2a-client 0.1.5
File Size Uploaded
langgraph_a2a_client-0.1.5.tar.gz 98.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langgraph-a2a-client 0.1.5
File Interpreter ABI Platform
langgraph_a2a_client-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 105.9 kB

Release files / langgraph_a2a_client-0.1.5.tar.gz

Download URL langgraph_a2a_client-0.1.5.tar.gz
Size 98.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0ff1954c271626bbbfe8ee8736fa74ab9e14e50c64edec4e7ff68945b8513214
BLAKE2b-256 checksum
How to use checksums
55cb92a11b44e51110c6072a121b8f249d708aa549393ed7ddaefa2f7c718f91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.11

Release files / langgraph_a2a_client-0.1.5-py3-none-any.whl

Download URL langgraph_a2a_client-0.1.5-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1238c501c450b2b01438c39890c97caed7cdfc1aca32440f0c8aa9b06624a9d4
BLAKE2b-256 checksum
How to use checksums
6ad8abdb8a70168fcd38f7d0c099dba9033b60465700c2640d5fddfeaf23e8c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.11

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page