llm
Sends the current prompt to a large language model and returns the model's answer. With functions or mcp set, the model can call tools, and the command runs the tool loop for you.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
onError | command block | Commands to run if this command raises an uncaught error. | |
profilerequired | string | The LLM profile, which defines the vendor, model and call parameters. | |
prompt | dynamic string | The prompt for this call. Needed only when the agent uses more than one prompt. | |
functions | list of name | Functions the LLM may call as tools. | |
mcp | list of string | MCP tools used in this LLM call. Each element should be in the form MCP_NAME.TOOL_NAME. | |
vendorTools | list of string or integer or number or boolean or list of SafeJsonValue or object of string → SafeJsonValue | Tools provided by the vendor and executed on the vendor side. Passed unchanged to the LLM provider. | |
maxToolCallLoops | integer | 10 | The maximum number of tool-calling rounds. |
timeout | integer | 60 | LLM timeout in seconds. This timeout applies separately to each call during multi-step tool calling. |
outputFormat | "default" | "structured" | "default" | 'default' or 'structured'. With 'structured', the first tool call is returned as a dict, shaped by the function named in 'functions'. |
streamOutput | boolean | false | Streams the LLM's text and image output to the user. Off by default. |
Result
By default the result is the model's text answer, as a string. With outputFormat: "structured", the model is expected to answer with a tool call. The result is then a dict of { functionName: arguments }, shaped by the function's declared args. A function call gives typed output without parsing text. With streamOutput: true, the text and any images the model produces are also streamed straight to the user as part of the agent's output.
Tool calling
functions lists the functions of this agent that the model may call. Each function needs a description and typed args, because the model sees those. When the model asks for a call, the function runs with the model's arguments. The function's return value goes back to the model. The loop repeats until the model answers with text or maxToolCallLoops is reached.
mcp lists tools from MCP servers as server.tool, or just server for every tool the server offers. vendorTools passes vendor-defined tools, such as web search, through untouched. The LLM profile caps how many tools one call may carry.
A tool that raises an error is reported to the model as an error, together with the profile's tool error prompt. The model can then correct its arguments or give up gracefully. An ask inside a tool function pauses the agent exactly as anywhere else, and the agent resumes mid-loop when the user answers.
Example
"functions": {
"runQuery": {
"description": "Runs a SQL query against the orders database and returns the rows.",
"args": {
"sql": { "type": "str", "description": "A read-only SQL query." }
},
"commands": {
"db": { "profile": "orders", "sql": "{ sql }" },
"return": "{ result }"
}
},
"main": {
"commands": {
"prompt": {
"system": "You answer questions about orders. The table orders has columns id, status, total and customer_email.",
"user": "{ sys.query }"
},
"llm": {
"profile": "gpt5_mini",
"functions": ["runQuery"],
"streamOutput": true
}
}
}
}Rules
profileis the literal name of an LLM profile. To pick a profile at runtime, branch withif.- The token ceiling, retries, headers and any extra request parameters come from the profile.
- An agent's run is stopped once the run's LLM spend passes the max LLM cost per run in Runtime limits.
endis best avoided inside a tool function. A tool must return to the model.

