spakky-agui¶
spakky-agui는spakky-agent의 protocol-neutralAgentEventstream을 AG-UI 이벤트로 투영하고 FastAPI SSE, HTTP streaming, WebSocket, stdio 경계로 노출합니다.
FastAPI SSE/HTTP streaming/WebSocket endpoint는 @AGUICompatible @Agent 선언을 AgUiAgentRegistry에 등록한 뒤 post-processor가 host FastAPI Pod에 자동 mount합니다. add_agui_endpoint 계열 helper는 lower-level 호환 API입니다.
Public API¶
AG-UI protocol adapter plugin for Spakky Agent.
AgUiAgent = AGUICompatible
module-attribute
¶
Deprecated alias for :class:AGUICompatible.
PLUGIN_NAME = Plugin(name='spakky-agui')
module-attribute
¶
Plugin identifier for the AG-UI adapter package.
RunDriverFactory = Callable[[RunAgentInput, AgUiRunAgentInput, str | None], AsyncIterable[str]]
¶
Resolves the agent run for a request and returns a ready SSE driver.
Receives the mapped core RunAgentInput, the raw AG-UI input (so the factory
can ingest an approval decision against its own signal repository), and the
request Accept header for the event encoder.
AgUiConfig()
¶
Bases: BaseSettings
Settings for the AG-UI adapter.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/config.py
sse_path = DEFAULT_AGUI_SSE_PATH
class-attribute
instance-attribute
¶
Path the AG-UI SSE endpoint is mounted at on the FastAPI application.
websocket_path = DEFAULT_AGUI_WEBSOCKET_PATH
class-attribute
instance-attribute
¶
Path the AG-UI WebSocket endpoint is mounted at on the FastAPI application.
http_stream_path = DEFAULT_AGUI_HTTP_STREAM_PATH
class-attribute
instance-attribute
¶
Path the AG-UI HTTP streaming endpoint is mounted at on the FastAPI app.
emit_state_snapshot = True
class-attribute
instance-attribute
¶
Whether STATE_SNAPSHOT neutral events are projected to AG-UI; when False the projector drops them so a client that ignores shared state is not sent redundant snapshots.
messages_snapshot_enabled = False
class-attribute
instance-attribute
¶
Whether a single MESSAGES_SNAPSHOT is emitted before RUN_FINISHED; the framework runner emits no message history, so this defaults off and is only enabled by a client that wants a (currently empty) snapshot frame.
AbstractAgUiError
¶
AgUiApprovalDecodeError
¶
Bases: AbstractAgUiError
Raised when a resume input claims an approval decision it cannot supply.
The AG-UI resume carries an approval decision either as a tool-result
message addressed to the deferred hitl_approval call or as a
forwardedProps.approvalDecision object. This error is raised when that
payload is present but malformed: the request id is missing, the decision
string is absent, or the decision is not a member of ApprovalDecision.
AgUiEndpointConflictError
¶
AgUiPendingApprovalError
¶
Bases: AbstractAgUiError
Raised when a paused-for-approval state carries malformed approval metadata.
The event-driven path converts RunPausedEvent to a deferred-tool approval
request. Legacy helpers can still rebuild that request from durable
WAIT_FOR_APPROVAL state. This error is raised when either source lacks the
approval id, prompt, or known decision list the adapter needs to render the
pause without guessing.
AgUiRunResolutionError
¶
Bases: AbstractAgUiError
Raised when an SSE request references a run the driver cannot resolve.
The endpoint maps an AG-UI RunAgentInput to a core run, then asks the
run-driver factory to build a driver for it. This error is raised when the
factory cannot produce a runner for the requested agent/run — for example,
the AG-UI input omits the last user message the core run requires to seed a
model request.
AgUiProjector(config)
¶
Stateful per-run projector from neutral events to AG-UI events.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/projector.py
project(event)
¶
Project one neutral event into zero or more AG-UI events.
The neutral kind field is typed AgentEventKind (not a per-class
Literal), so it does not narrow the union; matching on the event
type does, which keeps each handler statically typed without casts.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/projector.py
finish()
¶
Flush any open message, reasoning, or tool frames as END events.
Called once after the neutral stream ends so a stream truncated mid-frame (no RUN_FINISHED, or a model that stopped mid-message) still produces a balanced AG-UI sequence on the wire.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/projector.py
AgUiAgentEntry(instance, agent_type, metadata)
dataclass
¶
A discovered @Agent instance paired with its AG-UI metadata.
agent_name
property
¶
Return the stable AG-UI agent id.
AgUiAgentRegistry()
¶
Holds AG-UI-exposed @Agent instances keyed by agent name.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/server/registry.py
register(instance, agent_type, metadata)
¶
Register one exposed @Agent instance and return the entry.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/server/registry.py
get(agent_name)
¶
Return the entry for agent_name.
list_entries()
¶
Return registered AG-UI agent entries in stable name order.
AgUiStdioCommand(run_driver_factory, input_stream, output_stream, accept=None)
dataclass
¶
Callable command object that CLI plugins can register with their runner.
__call__(run_input_json=None)
async
¶
Run one AG-UI input from run_input_json or stdin over stdio.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/stdio.py
AGUICompatible(sse_path=None, http_stream_path=None, websocket_path=None)
dataclass
¶
Bases: Tag
Marks an @Agent class to be served through the AG-UI adapter.
Paths default to :class:AgUiConfig so a single declaration can use the
plugin defaults, while multi-agent applications can assign distinct paths
declaratively on each marked agent.
sse_path = None
class-attribute
instance-attribute
¶
SSE endpoint path for this agent. None uses AgUiConfig.sse_path.
http_stream_path = None
class-attribute
instance-attribute
¶
HTTP streaming endpoint path. None uses AgUiConfig.http_stream_path.
websocket_path = None
class-attribute
instance-attribute
¶
WebSocket endpoint path. None uses AgUiConfig.websocket_path.
AgUiManagedRunDriver(runner_context, inbound, agent_id, config, accept)
¶
Open a request-scoped runner for the lifetime of one AG-UI stream.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/transport.py
__aiter__()
async
¶
Yield frames while the runner factory context remains open.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/transport.py
AgUiRunDriver(runner, run_input, agent_id, projector, encoder)
¶
Streams one agent run as encoded AG-UI SSE frames.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/transport.py
__aiter__()
async
¶
Yield SSE frames for the full run, including the flush tail.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/transport.py
add_agui_endpoint(app, *, run_driver_factory, config)
¶
Register the AG-UI SSE endpoint on app at config.sse_path.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/endpoint.py
approval_from_pause(event)
¶
Convert a neutral pause event into the AG-UI approval payload.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/hitl.py
ingest_decision(ag_ui_input, signals, state_id)
¶
Decode an approval decision from an AG-UI input and queue it as a signal.
Reads the decision from the hitl_approval tool-result message when
present, otherwise from forwardedProps.approvalDecision. The decoded
decision is appended as an APPROVAL_DECISION signal carrying the request
id the runner correlates against, plus optional modified payload and comment.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/hitl.py
project_approval(approval, attribution)
¶
Render an approval request as a deferred-tool frame (no result).
The deferred call id is the approval id, so the resume tool-result message addresses the same call. The args carry the human-facing prompt, the allowed decisions, and any approval metadata the runner attached.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/hitl.py
project_pending_approval(state, attribution)
¶
Project a durable pending approval into the deferred-tool request frame.
This remains as a compatibility helper for callers that already hold a
durable state snapshot. The run driver consumes RunPausedEvent directly.
Returns an empty list when the state is not paused for approval.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/hitl.py
add_agui_http_stream_endpoint(app, *, run_driver_factory, config)
¶
Register the AG-UI HTTP streaming endpoint at config.http_stream_path.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/http_stream.py
agui_stdio_payloads(driver)
async
¶
Yield AG-UI event JSON-lines from an AgUiRunDriver-compatible stream.
read_agui_run_input(*, input_stream, run_input_json=None)
¶
Parse an AG-UI RunAgentInput from an argument or stdin.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/stdio.py
run_agui_stdio(*, run_driver_factory, input_stream, output_stream, run_input_json=None, accept=None)
async
¶
Drive one AG-UI run from stdio and write AG-UI event payloads to stdout.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/stdio.py
add_agui_websocket_endpoint(app, *, run_driver_factory, config)
¶
Register the AG-UI WebSocket endpoint on app at config.websocket_path.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/websocket.py
설정¶
Configuration for the spakky-agui plugin.
SPAKKY_AGUI_CONFIG_ENV_PREFIX = 'SPAKKY_AGUI_'
module-attribute
¶
Environment prefix for AG-UI adapter settings.
DEFAULT_AGUI_SSE_PATH = '/agui'
module-attribute
¶
Default mount path for the AG-UI SSE endpoint.
DEFAULT_AGUI_WEBSOCKET_PATH = '/agui/ws'
module-attribute
¶
Default mount path for the AG-UI WebSocket endpoint.
DEFAULT_AGUI_HTTP_STREAM_PATH = '/agui/stream'
module-attribute
¶
Default mount path for the AG-UI HTTP streaming endpoint.
AgUiConfig()
¶
Bases: BaseSettings
Settings for the AG-UI adapter.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/config.py
sse_path = DEFAULT_AGUI_SSE_PATH
class-attribute
instance-attribute
¶
Path the AG-UI SSE endpoint is mounted at on the FastAPI application.
websocket_path = DEFAULT_AGUI_WEBSOCKET_PATH
class-attribute
instance-attribute
¶
Path the AG-UI WebSocket endpoint is mounted at on the FastAPI application.
http_stream_path = DEFAULT_AGUI_HTTP_STREAM_PATH
class-attribute
instance-attribute
¶
Path the AG-UI HTTP streaming endpoint is mounted at on the FastAPI app.
emit_state_snapshot = True
class-attribute
instance-attribute
¶
Whether STATE_SNAPSHOT neutral events are projected to AG-UI; when False the projector drops them so a client that ignores shared state is not sent redundant snapshots.
messages_snapshot_enabled = False
class-attribute
instance-attribute
¶
Whether a single MESSAGES_SNAPSHOT is emitted before RUN_FINISHED; the framework runner emits no message history, so this defaults off and is only enabled by a client that wants a (currently empty) snapshot frame.
Endpoint¶
@AGUICompatible marker for exposing an @Agent over AG-UI transports.
AGUICompatible(sse_path=None, http_stream_path=None, websocket_path=None)
dataclass
¶
Bases: Tag
Marks an @Agent class to be served through the AG-UI adapter.
Paths default to :class:AgUiConfig so a single declaration can use the
plugin defaults, while multi-agent applications can assign distinct paths
declaratively on each marked agent.
sse_path = None
class-attribute
instance-attribute
¶
SSE endpoint path for this agent. None uses AgUiConfig.sse_path.
http_stream_path = None
class-attribute
instance-attribute
¶
HTTP streaming endpoint path. None uses AgUiConfig.http_stream_path.
websocket_path = None
class-attribute
instance-attribute
¶
WebSocket endpoint path. None uses AgUiConfig.websocket_path.
Registry of @Agent instances exposed through AG-UI transports.
AgUiAgentEntry(instance, agent_type, metadata)
dataclass
¶
A discovered @Agent instance paired with its AG-UI metadata.
agent_name
property
¶
Return the stable AG-UI agent id.
AgUiAgentRegistry()
¶
Holds AG-UI-exposed @Agent instances keyed by agent name.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/server/registry.py
register(instance, agent_type, metadata)
¶
Register one exposed @Agent instance and return the entry.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/server/registry.py
get(agent_name)
¶
Return the entry for agent_name.
list_entries()
¶
Return registered AG-UI agent entries in stable name order.
Post-processor that mounts AG-UI routes on FastAPI Pods.
MountAgUiFastAPIPostProcessor()
¶
Bases: IPostProcessor, IContainerAware, IApplicationContextAware
Discover @AGUICompatible @Agent Pods and mount their AG-UI FastAPI routes.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/post_processors/mount_fastapi.py
post_process(pod)
¶
Register exposed agents and mount them on FastAPI apps.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/post_processors/mount_fastapi.py
Mount the AG-UI SSE endpoint on a FastAPI application.
add_agui_endpoint registers a single POST {config.sse_path} route that
accepts an AG-UI RunAgentInput and streams the run back as
text/event-stream. It owns the protocol-boundary translation that neither
the bridge nor the projector should know about: it maps the AG-UI input shape
(threadId / runId / messages / parentRunId) onto the neutral core
RunAgentInput and, when the input carries a resumed approval decision, queues
that decision before the run is driven.
The application author supplies a run_driver_factory that resolves the
concrete @Agent for the request and returns a ready AgUiRunDriver. The
endpoint stays agnostic about which agent answers, mirroring pydantic-ai's
add_*_fastapi_endpoint pattern and depending on third-party fastapi
directly (ADR-0013 §2) rather than importing the spakky-fastapi plugin.
SSE_MEDIA_TYPE = 'text/event-stream'
module-attribute
¶
Media type for the AG-UI server-sent event stream.
RunDriverFactory = Callable[[RunAgentInput, AgUiRunAgentInput, str | None], AsyncIterable[str]]
¶
Resolves the agent run for a request and returns a ready SSE driver.
Receives the mapped core RunAgentInput, the raw AG-UI input (so the factory
can ingest an approval decision against its own signal repository), and the
request Accept header for the event encoder.
add_agui_endpoint(app, *, run_driver_factory, config)
¶
Register the AG-UI SSE endpoint on app at config.sse_path.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/endpoint.py
Mount the AG-UI HTTP chunked streaming endpoint on a FastAPI application.
add_agui_http_stream_endpoint registers a POST {config.http_stream_path}
route that accepts an AG-UI RunAgentInput and streams encoded AG-UI event
payloads as sequential JSON-line response chunks. It intentionally does not emit
SSE data: framing; clients that want SSE should keep using
add_agui_endpoint.
HTTP_STREAM_MEDIA_TYPE = 'application/x-ndjson'
module-attribute
¶
Media type for AG-UI HTTP streaming chunks.
add_agui_http_stream_endpoint(app, *, run_driver_factory, config)
¶
Register the AG-UI HTTP streaming endpoint at config.http_stream_path.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/http_stream.py
Mount the AG-UI WebSocket endpoint on a FastAPI application.
add_agui_websocket_endpoint registers a bidirectional WebSocket route. Each
client JSON message is parsed as an AG-UI RunAgentInput, mapped through the
same protocol boundary as the SSE endpoint, and streamed back as encoded AG-UI
event frames over WebSocket text messages.
add_agui_websocket_endpoint(app, *, run_driver_factory, config)
¶
Register the AG-UI WebSocket endpoint on app at config.websocket_path.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/websocket.py
AG-UI stdio protocol boundary for CLI adapters.
The stdio boundary intentionally emits protocol payloads only: it accepts a
single AG-UI RunAgentInput JSON document from stdin or an argument, drives the
same AgUiRunDriver used by SSE/HTTP/WebSocket adapters, and writes one AG-UI
event JSON payload per stdout line. Rendering, colors, and nested views remain
the responsibility of the consuming UI process.
AgUiStdioCommand(run_driver_factory, input_stream, output_stream, accept=None)
dataclass
¶
Callable command object that CLI plugins can register with their runner.
__call__(run_input_json=None)
async
¶
Run one AG-UI input from run_input_json or stdin over stdio.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/stdio.py
run_agui_stdio(*, run_driver_factory, input_stream, output_stream, run_input_json=None, accept=None)
async
¶
Drive one AG-UI run from stdio and write AG-UI event payloads to stdout.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/stdio.py
read_agui_run_input(*, input_stream, run_input_json=None)
¶
Parse an AG-UI RunAgentInput from an argument or stdin.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/stdio.py
agui_stdio_payloads(driver)
async
¶
Yield AG-UI event JSON-lines from an AgUiRunDriver-compatible stream.
Transport¶
Drive an agent run and stream it as AG-UI server-sent events.
AgUiRunDriver is the pipe that connects the runner to the wire: it pulls the
framework runner's native neutral AgentEvent stream off run_events —
the lossless taxonomy AG-UI projects one-to-one (ADR-0013 §3) — runs each event
through the projector (AgentEvent -> AG-UI BaseEvent), and encodes each
AG-UI event into an SSE data: frame.
run_events emits approval pauses as neutral RunPausedEvent items. The
projector maps those directly into AG-UI's deferred-tool request idiom. After the
stream ends the driver flushes the projector's open-frame closures so a stream
the runner left mid-message is still well-formed on the wire.
AgUiRunDriver(runner, run_input, agent_id, projector, encoder)
¶
Streams one agent run as encoded AG-UI SSE frames.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/transport.py
__aiter__()
async
¶
Yield SSE frames for the full run, including the flush tail.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/transport.py
AgUiManagedRunDriver(runner_context, inbound, agent_id, config, accept)
¶
Open a request-scoped runner for the lifetime of one AG-UI stream.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/transport.py
__aiter__()
async
¶
Yield frames while the runner factory context remains open.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/transport.py
Projection¶
Project neutral AgentEvents into AG-UI protocol events.
This is the fidelity-bearing half of the adapter. The neutral taxonomy carries
deltas (MESSAGE_DELTA, REASONING_DELTA, TOOL_CALL_*), but AG-UI
demands well-framed lifecycles: every text message is a
TEXT_MESSAGE_START / …CONTENT / …END triple, every reasoning message
a REASONING_START / REASONING_MESSAGE_START / …CONTENT / …END /
REASONING_END sequence, every tool call a
TOOL_CALL_START / …ARGS / …END (with the result as a separate
TOOL_CALL_RESULT). The projector is the state machine that opens, continues,
and closes those frames as deltas arrive.
It is stateful for the span of one run: it tracks the currently open message,
the currently open reasoning message, and the set of open tool calls so that a
delta with a new id closes the previous frame, and so finish() can flush any
frame still open when the neutral stream ends (a truncated run stays well-formed
on the wire).
ASSISTANT_ROLE = 'assistant'
module-attribute
¶
AG-UI text message role for model-authored assistant messages.
REASONING_ROLE = 'reasoning'
module-attribute
¶
AG-UI reasoning message role required by REASONING_MESSAGE_START.
ARTIFACT_CUSTOM_EVENT_NAME = 'artifact'
module-attribute
¶
CustomEvent name carrying a neutral artifact (no native AG-UI artifact).
AgUiProjector(config)
¶
Stateful per-run projector from neutral events to AG-UI events.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/projector.py
project(event)
¶
Project one neutral event into zero or more AG-UI events.
The neutral kind field is typed AgentEventKind (not a per-class
Literal), so it does not narrow the union; matching on the event
type does, which keeps each handler statically typed without casts.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/projector.py
finish()
¶
Flush any open message, reasoning, or tool frames as END events.
Called once after the neutral stream ends so a stream truncated mid-frame (no RUN_FINISHED, or a model that stopped mid-message) still produces a balanced AG-UI sequence on the wire.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/projector.py
Human-in-the-loop projection and decision ingestion for the AG-UI adapter.
AG-UI has no first-class approval event, so an approval request surfaces as a
deferred tool call: a TOOL_CALL_START/ARGS/END triple naming the
synthetic hitl_approval tool, deliberately with no result frame. The
client renders it, collects the human decision, and returns that decision on the
next RunAgentInput (as the deferred tool's result message, or as
forwardedProps.approvalDecision). ingest_decision decodes that decision
and appends it to the durable signal queue the runner polls (ADR-0013 §5), which
is the only channel the core run accepts an approval decision through.
The core run_events stream emits a first-class RunPausedEvent when a
tool pauses for approval. AG-UI still represents that pause as a deferred tool
call, but the adapter now projects the pause event directly instead of
reconciling durable state after a terminal RUN_FINISHED.
HITL_APPROVAL_TOOL_NAME = 'hitl_approval'
module-attribute
¶
Synthetic tool name carrying an approval request as a deferred tool call.
APPROVAL_DECISION_FORWARDED_KEY = 'approvalDecision'
module-attribute
¶
forwardedProps key a client may use to return an approval decision.
APPROVAL_STATE_METADATA_KEY = 'approval'
module-attribute
¶
State-metadata key under which the runner stores the approval request.
project_approval(approval, attribution)
¶
Render an approval request as a deferred-tool frame (no result).
The deferred call id is the approval id, so the resume tool-result message addresses the same call. The args carry the human-facing prompt, the allowed decisions, and any approval metadata the runner attached.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/hitl.py
approval_from_pause(event)
¶
Convert a neutral pause event into the AG-UI approval payload.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/hitl.py
find_pending_approval(state)
¶
Reconstruct the pending approval from a durable WAIT_FOR_APPROVAL state.
The runner saves the paused boundary as an INTERRUPTED state whose reason
is APPROVAL_REQUIRED, carrying the AgentApprovalRequest metadata under
metadata["approval"] and the human-facing prompt in current_activity.
Returns the rebuilt approval when the state is paused for approval, otherwise
None (the run finished or paused for some other reason).
Source code in plugins/spakky-agui/src/spakky/plugins/agui/hitl.py
project_pending_approval(state, attribution)
¶
Project a durable pending approval into the deferred-tool request frame.
This remains as a compatibility helper for callers that already hold a
durable state snapshot. The run driver consumes RunPausedEvent directly.
Returns an empty list when the state is not paused for approval.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/hitl.py
ingest_decision(ag_ui_input, signals, state_id)
¶
Decode an approval decision from an AG-UI input and queue it as a signal.
Reads the decision from the hitl_approval tool-result message when
present, otherwise from forwardedProps.approvalDecision. The decoded
decision is appended as an APPROVAL_DECISION signal carrying the request
id the runner correlates against, plus optional modified payload and comment.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/hitl.py
carries_approval_decision(ag_ui_input)
¶
Return whether the AG-UI input carries an approval decision to resume on.
Shared JSON serialization for AG-UI adapter frames.
The projector serializes tool results and run output, and HITL serializes
approval args — both need the same neutral JsonValue -> JSON-text encoding,
so it lives at module scope rather than being inlined twice.
Plugin¶
Plugin initialization for the AG-UI adapter.
initialize(app)
¶
Register AG-UI configuration, registry, and auto-mount post-processor.
Source code in plugins/spakky-agui/src/spakky/plugins/agui/main.py
에러¶
Error classes for the spakky-agui plugin.
AbstractAgUiError
¶
AgUiApprovalDecodeError
¶
Bases: AbstractAgUiError
Raised when a resume input claims an approval decision it cannot supply.
The AG-UI resume carries an approval decision either as a tool-result
message addressed to the deferred hitl_approval call or as a
forwardedProps.approvalDecision object. This error is raised when that
payload is present but malformed: the request id is missing, the decision
string is absent, or the decision is not a member of ApprovalDecision.
AgUiPendingApprovalError
¶
Bases: AbstractAgUiError
Raised when a paused-for-approval state carries malformed approval metadata.
The event-driven path converts RunPausedEvent to a deferred-tool approval
request. Legacy helpers can still rebuild that request from durable
WAIT_FOR_APPROVAL state. This error is raised when either source lacks the
approval id, prompt, or known decision list the adapter needs to render the
pause without guessing.
AgUiRunResolutionError
¶
Bases: AbstractAgUiError
Raised when an SSE request references a run the driver cannot resolve.
The endpoint maps an AG-UI RunAgentInput to a core run, then asks the
run-driver factory to build a driver for it. This error is raised when the
factory cannot produce a runner for the requested agent/run — for example,
the AG-UI input omits the last user message the core run requires to seed a
model request.