Workflows
Explicit, user-invoked multi-step execution pipelines with agents, completion conditions, and artifact passing.
Workflows define multi-step execution pipelines with agents, completion conditions, and artifact passing. They are explicit, user-invoked constructs, not the default path for ordinary Weave usage.
Workflow Declaration
Section titled “Workflow Declaration”Workflows are declared using the workflow block in your .weave configuration:
workflow secure-feature { description "Plan, implement, build, and review a feature with security audit" version 1
step plan { name "Create implementation plan" type autonomous agent pattern prompt "Create a detailed implementation plan for: {{instance.goal}}"
completion plan_created { plan_name "{{instance.slug}}" }
outputs [ { name "plan_path" description "Path to the generated plan file" } ] }
step review-plan { name "Review the plan" type interactive agent shuttle prompt "Review the plan at {{artifacts.plan_path}} for: {{instance.goal}}" completion user_confirm }
step implement { name "Execute the plan" type autonomous agent shuttle prompt "Execute the plan at {{artifacts.plan_path}} for: {{instance.goal}}"
completion plan_complete { plan_name "{{instance.slug}}" }
inputs [ { name "plan_path" description "Path to the plan to execute" } ] }
step security-review { name "Security audit" type gate agent warp prompt "Perform a security audit of all changes for: {{instance.goal}}" completion review_verdict on_reject pause }}Workflow Fields
Section titled “Workflow Fields”| Field | Type | Required | Description |
|---|---|---|---|
description |
string | no | Human-readable description of the workflow’s purpose |
version |
number | yes | Schema version for future migration; must be ≥ 1 |
steps |
step blocks | yes | Ordered list of steps; at least one step is required |
extension_points |
block | no | Declares which named extension slots this workflow publishes |
Step Types
Section titled “Step Types”Each step in a workflow has a type that determines its execution mode:
| Type | Meaning |
|---|---|
autonomous |
Agent works alone without user intervention |
interactive |
User can intervene during execution |
gate |
Approve/reject checkpoint; execution pauses for a verdict |
Step Fields
Section titled “Step Fields”| Field | Type | Required | Description |
|---|---|---|---|
name |
string | yes | Display name for the step (inner name property) |
type |
enum | yes | Execution mode: autonomous, interactive, or gate |
agent |
identifier | yes | Name of the agent that runs this step |
prompt |
string | yes | Instruction sent to the agent; may contain {{template}} variables |
completion |
method | yes | How the step signals that it is done |
inputs |
array | no | Named artifacts this step consumes from a previous step |
outputs |
array | no | Named artifacts this step produces for downstream steps |
display_name |
string | no | Human-readable display name for the step. In DSL syntax, the block name becomes name and the inner name property becomes display_name. |
role |
planning |
no | Optional step role hint. Currently only "planning" is supported. |
prompt_append |
string | no | Inline text appended after the step’s primary prompt. Mutually exclusive with prompt_append_file. |
prompt_append_file |
string | no | Path to a file appended after the step’s primary prompt. Mutually exclusive with prompt_append. |
on_reject |
enum | no | Behavior when a gate step rejects (only valid for type: gate) |
insert_before |
string | no | Position this step before the named anchor step (extension workflows only) |
insert_after |
string | no | Position this step after the named anchor step (extension workflows only) |
Completion Methods
Section titled “Completion Methods”The completion field declares how a step signals that it is done. There are five completion methods:
agent_signal
Section titled “agent_signal”The agent emits an explicit done signal. Used for autonomous steps that complete programmatically.
completion agent_signaluser_confirm
Section titled “user_confirm”The user explicitly approves the step outcome. Used for interactive steps requiring human confirmation.
completion user_confirmplan_created
Section titled “plan_created”The agent writes a named plan file. The engine validates that the plan file exists at the specified path.
completion plan_created { plan_name "{{instance.slug}}"}plan_complete
Section titled “plan_complete”The agent finishes executing a named plan. The engine validates that the plan file has no remaining - [ ] checkboxes.
completion plan_complete { plan_name "{{instance.slug}}"}review_verdict
Section titled “review_verdict”A gate agent returns an approve or reject decision. Only valid for type: gate steps.
completion review_verdictWhen a review_verdict signal arrives with approved: false, the engine reads the step’s on_reject field and applies the corresponding policy.
Artifact Passing
Section titled “Artifact Passing”Artifacts flow between steps through explicit inputs and outputs declarations. Both name and description are required for each artifact.
Declaring Outputs
Section titled “Declaring Outputs”A step declares artifacts it produces using the outputs array:
outputs [ { name "plan_path" description "Path to the generated plan file" }]When the step completes successfully, the engine validates that every declared artifact is present before advancing to the next step.
Declaring Inputs
Section titled “Declaring Inputs”A step declares artifacts it consumes using the inputs array:
inputs [ { name "plan_path" description "Path to the plan to execute" }]Before dispatching the step, the engine validates that every declared input artifact is already present in the instance’s artifact store.
Using Artifacts in Prompts
Section titled “Using Artifacts in Prompts”Artifact names are available as template variables in downstream step prompts:
prompt "Review the plan at {{artifacts.plan_path}} for: {{instance.goal}}"Available template variables include:
{{instance.goal}}- the human-readable goal for this execution{{instance.slug}}- the URL-safe slug for this execution{{artifacts.<name>}}- artifact values produced by previous steps
Gate Steps and on_reject
Section titled “Gate Steps and on_reject”Gate steps (type: gate) are approval checkpoints. When a gate step rejects, the on_reject field determines what happens next.
| Value | Behavior |
|---|---|
pause |
Halts execution for user intervention |
fail |
Terminates the workflow |
retry |
Re-runs the step |
The on_reject field is only valid on type: gate steps. Setting it on an autonomous or interactive step causes a validation error.
step security-review { name "Security audit" type gate agent warp prompt "Perform a security audit of all changes for: {{instance.goal}}" completion review_verdict on_reject pause}When on_reject is absent and a gate rejects, the engine defaults to pause behavior.
Workflow Extension
Section titled “Workflow Extension”Workflows can be extended by inserting additional steps at specific positions. This is useful for adding organization-specific checks or enriching planning inputs.
Publishing Extension Points
Section titled “Publishing Extension Points”A workflow declares that it exposes extension slots using the extension_points block:
workflow plan-and-execute { description "Research, plan, implement, and review a feature end-to-end" version 1
extension_points { before-plan }
step research { name "Research the codebase and external context" type autonomous agent thread prompt "Explore the codebase to understand the relevant area for: {{instance.goal}}" completion agent_signal }
step plan { name "Create implementation plan" role planning type autonomous agent pattern prompt "Create a detailed implementation plan for: {{instance.goal}}" completion plan_created { plan_name "{{instance.slug}}" } outputs [ { name "plan_path" description "Path to the generated plan file" } ] }}Key invariants:
extension_points { before-plan }is the only publication syntax in v1- A workflow that publishes
before-planmust contain exactly one step withrole planning - The
before-planslot enriches planning inputs; it does not replace the planning step
Composing Extension Steps
Section titled “Composing Extension Steps”The extend before-plan directive inserts steps into the before-plan slot of any workflow that publishes it:
extend before-plan ["write-spec", "review-spec"]This is a composition directive, separate from the extension_points publication syntax. The listed step names are inserted into the before-plan slot in the order declared.
v1 contract: There is exactly one global before-plan bucket. The same step list is applied to every workflow that publishes extension_points { before-plan }. Multiple extend before-plan directives in the same config are union-merged into a single ordered step list.
Step Insertion Directives
Section titled “Step Insertion Directives”Individual steps can specify their position relative to anchor steps using insert_before or insert_after:
step write-spec { name "Write specification" type autonomous agent pattern prompt "Write a detailed specification for: {{instance.goal}}" completion agent_signal insert_before "plan" outputs [ { name "spec_path" description "Path to the specification document" } ]}These directives are mutually exclusive: a step cannot specify both insert_before and insert_after.
Complete Example with Walkthrough
Section titled “Complete Example with Walkthrough”Here is a complete workflow that demonstrates all major features:
workflow secure-feature { description "Plan, implement, build, and review a feature with security audit" version 1
extension_points { before-plan }
step research { name "Research the codebase" type autonomous agent thread prompt "Explore the codebase to understand: {{instance.goal}}" completion agent_signal }
step plan { name "Create implementation plan" role planning type autonomous agent pattern prompt "Create a detailed implementation plan for: {{instance.goal}}"
completion plan_created { plan_name "{{instance.slug}}" }
outputs [ { name "plan_path" description "Path to the generated plan file" } ] }
step review-plan { name "Review the plan" type interactive agent shuttle prompt "Review the plan at {{artifacts.plan_path}} for: {{instance.goal}}" completion user_confirm
inputs [ { name "plan_path" description "Path to the plan to review" } ] }
step implement { name "Execute the plan" type autonomous agent shuttle prompt "Execute the plan at {{artifacts.plan_path}} for: {{instance.goal}}"
completion plan_complete { plan_name "{{instance.slug}}" }
inputs [ { name "plan_path" description "Path to the plan to execute" } ] }
step security-review { name "Security audit" type gate agent warp prompt "Perform a security audit of all changes for: {{instance.goal}}" completion review_verdict on_reject pause }}Walkthrough
Section titled “Walkthrough”-
Research step (
autonomous): Thethreadagent explores the codebase autonomously. When it emits anagent_signal, the workflow advances automatically. -
Plan step (
autonomous,role: planning): Thepatternagent creates an implementation plan. Theplan_createdcompletion method validates that a plan file exists at.weave/plans/{{instance.slug}}.md. The step produces aplan_pathartifact for downstream steps. -
Review plan step (
interactive): Theshuttleagent presents the plan for review. The step consumes theplan_pathartifact via the{{artifacts.plan_path}}template variable. Execution pauses until the user explicitly confirms viauser_confirm. -
Implement step (
autonomous): Theshuttleagent executes the plan. Theplan_completecompletion method validates that the plan file has no remaining- [ ]checkboxes. The step consumes theplan_pathartifact as an input. -
Security review step (
gate): Thewarpagent performs a security audit. Thereview_verdictcompletion method expects an approve/reject decision. If the gate rejects,on_reject: pausecauses the workflow to pause for user intervention rather than failing immediately.
Extension Example
Section titled “Extension Example”To add a specification step before planning:
step write-spec { name "Write specification" type autonomous agent pattern prompt "Write a detailed specification for: {{instance.goal}}" completion agent_signal outputs [ { name "spec_path" description "Path to the specification document" } ]}
step review-spec { name "Review specification" type gate agent weft prompt "Review the specification at {{artifacts.spec_path}} for: {{instance.goal}}" completion review_verdict on_reject pause inputs [ { name "spec_path" description "Path to the specification to review" } ]}
extend before-plan ["write-spec", "review-spec"]The resolved step order becomes:
research(inherited from base workflow)write-spec(inserted intobefore-planslot, producesspec_path)review-spec(inserted intobefore-planslot, consumesspec_path, gate must approve)plan(canonical planning step withrole: planning)review-plan(inherited from base workflow)implement(inherited from base workflow)security-review(inherited from base workflow)
The reviewed specification artifact can be passed to the planning step by adding it to the plan step’s inputs array.
Execution Semantics
Section titled “Execution Semantics”Step Ordering
Section titled “Step Ordering”Steps are executed in declaration order. The steps array in the workflow configuration is the authoritative sequence. There is no branching or conditional routing; step order is fixed by the DSL declaration.
Artifact Validation
Section titled “Artifact Validation”-
Outputs: When a step completes successfully, the engine validates that every artifact named in
step.outputsis present. Validation is all-or-nothing: a missing artifact returns a validation error before any state changes. -
Inputs: Before dispatching a step, the engine validates that every artifact named in
step.inputsis already present in the instance’s artifact store. A missing input artifact returns a not-found error before the dispatch effect is emitted.
Completion Method Validation
Section titled “Completion Method Validation”When a step completes, the engine validates the completion signal against the step’s declared completion.method. A method mismatch returns a validation error before any state changes.
Security Invariants
Section titled “Security Invariants”- Step completion signals structurally exclude raw prompts, completions, transcripts, credentials, and tokens
- Only safe metadata (outcome, method, approved, message, artifacts, nextStepHint) is accepted
- Prompt metadata in run-agent effects carries only byte length, no raw prompt text
- All lifecycle inputs are validated against a credential denylist before any state changes
Related Documentation
Section titled “Related Documentation”- DSL Configuration - Complete
.weavesyntax reference - Agents - Agent roles and capabilities
- Prompt Composition - How workflow prompts are composed