ExAgent.Handoff (ExAgent v3.0.0)

View Source

A destination a model may ask to take over the current user turn.

Stability — Candidate.

List these definitions in :handoffs on the source agent. ExAgent exposes one transfer_to_<id> tool per destination. The tool takes an optional note (up to 1,000 characters). Permissions and approvals apply to the tool name. The destination starts after the batch settles successfully.

The destination receives a bounded, provider-neutral history view. Set :share_images, :share_audio or :share_file_references to grant access to those attachments. Each grant defaults to false.

Summary

Functions

Build a destination. Give it an ASCII identifier (1–48 letters, digits, underscores or hyphens), a description of when to transfer, and an agent. :max_history_bytes limits the view including attachments (256 bytes to 1 MiB, default 64 KiB). Invalid configuration raises ArgumentError.

Return the tool offered for this destination. Pass it as :tool to ExAgent.Continuation.decide/4 when editing a handoff's arguments.

Types

t()

@type t() :: %ExAgent.Handoff{
  agent: ExAgent.t(),
  description: String.t(),
  id: String.t(),
  max_history_bytes: pos_integer(),
  policy: %{required(String.t()) => String.t()} | nil,
  share_audio: boolean(),
  share_file_references: boolean(),
  share_images: boolean()
}

Functions

new(opts)

@spec new(keyword()) :: t()

Build a destination. Give it an ASCII identifier (1–48 letters, digits, underscores or hyphens), a description of when to transfer, and an agent. :max_history_bytes limits the view including attachments (256 bytes to 1 MiB, default 64 KiB). Invalid configuration raises ArgumentError.

:share_audio grants portable audio files from the latest turn input. Each transfer needs its own grant. The view omits audio filenames and keeps only clips that fit its attachment budget alongside any images. A request carrying audio requires support from the effective model.

:share_file_references grants provider file references from the latest turn input under the same attachment budget. Grant access only when the destination's credentials may use the file. The effective model still has to support the owning provider and file type.

In a root continuation, :policy versions this destination's guardrails. It is a map with string keys "id" and "version". If omitted, the destination uses the continuation's policy reference for its own rules.

tool(entry)

@spec tool(t()) :: ExAgent.Tool.t()

Return the tool offered for this destination. Pass it as :tool to ExAgent.Continuation.decide/4 when editing a handoff's arguments.