agentcmd
ConceptsWorkflows

Workflow Runs

Learn how the pieces fit together when creating a workflow run.

New to workflows? Start with How It Works to understand specs and workflows first.

What is a Workflow Run?

A workflow run is a single execution of a workflow. When you create a workflow run, you're asking agentcmd to:

  1. Take a spec (what to build)
  2. Execute a workflow (how to build it)
  3. Make changes in a git workspace (where to build it)

The workflow run ties these three pieces together.

When you create a workflow run, the system determines which workflow to execute based on spec type:

  • Feature specimplement-feature.ts
  • Bug specfix-bug.ts
  • Issue specresolve-issue.ts

The system looks for these files in .agent/workflows/definitions/. If the workflow doesn't exist, you'll see an error.

Creating a Workflow Run

When you create a workflow run, you provide two inputs:

Spec

The spec defines what needs to be built. There are three ways to provide it:

MethodWhat HappensUse When
Select FileSelect existing spec from .agent/specs/ (see Specs)You already have a spec ready
From Planning SessionAI analyzes planning session transcript → generates spec → executes workflowYou've had a planning discussion and want to proceed
Write CustomWrite markdown → AI generates full spec → executes workflowYou have clear requirements and want quick implementation

Example "Write Custom" input:

# Add CSV Export

Add export to CSV button on users table.
Include all visible columns and respect filters.

All three methods create a spec that drives the workflow.

Git Workspace

The git workspace determines where changes happen.

Branch

Creates a new branch for the work.

  • Isolated from current branch
  • Easy to review and rollback
  • Requires branch switching

Best for: Most workflows

Worktree

Creates a worktree in separate directory.

  • No branch switching
  • Run multiple workflows simultaneously
  • Requires cleanup

Best for: Concurrent workflows

Stay

Works directly in your current branch.

  • No overhead
  • Changes mix with your work
  • Hard to separate AI changes

Best for: Quick fixes

Execution Lifecycle

When you trigger a workflow run, here's what happens:

Flow:

  1. Create Run - User selects spec + workspace in UI
  2. Trigger - System sends event to Inngest
  3. Queue - Inngest queues the workflow function
  4. Execute - Steps run sequentially, each checkpointed
  5. Update - UI shows live progress via WebSocket
  6. Complete - Success/failure recorded, artifacts saved

Real-Time Updates

WebSocket events keep the UI in sync:

  • Step start/complete - Timeline updates
  • Output streaming - Logs appear live
  • Annotations - Progress markers
  • Artifacts - Files/images uploaded

This means you can watch workflows execute in real-time, even from your phone (see Access Anywhere).

Putting It Together

When you create a workflow run:

  1. Spec defines what to build (from file, planning, or markdown)
  2. Spec type determines the slash command to execute
  3. Git workspace determines where changes happen
  4. Workflow executes, making commits in the chosen workspace

Example:

Planning session "OAuth Implementation" + Feature spec + Branch mode

Result:

  • Generates feature spec from planning
  • Executes implement-feature.ts
  • Creates branch, commits changes, returns to original branch

Next Steps