Skip to content

Comments

Add concurrent steps support to workflow definitions#191

Merged
nhorton merged 1 commit intomainfrom
claude/add-concurrent-steps-support-ca2PX
Jan 30, 2026
Merged

Add concurrent steps support to workflow definitions#191
nhorton merged 1 commit intomainfrom
claude/add-concurrent-steps-support-ca2PX

Conversation

@nhorton
Copy link
Contributor

@nhorton nhorton commented Jan 30, 2026

Summary

This PR adds support for concurrent (parallel) step execution in workflow definitions, allowing workflows to specify which steps can run in parallel while maintaining full backward compatibility with existing sequential workflows.

Key Changes

Parser & Data Model

  • Added WorkflowStepEntry dataclass to represent workflow step entries that can be either sequential (single step) or concurrent (multiple steps)
  • Modified Workflow class to use step_entries internally while maintaining a backward-compatible steps property that flattens all step IDs
  • Added helper methods to Workflow: get_step_entry_for_step() and get_entry_index_for_step()

Job Definition API

  • Added get_step_entry_position_in_workflow() method to get entry-based position of a step (useful for concurrent groups where multiple steps share the same position)
  • Added get_concurrent_step_info() method to get a step's position within its concurrent group (returns tuple of position and group size)

Schema & Validation

  • Updated JSON schema to support both string step IDs and arrays of step IDs in workflow definitions
  • Single-item arrays indicate a step with multiple parallel instances (e.g., [fetch_campaign_data] for per-campaign execution)
  • Multi-item arrays indicate steps that execute concurrently (e.g., [task_a, task_b, task_c])

Code Generation

  • Enhanced meta-skill template to render concurrent steps as "Background Task 1/2/3" with clear instructions
  • Updated _build_meta_skill_context() to include step_entries with detailed concurrency information
  • Concurrent steps are rendered with task numbers and descriptions for clarity

Documentation & Examples

  • Updated architecture documentation with concurrent step patterns and examples
  • Added comprehensive test fixture concurrent_steps_job demonstrating a workflow with parallel research phase
  • Updated CHANGELOG with feature description

Backward Compatibility

  • Existing workflows with simple step arrays continue to work unchanged
  • The workflow.steps property provides flattened list of all step IDs for backward compatibility
  • All existing code using step lists continues to function without modification

Testing

  • Added comprehensive test suite covering concurrent step parsing, validation, and code generation
  • Tests verify both the internal step_entries structure and backward-compatible steps property
  • Tests validate meta-skill generation with proper concurrent step rendering

https://claude.ai/code/session_011qMp5U4AFQLMbJQvCE8Ck4

Enable workflows to specify nested arrays of step IDs to indicate steps
that can be executed in parallel. The meta template renders concurrent
step groups as "Concurrent Steps" with numbered "Background Task" items.

Changes:
- Schema: Added STEP_ID_SCHEMA, CONCURRENT_STEPS_SCHEMA, WORKFLOW_STEP_ENTRY_SCHEMA
  - Workflow steps accept either string (sequential) or array (concurrent)
  - Single-item arrays indicate steps with multiple parallel instances
- Parser: Added WorkflowStepEntry dataclass for sequential/concurrent groups
  - Updated Workflow to use step_entries with backward-compatible steps property
  - Added get_step_entry_position_in_workflow() and get_concurrent_step_info()
- Generator: Build step_entries with concurrency info in workflow context
- Template: Render concurrent steps with "Background Task N" formatting
- Tests: Added test fixture and 9 new unit tests
- Docs: Updated architecture.md and CHANGELOG.md

https://claude.ai/code/session_011qMp5U4AFQLMbJQvCE8Ck4
@nhorton nhorton added this pull request to the merge queue Jan 30, 2026
Merged via the queue into main with commit 77402b2 Jan 30, 2026
4 checks passed
@nhorton nhorton deleted the claude/add-concurrent-steps-support-ca2PX branch January 30, 2026 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants