Skip to main content

Events

Run events​

Subscribe with app.onEvent(handler), or onEvent in the catalog runner's options. Every event has type, runId and timestamp.

typeExtra fieldsWhen
node_startednodeIdA node starts.
node_completednodeId, outputA node finishes; output is the update it returned.
node_failednodeId, error, attempt, categoryA node threw. With a retryPolicy, once per attempt.
node_error_routednodeId, toNodeId, errorEdgeId, error, categoryRetries are spent and the run follows an error edge.
run_suspendednodeId, reasonThe run stopped: human-gate, interrupt (tool approval), timer or signal.
run_resumednodeIdA suspended run continues.
run_completedfinalStateThe run finished.
run_failederrorThe run failed.
run_cancellednodeIdThe run was cancelled before nodeId.
token_deltanodeId, messageId, delta, parentRunId, spawnIdA model token, when token streaming is on. parentRunId and spawnId are set only for a mapAgents sub-agent. Not saved in checkpoints.
spawn_startednodeId, spawnId, itemIndex, itemA mapAgents sub-agent starts on one item of its list. Not saved in checkpoints.
spawn_completednodeId, spawnId, itemIndex, output, usageThat sub-agent finished: output is its result, usage its tokens. Not saved in checkpoints.
spawn_failednodeId, spawnId, itemIndex, errorThat sub-agent's model call failed; the node goes on. Not saved in checkpoints.
spawn_suspendednodeId, spawnId, itemIndex, reasonThat sub-agent needs an approval and the node suspends. Not saved in checkpoints.

spawnId is the item's index in the list, the same id as that sub-agent's token_delta events. Each sub-agent sends spawn_started before its one closing event; sub-agents run at the same time, so events of different sub-agents can come in any order. A mapAgents node whose list channel holds something other than a list (a string, an object, a number) fails with node_failed; an absent, null or empty list runs no sub-agent.

category classifies a failure, so an error branch can treat a transient error (a timeout) and a permanent one differently.

Values of channels marked noLog: true are masked in every event.

Stream events​

app.stream(input, mode) yields one of these, depending on mode:

ModetypeFields
"messages"message_deltadelta (text), nodeId, messageId
"messages"tool_calltoolId, input, nodeId: a tool call the model made
"updates"state_updatenodeId, delta (the channels the node changed)
"values"state_valuestate (the full state)
"debug"debugnodeId, payload (a run event)

See Streaming.