Steps: Plan, Run, Agent, Ask
Last validated: 2026-05-14
This page covers high-level orchestration primitives used for dynamic planning, delegated execution, autonomous loops, and human input.
plan
Generates an executable plan artifact (usually via LLM) from task/context inputs.
plan "Generate execution plan" with llm
task = task
tools = ["file_read", "grep", "shell_exec", "file_write"]
context = codebase_summary.text
model = "gpt-4o"
max_steps = 10
validate = true
-> missionSyntax:
plan "Label" with llm
field = expr
field2 = expr
-> bindingrun
Executes a run target by identifier.
run mission
-> execution_resultWith optional additional inputs:
run mission
mode = "safe"
retries = 2
-> execution_resultNotes:
targetis an identifier, not a quoted file path.- Typical pattern is
plan ... -> missionthenrun mission.
agent
Runs an autonomous LLM agent loop with configurable inputs.
agent "Deep research agent" with llm
system = "You are a thorough research analyst."
task = "Research topic: {topic}."
tools = ["web_search", "fetch_url"]
max_iterations = 8
temperature = 0.4
-> researchSyntax mirrors do/plan input style and supports arbitrary key/value fields.
ask
Pauses for human (or external) response and resumes on submitted input.
ask "Review findings"
prompt = "Review the research on {topic}. Approve or reject."
options = ["approve", "revise", "reject"]
timeout = "2h"
max_retries = 2
-> reviewFree-form ask:
ask "Enter API key"
prompt = "Provide the API key for staging"
type = "text"
timeout = "1h"
-> api_keyNumeric/boolean ask:
ask "Set threshold"
prompt = "Enter confidence threshold (0-100)"
type = "number"
default = 80
-> threshold
ask "Enable feature?"
prompt = "Enable the experimental feature?"
type = "boolean"
default = true
-> enabledAccess resumed value as binding.value in downstream expressions.
Human-In-The-Loop Pattern
agent "Draft report" with llm
task = "Create report for {topic}"
-> report
ask "Approve report"
prompt = "Approve this report?\n\n{report.text}"
options = ["approve", "request_changes", "reject"]
-> decision
decide "Handle decision" with rules
when decision.value == "approve" -> "Done"
when decision.value == "request_changes" -> "Revise"
otherwise -> "Rejected"
"Revise":
ask "Provide edits"
prompt = "What should change?"
type = "text"
-> edits
agent "Revise report" with llm
task = "Revise report: {report.text}\nFeedback: {edits.value}"
-> revised
emit "Revised"
result = revised.text
"Done":
emit "Approved"
result = report.text
"Rejected":
emit "Rejected"
result = "Rejected by reviewer"Practical Guidance
- Keep
planoutputs bounded (max_steps, validation flags) to avoid unbounded dynamic scripts. - Feed
runwith validated plan outputs rather than ad-hoc identifiers. - Constrain
agentwith tool allowlists and iteration caps. - Pair
askwithcheckordecideso every review response has explicit routing.