Skip to main content

Run Agent

Controlled node

Overview

The Run Agent node runs a streaming AI conversation when it receives an action whose type is userMessage. It reads any existing messages from a named workflow variable, appends the user message, generates a response, writes the updated history back to that variable, and emits streaming updates while generation is in progress.

All model-tier choices currently use KIMI_K2_6. The two non-reasoning tiers disable reasoning; intermediate reasoning uses medium effort and advanced reasoning 2 uses high effort.

Tool execution is unfinished

The editor exposes Tools and the backend contains partial tool-call states, but the tools input is not currently passed to the model and the tooling state has no implementation. Do not build a production tool loop around this node until that path is completed and tested.

Inputs

InputTypeDescriptionDefault
RunEventInvokes the node's state machine.-
VariableTextPath of the workflow variable used to read and persist conversation messages. If omitted, messages are not persisted.-
System PromptTextInstructions prepended to the conversation sent to the model.You are a helpful assistant.
ActionDataAn action object. userMessage starts generation; the toolApprove and toolDeny paths are incomplete.-
ToolsDataReserved for agent tool definitions. The current backend reads this input but does not pass it into generation.-
ModelEnumReasoning tier: ultraLight, standard, intermediateReasoning, or advancedReasoning2.standard
Max TokensNumberMaximum generated tokens. Non-numeric values fall back to 5000.5000
TemperatureNumberSampling temperature. Non-numeric values fall back to 0.7.0.7

Outputs

OutputTypeDescription
Message StreamDataAccumulated generated content during streaming. The final streaming update is the accumulated result object.
StreamEventFires as streamed content is accumulated and once more after the generation queue is drained.
ToolEventIntended to fire when a model tool call needs handling. The surrounding tool workflow is incomplete.
Tool CallDataThe first pending tool-call object, when the model returns one.
ToolDataBackend-only approved tool-call value; the current editor does not draw a separate data socket for it.
MessagesDataUpdated conversation history after a generation completes without a pending tool call.
DoneEventFires after successful generation when there is no pending tool call. It is conditional while the node repeats or suppresses completion.

Runtime behavior

  1. In the idle state, a userMessage action is appended to the selected message variable.
  2. The node starts a streaming request and repeats across workflow ticks while chunks arrive.
  3. Message Stream and Stream update during generation.
  4. When generation finishes, the assistant message is appended to the history and Messages is set.
  5. If there is no pending tool call, Done fires and the node returns to idle.

Generation errors are recorded internally, but the current error branch does not expose an error output or reset the state. Treat missing completion as a failure condition in workflows that use this node.

Example

For the currently implemented basic-chat path:

  1. Create a workflow variable such as chatHistory containing an empty array.
  2. Set Variable to chatHistory.
  3. Send { "type": "userMessage", "data": "Hello" } to Action and trigger Run.
  4. Use Message Stream with the Stream event for live display.
  5. Read Messages after Done to obtain the persisted conversation history.