Claudio.A2A.Client (Claudio v0.5.0)

View Source

A2A client for discovering and interacting with remote agents.

Delegates to a transport implementation. Defaults to JSON-RPC 2.0 over HTTP.

Examples

# Discover an agent (default HTTP transport)
{:ok, card} = Claudio.A2A.Client.discover("https://agent.example.com")

# Send a message
alias Claudio.A2A.{Message, Part}
message = Message.new(:user, [Part.text("Search for Elixir libraries")])
{:ok, task} = Claudio.A2A.Client.send_message("https://agent.example.com/a2a", message)

# Check task status
{:ok, task} = Claudio.A2A.Client.get_task("https://agent.example.com/a2a", task.id)

# Use a different transport
{:ok, task} = Claudio.A2A.Client.send_message("agent:443", message,
  transport: Claudio.A2A.Transport.GRPC)

Summary

Functions

Discover an agent's capabilities from its base URL.

List tasks, optionally filtered.

Send a message to an agent, creating or continuing a task.

Functions

cancel_task(endpoint, task_id, opts \\ [])

@spec cancel_task(String.t(), String.t(), keyword()) ::
  {:ok, Claudio.A2A.Task.t()} | {:error, term()}

Cancel a task.

Options

  • :transport — Transport module

discover(base_url, opts \\ [])

@spec discover(
  String.t(),
  keyword()
) :: {:ok, Claudio.A2A.AgentCard.t()} | {:error, term()}

Discover an agent's capabilities from its base URL.

Fetches the agent card from {base_url}/.well-known/agent-card.json.

Options

get_task(endpoint, task_id, opts \\ [])

@spec get_task(String.t(), String.t(), keyword()) ::
  {:ok, Claudio.A2A.Task.t()} | {:error, term()}

Get a task by ID.

Options

  • :history_length — Number of history messages to include
  • :transport — Transport module

list_tasks(endpoint, opts \\ [])

@spec list_tasks(
  String.t(),
  keyword()
) ::
  {:ok, %{tasks: [Claudio.A2A.Task.t()], next_page_token: String.t()}}
  | {:error, term()}

List tasks, optionally filtered.

Options

  • :context_id — Filter by context
  • :status — Filter by state (atom, e.g. :working)
  • :page_size — Results per page
  • :page_token — Pagination token
  • :history_length — Number of history messages to include
  • :transport — Transport module

send_message(endpoint, message, opts \\ [])

@spec send_message(String.t(), Claudio.A2A.Message.t(), keyword()) ::
  {:ok, Claudio.A2A.Task.t() | Claudio.A2A.Message.t()} | {:error, term()}

Send a message to an agent, creating or continuing a task.

Options

  • :task_id — Continue an existing task
  • :configuration — SendMessageConfiguration map
  • :metadata — Additional metadata
  • :auth_token — Bearer token for authentication
  • :transport — Transport module (default: Claudio.A2A.Transport.HTTP)