Liking cljdoc? Tell your friends :D

AG-UI API

Module: im.ttalk/clj-agent-agui

Source: modules/clj-agent-agui/src

Runtime

Namespace: im.ttalk.agent.agui.runtime

The runtime decouples an agent run from the HTTP request that started it. Runs continue when the client disconnects, can be stopped from another request, and can resume after human approval.

FunctionContract
runtimeCreate an explicitly scoped runtime; no global singleton
start-run!Start a run and return immediately
resume-run!Resume a paused run by conversation id
subscribeSubscribe from :since; returns an unsubscribe function
stop!Register cancellation; wait for the terminal event
run-statusInspect current status and cancellation reason
buffered-eventsRead currently retained events
forget! / purge!Evict a conversation or delete retained events
shutdown!Stop active runs and close subscriptions

Subscriptions and events are transport-neutral. The web module is responsible for SSE encoding, routing, CORS, and HTTP concerns.

Event model

Namespace: im.ttalk.agent.agui.event

Within a conversation, event :seq values are monotonic with no gaps. A run ends with exactly one terminal event. Events are neutral maps such as:

TypeMeaning
:run/startedRun began
:message/startedAssistant or reasoning message began
:message/deltaIncremental text token
:message/thinkingIncremental reasoning token
:message/endedMessage complete
:tool/started / :tool/args / :tool/result / :tool/endedTool lifecycle
:state/snapshot / :state/deltaShared application state
:run/pausedTerminal pause state awaiting approval
:run/finished / :run/cancelled / :run/errorTerminal outcomes

stop! returning true means cancellation was registered, not that execution has already stopped. JVM tools are cooperative; a running tool completes, and the terminal :run/cancelled event is the authoritative signal.

AG-UI integration

  • im.ttalk.agent.agui.codec: neutral events/messages to and from AG-UI payloads; also parses RunAgentInput and builds /info.
  • im.ttalk.agent.agui.tools: package an agent factory and handle AG-UI frontend tools.
  • im.ttalk.agent.agui.registry: named multi-agent registry and lookup.
  • im.ttalk.agent.agui.emit: attach token/filter/LLM callbacks to the event emitter.
  • im.ttalk.agent.agui.state: JSON Pointer lookup and JSON Patch normalization.
  • im.ttalk.agent.agui.thread-store: thread metadata protocol and in-memory or SQLite stores.
  • im.ttalk.agent.agui.event-store: pluggable event retention protocol with an in-memory ring default.

History is server-authoritative. The client-supplied messages array is used only for the final user input; the runtime must not replace persisted server history with client state.

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close