Adapter that exposes an A2UI agent over the A2A protocol.
use A2UI.A2A generates an A2A.Agent that wraps the given
A2UI.Agent, translating between A2A messages and A2UI protocol
messages. Each A2UI envelope is carried as an A2A.Part.Data part.
Example
defmodule MyApp.A2AAdapter do
use A2UI.A2A,
agent: MyApp.UIAgent,
name: "my-ui-agent",
description: "Serves UI via A2A"
endThen serve via A2A.Plug:
forward "/a2a", A2A.Plug,
agent: MyApp.A2AAdapter,
base_url: "http://localhost:4000/a2a"Options
:agent— module name of theA2UI.Agentto wrap (required). The agent must be running and registered under this name.- All other options (
:name,:description,:version,:skills) are forwarded touse A2A.Agent.
Configuration
Configure the timeout for each A2A synchronization acknowledgement and buffered response drain in milliseconds:
config :a2ui, :a2a_sync_timeout, 5_000The default is 5_000 milliseconds. This is a compile-time setting, so changes require
recompiling the application. If synchronization times out, processing continues; if draining
times out, the response contains no buffered A2UI parts.
Protocol Mapping
- First A2A message in a task triggers
handle_connecton the A2UI agent - Subsequent messages extract
Action/ErrorfromPart.Dataparts and forward them viahandle_action/handle_error - A2UI response messages are wrapped as
A2A.Part.Dataand returned as{:input_required, parts}to keep the task open for more turns - Cancelling the A2A task disconnects the A2UI connection