Commands
There are 20 commands. Together they cover the agentic workflow: variables, flow control, progress, termination, external systems, LLMs, the user, and output.
Variables
varSets variables in function, agent, or conversation scope.
Flow control
ifRuns one command block or another, based on a condition.whileLoop that repeats as long as the condition remains true.forIterates over the elements of an iterable.breakBreaks out of the innermost loop when the value is true. Only allowed inside 'for' and 'while'.continueStarts the next iteration of the innermost loop when the value is true. Only allowed inside 'for' and 'while'.funcCalls another function.returnReturns from the current function with this value.parallelRuns several of the agent's functions at the same time.
LLM interaction
External systems
Human-in-the-loop
askPauses the agent and asks the user for input.
Agent output
outputAdds text, HTML or images to the agent's output.
Agent termination
endEnds the agent successfully and adds the value to the output. Agent state is saved.failEnds the agent with a failure message. Agent state is not saved. The value is shown to the user by the Search2o application.
Observability
progressStreams a progress message to the UI, that is shown to the user. The message is not part of the agent's output.traceTraces execution. Shown when the agent is validated.logLogs a message on the agent server. A plain string logs to the default logger at info level.
Each command has a page in the Command reference, with a table of its fields generated from the agent schema and an example.
Results
Commands that call something set result for the next command to read. The commands that set it are api, db, llm, func, parallel, ask and memory. Other commands leave result unchanged. The next call overwrites it, so save a result you need later with var.
Error handling on a command
api, db and llm accept an onError block. When the command raises an error, the block runs with exc set to the exception, and the function continues with the next command. Without an onError block on the command, the error goes to the function's onError, and then to the caller.
Where a command may appear
Some commands are restricted. Validation checks the restrictions and follows calls through func and through the functions an llm command offers as tools:
| Context | Not allowed | Why |
|---|---|---|
Inside a for block | ask | A pause cannot be resumed mid-iteration. |
Inside onError | ask | Error handling must complete. |
| A function with a description, which makes it a tool | end | A tool must return to the model. |
| Outside a loop | break, continue | Nothing to break out of. |

