Order of execution
Execution begins in the agent's main function. A function may call other functions with func or parallel, and an LLM may call functions as tools.
Functions and commands
When a function executes, its commands run one after another in the order they are written. A command completes before the next command starts, with one exception: parallel runs several functions concurrently.
Command fields
A command's fields are evaluated in the order they appear. A field may depend only on variables defined before the command, and on fields written earlier in the same command, through the command. namespace.
Flow control
breakandcontinueact on the innermost loop and propagate up throughifblocks.returnleaves the current function, from any depth of loops.endandfailstop the whole agent.- An error that no
onErrorblock handles, on the command or on the function, propagates to the caller and finally fails the agent.
Pausing on ask
When an ask command runs, the agent's complete position is saved with the conversation and the run ends. The position includes the function call chain, the loop iteration and any LLM tool loop in progress. When the user answers, the agent is restored to that position and continues from the ask command. The result of the ask command is now the answers. Commands before the pause are not run again; their variables are restored.
Limits
A run is stopped when the run exceeds the maximum agent runtime. An LLM call is refused once the run's spend passes the maximum LLM cost. Long loops yield periodically so that these limits can be enforced while the loop runs.

