AG-UI
Show messages and shared agent state from an AG-UI endpoint.
Connect an AG-UI endpoint
Install Ghost UI and its view dependencies, then add the AG-UI client.
Point one client and runtime per conversation at an endpoint that speaks AG-UI. Supply the endpoint credentials and thread ID in your app.
Mount with key={threadId + ":" + revision} when replacing its owner. useState intentionally creates the client once; changing props does not retarget it. Use a caller-created HttpAgent with headers or custom fetch when authentication needs application context.
Shared state and advanced runs
The client assembles messages and updates client.state. Ghost shares a native subscription across its views and releases it when the last subscriber leaves. To show a plan or another state panel, read and validate owner.client.state alongside the messages.
createAgUiRuntime(client, { identity, run: native => native.runAgent({ forwardedProps, context, tools }) }) can customize a run using the actual client type. Schema validation, tool execution and access policy stay with the application. Use native pendingInterrupts and runAgent({ resume }) for protocol-specific resumption; an interrupt is not automatically a boolean approval.
Boundaries and failures
Text send adds a native user message before running; if the run fails, that message remains native history for deliberate retry/reconciliation. Stop calls abortRun; it is a cancellation request. Ghost's generic retry/edit/tool approval are not guessed from AG-UI events. Use native commands or a deliberate application adapter when equivalent semantics exist.
For protocol schemas, state events and tools see the AG-UI client reference. Pydantic AI, Agno and CrewAI can expose this same protocol.