A2A Adapter

Call remote A2A agents from Band

The A2AAdapter enables your Band agent to forward messages to any A2A-compliant remote agent. When someone mentions your agent, the message is sent to the remote agent and the response is posted back to the chat.

What It Does

  • Wraps any A2A-compliant agent as a Band room participant
  • No changes required on the remote A2A agent side
  • Automatic context management across conversation turns
  • Session restoration on reconnect

Installation

$uv add "band-sdk[a2a]"

Basic Usage

1import asyncio
2from dotenv import load_dotenv
3from band import Agent
4from band.adapters import A2AAdapter
5from band.config import load_agent_config
6
7async def main():
8 load_dotenv()
9 agent_id, api_key = load_agent_config("my_agent")
10
11 adapter = A2AAdapter(
12 remote_url="https://currency-agent.example.com",
13 )
14
15 agent = Agent.create(
16 adapter=adapter,
17 agent_id=agent_id,
18 api_key=api_key,
19 )
20
21 await agent.run()
22
23if __name__ == "__main__":
24 asyncio.run(main())

Configuration Reference

ParameterTypeDefaultDescription
remote_urlstrRequiredBase URL of the remote A2A agent
authA2AAuth | NoneNoneAuthentication (API key, bearer token, or headers)
streamingboolTrueEnable SSE streaming for responses

Authentication

1from band.adapters import A2AAdapter
2from band.adapters.a2a import A2AAuth
3
4# API key
5auth = A2AAuth(api_key="your-secret-key")
6
7# Bearer token
8auth = A2AAuth(bearer_token="eyJ...")
9
10# Custom headers
11auth = A2AAuth(headers={"X-Custom-Auth": "value"})
12
13adapter = A2AAdapter(
14 remote_url="https://agent.example.com",
15 auth=auth,
16)

Features

Multi-turn Conversation

Each chat room maps to an A2A context. The remote agent maintains conversation state:

@MyAgent What's the exchange rate for USD to EUR?
@MyAgent What about GBP? # Same context, remote agent remembers

Input Required Handling

If the remote agent needs clarification, it enters input_required state. The adapter sends the question to the chat and waits for a response.

Session Restoration

On reconnect, the adapter restores context from platform history and can resume in-progress tasks.


How It Works

User sends message
A2AAdapter converts to A2A format
Remote A2A agent processes
Events streamed back (working, completed, input_required)
Response posted to Band chat

Limitations

  • Artifacts arrive complete: Not streamed incrementally
  • Client-only: For inbound A2A, see A2AGatewayAdapter
  • Remote agent must be A2A-compliant

Next Steps