@cool-ai/beach-channel-a2a
v0.1.2
Published
Beach A2A channel — receive a peer agent's JSON-RPC message, route it, reply parts back. Implements core's ChannelAdaptor.
Readme
@cool-ai/beach-channel-a2a
The A2A channel adaptor: another agent sends a JSON-RPC message/send, the message is routed, and the reply parts go back to the caller. It implements core's ChannelAdaptor, and it is how one Beach instance exposes itself to another — the reached Beach runs this adaptor as a server; the calling side is an ordinary A2A client.
message/send is synchronous request/response, so the adaptor is a blocking channel: it holds the caller's HTTP request open — keyed on a correlation id carried on the reply destination — until the routed reply arrives, then writes the JSON-RPC result. A reply that never comes is answered with a JSON-RPC error after replyTimeoutMs.
A peer reads the reply parts directly, so the adaptor wires no renderer and applies no part-level filtering — Beach passes the parts through.
Use
import { A2AChannelAdaptor } from '@cool-ai/beach-channel-a2a';
const a2a = new A2AChannelAdaptor({
inbound: (req) => channelRouter.inbound(req),
replyTimeoutMs: 30_000,
});
app.post('/a2a', a2a.handler()); // peers POST message/send here
// Register `a2a` as a channel-router adaptor so replies route back to the caller.The wire format is the @a2a-js/sdk Message shape, adopted wholesale. Threading follows the message's contextId; replies echo contextId and taskId so the peer can correlate.
