Skip to content

feat(composition): allow sub-workflows in for_each groups (#102)#110

Open
PolyphonyRequiem wants to merge 4 commits intomicrosoft:mainfrom
PolyphonyRequiem:feat/for-each-workflows
Open

feat(composition): allow sub-workflows in for_each groups (#102)#110
PolyphonyRequiem wants to merge 4 commits intomicrosoft:mainfrom
PolyphonyRequiem:feat/for-each-workflows

Conversation

@PolyphonyRequiem
Copy link
Copy Markdown
Member

Summary

Removes the validator restriction that prevented type: workflow agents in for_each groups, enabling dynamic fan-out to sub-workflows.

Closes #102

Example

for_each:
  - name: plan_issues
    source: epic_planner.output.issues
    as: issue
    max_concurrent: 1
    agent:
      type: workflow
      workflow: ./plan-and-review.yaml
      input_mapping:
        work_item_id: "{{ issue.id }}"
        title: "{{ issue.title }}"

Changes

  • Remove validator rejection of workflow agents in for_each groups
  • Wire up for_each execution to call _execute_subworkflow() for workflow agents
  • Emit subworkflow_started/subworkflow_completed events per iteration
  • Tests included

Dependency

Builds on #101 (input_mapping) — PR #109. Foundation for #103 (self-referential workflows).

Daniel Green and others added 2 commits April 20, 2026 14:39
…rosoft#101)

Add input_mapping field to AgentDef for type='workflow' agents. When
present, each value is a Jinja2 expression rendered against the parent
context to build sub-workflow inputs. When absent, existing behavior
(forwarding parent's workflow.input.*) is preserved.

- Schema: Add input_mapping to AgentDef with validation for workflow-only
- Engine: Render input_mapping templates in _execute_subworkflow()
- Tests: Schema validation for all agent types
- Experimental workflows: test-input-mapping parent/child pair

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
)

Remove validator restriction blocking type='workflow' in for_each groups.
Wire execute_single_item() to call _execute_subworkflow_with_inputs()
for workflow agents, rendering input_mapping with loop variables in scope.

- Validator: Remove workflow rejection in for_each validation
- Engine: Add workflow branch in execute_single_item(), new helper
  _execute_subworkflow_with_inputs() for pre-built inputs
- Tests: Update test_workflow_in_for_each to validate (not reject)
- Experimental workflows: test-for-each-workflow parent/child pair

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@PolyphonyRequiem
Copy link
Copy Markdown
Member Author

Converted to draft — lint check failing. Schema and type check pass. Needs lint fixes before merging. Depends on PR #109 (input_mapping) landing first.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 21, 2026

Codecov Report

❌ Patch coverage is 38.23529% with 21 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@873c72b). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/conductor/engine/workflow.py 19.23% 21 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #110   +/-   ##
=======================================
  Coverage        ?   84.66%           
=======================================
  Files           ?       53           
  Lines           ?     7195           
  Branches        ?        0           
=======================================
  Hits            ?     6092           
  Misses          ?     1103           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@PolyphonyRequiem PolyphonyRequiem marked this pull request as ready for review April 21, 2026 21:40
- Remove json.loads coercion from input_mapping rendering (values stay
  as strings; use {{ expr | json }} filter for structured data)
- Add error context identifying which input_mapping key failed to render
- Fix falsy check: use 'is not None' instead of truthiness for input_mapping
- Deduplicate _execute_subworkflow_with_inputs into _execute_subworkflow
  with an optional sub_inputs parameter

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

feat(composition): allow sub-workflows in for_each groups

2 participants