Command reference

Every agent is built from 23 commands. A command is one key in a function's commands object. The key names the command, and the value carries the command's fields. This page lists the commands in the groups the editor uses.

A command can appear more than once in a function. Add a suffix to the key: api, api.2, api.fetchWeather. The suffix is only a name. Commands run in the order they are written.

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

  • promptSets the prompt that is sent to the LLM.
  • llmMakes a large language model call.
  • memoryStores and searches a user's long-term memory.

External systems

  • apiCalls a REST API. Other protocols are not supported.
  • dbRuns a relational database query.

Deep agents

  • searchFinds agents matching a query, optionally filtered by tag.
  • invokeRuns another agent and returns its result.

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 in the UI.

Observability

  • progressSends a progress message to the UI. 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.

Reading a command page

Each command page has the same shape: what the command does, a table of the command's fields generated from the agent schema, an example that runs as written, and the rules that apply. In the tables, a dynamic string is a string that may hold a Python expression in braces (see Syntax and dynamic strings). A command block is a nested object of commands.