Claudio.A2A.Transport behaviour (Claudio v0.5.0)

View Source

Behaviour for A2A transport implementations.

Claudio supports multiple transport bindings for the A2A protocol:

Usage

# Default HTTP transport
Client.send_message("https://agent.example.com/a2a", message)

# Explicit gRPC transport
Client.send_message("agent.example.com:443", message,
  transport: Claudio.A2A.Transport.GRPC)

Summary

Callbacks

Discover an agent's capabilities.

List tasks with optional filters.

Send a message to an agent.

Types

endpoint()

@type endpoint() :: String.t()

list_response()

@type list_response() :: %{tasks: [Claudio.A2A.Task.t()], next_page_token: String.t()}

opts()

@type opts() :: keyword()

send_response()

@type send_response() :: Claudio.A2A.Task.t() | Claudio.A2A.Message.t()

Callbacks

cancel_task(endpoint, task_id, opts)

@callback cancel_task(endpoint(), task_id :: String.t(), opts()) ::
  {:ok, Claudio.A2A.Task.t()} | {:error, term()}

Cancel a task.

Common options

  • :auth_token — Bearer token for authentication

discover(endpoint, opts)

@callback discover(endpoint(), opts()) ::
  {:ok, Claudio.A2A.AgentCard.t()} | {:error, term()}

Discover an agent's capabilities.

Common options

  • :auth_token — Bearer token for authentication
  • :receive_timeout — HTTP receive timeout in ms
  • :connect_options — Connection options (e.g., transport opts)

get_task(endpoint, task_id, opts)

@callback get_task(endpoint(), task_id :: String.t(), opts()) ::
  {:ok, Claudio.A2A.Task.t()} | {:error, term()}

Get a task by ID.

Common options

  • :history_length — Number of history messages to include
  • :auth_token — Bearer token for authentication

list_tasks(endpoint, opts)

@callback list_tasks(endpoint(), opts()) :: {:ok, list_response()} | {:error, term()}

List tasks with optional filters.

Common options

  • :context_id — Filter by context ID
  • :status — Filter by task state atom (e.g., :working, :completed)
  • :page_size — Results per page
  • :page_token — Pagination token
  • :history_length — Number of history messages to include
  • :auth_token — Bearer token for authentication

send_message(endpoint, t, opts)

@callback send_message(endpoint(), Claudio.A2A.Message.t(), opts()) ::
  {:ok, send_response()} | {:error, term()}

Send a message to an agent.

Common options

  • :auth_token — Bearer token for authentication
  • :configuration — SendMessageConfiguration map
  • :metadata — Additional metadata
  • :receive_timeout — HTTP receive timeout in ms
  • :connect_options — Connection options