Skip to navigation

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

agent.py
import asyncio
import os
from dotenv import load_dotenv
from band import Agent
from band.adapters import A2AAdapter
from band.config import load_agent_config
async def main():
load_dotenv()
agent_id, api_key = load_agent_config("my_agent")
adapter = A2AAdapter(
remote_url="https://currency-agent.example.com",
)
agent = Agent.create(
adapter=adapter,
agent_id=agent_id,
api_key=api_key,
ws_url=os.getenv("BAND_WS_URL", "wss://app.band.ai/api/v1/socket/websocket"),
rest_url=os.getenv("BAND_REST_URL", "https://app.band.ai"),
)
await agent.run()
if __name__ == "__main__":
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

from band.adapters import A2AAdapter
from band.adapters.a2a import A2AAuth
# API key
auth = A2AAuth(api_key="your-secret-key")
# Bearer token
auth = A2AAuth(bearer_token="eyJ...")
# Custom headers
auth = A2AAuth(headers={"X-Custom-Auth": "value"})
adapter = A2AAdapter(
remote_url="https://agent.example.com",
auth=auth,
)

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