A2UI.A2A (A2UI v0.3.0)

Copy Markdown View Source

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"
end

Then serve via A2A.Plug:

forward "/a2a", A2A.Plug,
  agent: MyApp.A2AAdapter,
  base_url: "http://localhost:4000/a2a"

Options

  • :agent — module name of the A2UI.Agent to wrap (required). The agent must be running and registered under this name.
  • All other options (:name, :description, :version, :skills) are forwarded to use A2A.Agent.

Configuration

Configure the timeout for each A2A synchronization acknowledgement and buffered response drain in milliseconds:

config :a2ui, :a2a_sync_timeout, 5_000

The 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_connect on the A2UI agent
  • Subsequent messages extract Action / Error from Part.Data parts and forward them via handle_action / handle_error
  • A2UI response messages are wrapped as A2A.Part.Data and returned as {:input_required, parts} to keep the task open for more turns
  • Cancelling the A2A task disconnects the A2UI connection