Skip to content

AgentStreamEvent

AgentStreamEvent = { delta: string; type: "text"; } | { type: "reasoning_start"; } | { delta: string; type: "reasoning_delta"; } | { type: "reasoning_end"; } | { id: string; name: string; type: "tool_start"; } | { delta: string; id: string; type: "tool_args"; } | { id: string; type: "tool_end"; } | { chunk: string; id?: string; isNotice?: boolean; name: string; type: "tool_output"; } | { content: string; id: string; isError?: boolean; raterClarification?: boolean; type: "tool_result"; }

Defined in: _worktrees/docs-release/gaunt-sloth/packages/core/src/core/types.ts:119

Typed events emitted by the agent’s GthAgentInterface#streamWithEvents path. This is the renderer contract shared by every consumer of an agent run — the AG-UI SSE encoder, the (future) TUI, and any embedder — so it is intentionally agnostic of how the underlying graph was built.

{ delta: string; type: "text"; }


{ type: "reasoning_start"; }


{ delta: string; type: "reasoning_delta"; }


{ type: "reasoning_end"; }


{ id: string; name: string; type: "tool_start"; }


{ delta: string; id: string; type: "tool_args"; }


{ id: string; type: "tool_end"; }


{ chunk: string; id?: string; isNotice?: boolean; name: string; type: "tool_output"; }

chunk: string

One verbatim streamed chunk of the child’s stdout/stderr (or the notice text).

optional id?: string

The tool call this chunk belongs to (LangChain’s ToolRunnableConfig.toolCall.id, threaded through the toolkits), so a renderer can nest output under the exact call — TUI-C30 consumes this for per-call output previews. Optional only defensively: absent when the executing framework did not supply a tool call, in which case consumers should fall back to name attribution.

optional isNotice?: boolean

True when this chunk is the “🔧 Executing …” announcement rather than child output, so a richer renderer (TUI-C30) can style or strip it when previewing raw output lines.

name: string

The gth tool name (e.g. run_shell_command, a custom tool’s name). Always known.

type: "tool_output"

TUI-C17 — one live output chunk from an EXECUTING tool (a custom/dev toolkit child process’s stdout/stderr, or its “Executing …” announcement), surfaced through the managed event stream instead of raw process.stdout so a renderer (the Ink TUI) can fold it into its view-model. Emitted by the tool-output channel merge (see core/toolOutputChannel.js#mergeToolOutputIntoEvents), NOT by processEventStream itself — consumers that don’t opt into the merge (e.g. the AG-UI SSE encoder) never see it and the toolkits keep writing to stdout for them (today’s headless behaviour).


{ content: string; id: string; isError?: boolean; raterClarification?: boolean; type: "tool_result"; }

content: string

id: string

optional isError?: boolean

True when the underlying ToolMessage.status is 'error' (LangChain’s real tool-result error signal). Absent/undefined means success — consumers must not sniff the result text to infer failure. Optional for backward compatibility with producers that predate the field.

optional raterClarification?: boolean

[[TUI-C69]] §5.4 — this result is the auto-rater asking the agent to narrow the call, not a tool that failed. A round-1 rejection is the middle of a working negotiation, and on the happy path the very next round succeeds.

Additive, and isError stays true beside it. The error status is the real LangChain signal and three readers grade on it — the model, which must know the call did not run; gth eval’s must_error tool-result assertions; and the ACP bridge’s failed status. Clearing it to fix the rendering would quietly rewrite all three. This field is display-only: it says how to TONE the row, never what happened to the call.

Set from the gate’s own decision, threaded on the call’s id — never from the result text, because legitimate output may begin with “Error handling…”.

type: "tool_result"