ExAgent. Chat. AGUI. Input
(ExAgent v3.0.0)
View Source
Decode an AG-UI 1.0 run request into a prompt or C7 commands.
Stability — Candidate.
Authenticate the request and authorize the conversation before decoding.
The second argument is a host-owned map with the expected :thread_id and
fresh wire :run_id. To resume, also pass :resume with :id (the Server's
conversation ID), :namespace, :record_id, :revision and :pending.
Bind this data to the paused attempt on the authorized thread and read
the full inbox from ExAgent.Server.pending/1. Every item must match the
supplied scope and revision. Send one answer per approval, input request
and deferral for a declared frontend tool. Timers and other external
deferrals stay in the inbox for the host or Recovery to resolve.
A new run returns message: %{id: id, text: text} from the final user message.
A resume returns message: nil and ordered commands:
{:decide, request, decision}for approval payloads%{"approved" => boolean}. Approval can include"editedArgs"as a full replacement. Denial can include a short"reason".{:input, call, supplied}for MCP forms keyed by request ID or input values%{"result" => value}. Frontend tool receipts use%{"result" => value}or%{"error" => value}.
Cancellation denies an approval or closes an input request locally.
An external effect requires a result receipt. The host applies
commands with ExAgent.Server.decide/4 and ExAgent.Server.supply_result/4
under its own authorizer, keeping the original items for retries. Resume
with the exact ready reference when the inbox has settled.
Wire history before the last message is discarded. A resumed run uses the
Server's history and can discard a final reasoning message as well.
:allow optionally maps :state and :forwarded_props to
lists of permitted string keys, and :context to permitted descriptions.
Selected values are returned under :client for application use.
Request data never supplies actor identity or run options.
Pass host-declared frontend_tool/1 values in :frontend_tools to offer
them by name. The result's :tools holds those host definitions. They
leave an external deferral in C7. The application handles the work and
authorizes its receipt after the confirmed interruption.
Summary
Functions
Decode a JSON object with string keys against an authorized host binding.
Declare a host-owned frontend tool that waits for a C7 result.
Types
@type command() :: {:decide, ExAgent.Continuation.ApprovalRequest.t(), ExAgent.Permissions.decision()} | {:input, ExAgent.Continuation.DeferredCall.t(), ExAgent.Continuation.supplied()}