Skip to content

A2A Client

Lets your agent discover and communicate with remote A2A (Agent-to-Agent) protocol agents. Two operations are available:

  • discover — fetches the agent card from a remote A2A endpoint and returns its capabilities, name, description, and skills.
  • send_message — sends a text message to a remote A2A agent and returns the response.

The tool is stateless: a fresh A2AAgent is created on every call using the per-endpoint configuration. Use make_a2a_client / makeA2AClient to control which endpoints the model may contact, with per-endpoint authentication, and to tune size limits.

Supported in: Python, TypeScript (Node.js, browsers).

Example:

import { Agent } from '@strands-agents/sdk'
import {
ClientFactory,
DefaultAgentCardResolver,
JsonRpcTransportFactory,
RestTransportFactory,
createAuthenticatingFetchWithRetry,
} from '@a2a-js/sdk/client'
import { makeA2AClient } from '@strands-agents/sdk/vended-tools/a2a-client'
const authFetch = createAuthenticatingFetchWithRetry(fetch, {
headers: async () => ({ Authorization: 'Bearer your-token' }),
shouldRetryWithHeaders: async () => undefined,
})
const a2aClient = makeA2AClient({
allowedEndpoints: [
// No auth needed
'https://agent.example.com',
// Custom ClientFactory for authenticated requests
[
'https://researcher.example.com',
new ClientFactory({
transports: [
new JsonRpcTransportFactory({ fetchImpl: authFetch }),
new RestTransportFactory({ fetchImpl: authFetch }),
],
cardResolver: new DefaultAgentCardResolver({ fetchImpl: authFetch }),
}),
],
],
})
const agent = new Agent({ tools: [a2aClient] })
await agent.invoke('What has the research agent found recently?')

Full API reference: TypeScript