Normandy.A2A.Registry (normandy v2.2.0)

View Source

Helpers for discovering remote A2A agents and registering them as tools.

Example

alias Normandy.A2A.Registry, as: A2ARegistry
alias Normandy.Tools.Toolset

registry = Toolset.new()

{:ok, registry} = A2ARegistry.discover_and_register(
  registry,
  "https://agent.example.com",
  prefix: "research",
  auth_token: "bearer-token"
)

:prefix is required: see Normandy.A2A.AgentTool's "Tool names" and "Trust".

Summary

Functions

Discovers a remote A2A agent and registers it as tool(s) in the toolset.

Creates AgentTool structs from a pre-fetched agent card.

Functions

discover_and_register(registry, base_url, opts \\ [])

@spec discover_and_register(Normandy.Tools.Toolset.t(), String.t(), keyword()) ::
  {:ok, Normandy.Tools.Toolset.t()} | {:error, term()}

Discovers a remote A2A agent and registers it as tool(s) in the toolset.

Creates one tool per skill if the agent has skills, or a single general tool if it has no skills.

:transport_opts is also used for discovery.

Options

  • :prefix (String.t/0 or false) - Required. The remote's namespace: the tool is named prefix__card_name. The rule of Normandy.MCP.ToolWrapper.new/4's :prefix; "a2a" gives 1.x's names, false the bare card name.

  • :auth_token (String.t/0) - A bearer token for the remote agent.

  • :poll_interval (pos_integer/0) - Milliseconds between status requests while the remote's task is not finished. The call's timeout is the only bound on the wait. The default value is 1000.

  • :transport_opts (keyword/0) - Options for the A2A transport. Its :headers ([{name, value}]) are sent on every request; with OpenTelemetry loaded and a span active, W3C traceparent/tracestate headers are added beside them (a same-named header you set is kept). The default value is [].

  • :timeout (pos_integer/0) - Each tool's registration timeout, in positive ms (Normandy.Tools.Toolset.register/3; 60_000 as in 1.x). The default value is 60000.

from_agent_card(agent_card, endpoint, opts \\ [])

@spec from_agent_card(Claudio.A2A.AgentCard.t(), String.t(), keyword()) :: [
  Normandy.A2A.AgentTool.t()
]

Creates AgentTool structs from a pre-fetched agent card.

Returns one tool per skill, or a single general tool if no skills.

Options

  • :prefix (String.t/0 or false) - Required. The remote's namespace: the tool is named prefix__card_name. The rule of Normandy.MCP.ToolWrapper.new/4's :prefix; "a2a" gives 1.x's names, false the bare card name.

  • :auth_token (String.t/0) - A bearer token for the remote agent.

  • :poll_interval (pos_integer/0) - Milliseconds between status requests while the remote's task is not finished. The call's timeout is the only bound on the wait. The default value is 1000.

  • :transport_opts (keyword/0) - Options for the A2A transport. Its :headers ([{name, value}]) are sent on every request; with OpenTelemetry loaded and a span active, W3C traceparent/tracestate headers are added beside them (a same-named header you set is kept). The default value is [].