Skip to main content
A dynamic workflow is a short TypeScript script that the agent writes for one request. The script splits the work into steps, sends independent steps to helper agents in parallel, and checks each helper’s answer against a schema before the next step uses it. o4 shows you the plan as a step map first, and nothing runs until you approve it. Use a workflow when a task splits into many similar, independent pieces, such as reviewing every changed file, checking each module against a rule, or gathering facts from many places and then summarizing them. For a single focused change, ask the agent directly.

Start a workflow

/workflow <request> starts an ordinary turn. The agent loads the bundled dynamic-workflows skill, picks a helper layout for the request, and calls create_workflow with a script. Your request goes to the agent word for word. You can also just describe a task that splits this way. The agent may choose to write a workflow, and the same approval applies. /workflow with no text opens the run list (see The run list). It works while a turn is running. Before anything runs, o4 analyses the script. If the script has errors, the agent gets the diagnostics with line and column and nothing is executed; it fixes the script and submits it again.

The step map

A valid script opens the step map for your approval, for example (shortened):
It lists each phase in order with its participants ((many) marks a fan-out with one helper per item), what each step reads and returns, how results pass between phases, every shell command the script may run, the sandbox tier, and a rough cost estimate. The estimate is not a limit.

While it runs

An approved workflow runs in the foreground by default. A progress block in the chat shows:
  • the run’s state, elapsed time, tokens, cost and how many helpers are working at once;
  • each phase as done (✓), running (◐) or waiting (○), with counts of done, running, queued and failed steps;
  • the helpers that are working, waiting (for example after a rate limit) or repairing an answer;
  • the script’s last log lines, and the reports and deliverables published so far.
A background run appears in the agent list and in Ringside with its helpers. When it finishes, the chat gets one line, for example:
The main agent also receives the run’s result, reports and deliverables, so it can tell you what was produced. Each helper answer is checked against the schema derived from the script’s types. A wrong answer is sent back for repair up to three times before the step fails. A helper that ends its turn without submitting an answer is reminded once.

Resume an interrupted run

Every step is saved to a journal as it finishes. If o4 exits or is killed while a run is live, the run is marked stopped (interrupted). The next time o4 starts in that project it offers to resume:
A resumed run replays its finished steps from the journal without running them again, and continues with the unfinished ones. It needs no new approval, because it runs the script you already approved. Your permission rules and hooks still apply. A run can be resumed when it is stopped, for any reason other than superseded. A completed run has nothing to resume, and an errored run needs a corrected script in a new run.

The run list

/workflow with no text opens the Workflows pane with this project’s runs, newest first:
The agent can inspect runs too, with list_workflow_runs, get_workflow_run and resume_workflow_run (see the tools reference). o4 -p runs workflows to the end:
  • In the auto (the print default) and bypass permission modes, a workflow starts without a step map, because nobody is there to approve one. In every other mode a workflow is refused with “workflows need approval; run with —permission-mode auto or bypass” and print stops at once. /workflow <request> is then refused before the model is asked, and a create_workflow call from a plain prompt ends print without the model continuing.
  • After the main turn ends, print waits for every run it started, with no timeout. Each finished run is given to the agent as a follow-up turn.
  • stdout carries only the agent’s final answer. stderr gets one line per run event:
    A resumed run says resumed instead of started. A progress line also counts repairing and failed steps when there are any. Progress lines are throttled to one every 400 ms across all runs, while start, log and settle lines always print. A run settles as completed, errored or stopped (<cause>), where the cause is user, model, provider, interrupted or superseded, and its settle line gives the time and cost. A run that ends without a settled result prints workflow '<name>' ended without a result.
  • o4 -p "/workflow" prints this project’s runs (at most 20) without a model turn.
Exit status:

Settings

Workflow settings live under workflow in your user settings (~/.o4/settings.json). They are user-only: a project’s .o4/settings.json cannot change them, so a cloned repository cannot turn workflows on or switch off the script’s confinement. /config shows the current values on its Agents tab.

Permissions

Approving the step map is your consent for the whole run. Helpers then act without asking for each tool call. What still applies:
  • Deny rules. Your permission rules still block matching tool calls. An ask rule is treated as allow, because nobody is there to answer, so use a deny rule to stop an action.
  • PreToolUse hooks still run for helper tool calls.
  • The sandbox tier in force when the run (or its resume) starts applies to helper shell commands for that run. Changing the tier later does not change a running workflow.
  • Commands. A script can only run the commands listed on the step map. They run with a fixed argument list, never through a shell string, and are checked against your deny rules like bash calls.
Helpers can’t ask you questions, start other agents or campaigns, or create, inspect or resume workflows of their own. The workflow script itself runs in a separate process that has no file, network, environment or clock access of its own. It reaches the workspace only through the steps it declares, which o4 carries out. With workflow.confine_child on, o4 also runs that process inside the OS sandbox: sandbox-exec on macOS, or bubblewrap on Linux when it is installed. Elsewhere it runs unconfined and o4 logs that.

Limits

A read or command that goes over its limit fails that step. Nothing is silently cut short. Too many reports fails the run. Deliverables are stored under .o4/workflow-runs/<run id>/ in the project. That folder is ignored by Git. The run journal lives in ~/.o4/sessions.db.