Skip to content
Français

Pass data and compose recipe steps

Use typed inputs, dependency results, conditions and one workspace per branch.

Keep outpost.yaml from the local tutorial and replace recipe.yaml with the first example. These tasks transform data and allocate no sandbox.

$input reads a typed input; $step reads a completed task. Every task you read must appear directly in after. The input schema checks the object before execution. when skips envelope when the file list is empty.

version: 3
name: select-files
inputs:
  changes:
    type: object
    description: Files to inspect.
    default: { files: [src/index.ts] }
    schema:
      type: object
      properties:
        files: { type: array, items: { type: string } }
      required: [files]
      additionalProperties: false
tasks:
  - key: select
    value: { $input: changes, path: [files] }
  - key: envelope
    after: [select]
    when:
      ne: [{ $step: select, path: [value] }, []]
    value:
      files: { $step: select, path: [value] }

Run with a JSON input. The report’s outputs.envelope.value.files contains ["a.ts"].

npx outpost recipe run --file recipe.yaml --config outpost.yaml \
  --input 'changes={"files":["a.ts"]}' --json

Use typed references in data expressions and text interpolation in briefs or command arguments. Interpolated data is expanded once.

NeedExample
A typed input{ $input: changes, path: [files] }
A task’s JSON value{ $step: select, path: [value] }
Command output as text"Output: {{ steps.check.stdout }}"
An agent’s final answer"Review: {{ steps.review.text }}"
An opaque literal object{ $literal: { $input: unchanged } }

Conditions support eq, ne, gt, gte, lt, lte, in, exists, all, any and not. The editor schema suggests their shapes. A result reference passes data; it does not continue an agent conversation.

For two independent changes in ./project, use these complete files. Prepare the Codex image and account access first. Each isolated task owns a workspace and sandbox; the branches remain separate after completion.

version: 3
name: parallel-changes
workflow:
  concurrency: 2
tasks:
  - key: docs
    isolated:
      repository: ./project
      sandboxProvider: { $ref: sandboxProviders.container }
      agent: { $ref: agents.coder }
      branch: { mode: named, name: feature/docs, from: main }
      brief: { text: Improve the README and commit the changes. }
  - key: tests
    isolated:
      repository: ./project
      sandboxProvider: { $ref: sandboxProviders.container }
      agent: { $ref: agents.coder }
      branch: { mode: named, name: feature/tests, from: main }
      brief: { text: Add regression tests and commit the changes. }

The local configuration supplies the shared provider declaration and agent. The top-level workspace selects Git mode; these isolated tasks allocate only their own workspaces, using the repository declared on each task. Relative repository paths start at outpost.yaml.

version: 3
workspace:
  kind: git
  repository: ./project
  branch: { mode: named, name: orchestration, from: main }
sandbox: { provider: local }
sandboxProviders:
  container:
    type: docker
    image: outpost-codex:dev
agents:
  coder:
    harness: codex
    authentication: account

Run with the same recipe run command, omitting --input. Use different repository paths for a multi-repository workflow. Integration, when requested, is independent per repository; there is no shared Git transaction.

A loop task repeats an agent attempt until its check accepts the work, for at most maxRounds rounds. The attempt and the check run in the configured workspace, like agent and command tasks. This recipe uses the coder role of the configuration above, with workspace set to your project.

version: 3
name: fix-until-green
inputs:
  goal: { type: string, description: The change to implement. }
tasks:
  - key: fix
    loop:
      maxRounds: 3
      attempt:
        agent: coder
        brief: "Implement this change and commit it: {{ inputs.goal }}"
        conversation: continue
      check:
        command: { executable: npm, arguments: [test] }
  - key: summary
    after: [fix]
    value: "{{ steps.fix.text }} after {{ steps.fix.rounds }} rounds"

The check accepts the attempt when npm test exits with status 0. Otherwise its exit status and the last 4,000 characters of stdout and stderr become the feedback of the round; a command that exceeds its deadlineMs also fails the check, with the output seen so far. The command output is observed like a command task.

Later rounds send followUp when you declare it. Otherwise, conversation: continue sends a built-in message containing the feedback in the attempt’s conversation, and the default conversation: new sends the brief again in a new conversation. To let another agent decide, replace the command with check: { agent: reviewer, brief: "Review the last commit: {{ loop.text }}" }: Outpost asks it for a { done, feedback } answer in a new conversation each round.

outputs.fix holds the last attempt’s text, conversation and value, the commits of every round and rounds. To chain several agents and commands in each phase, decide from a typed review or configure each agent’s dispatch, see loop steps.

Add this top-level block to a recipe whose tasks may run concurrently. Task-level options can also set retries and deadlines; see TaskOptions and WorkflowOptions.

workflow:
  concurrency: 2
  stopOnError: false
  budget: { attempts: 10 }

Ordinary command and agent tasks share the configured workspace. Order them with after; validation refuses overlapping use of that shared workspace. Use isolated tasks for independent work.

Continue with local callbacks and callback loops, structured agent answers or checkpoints.