-
Notifications
You must be signed in to change notification settings - Fork 0
Subworkflows #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subworkflows #4
Conversation
- add SubworkflowStep for calling other workflows - enable direct workflow composition with >> operator - track workflow dependencies automatically - support both synchronous and async (fire-and-forget) execution - add input/output parameter mappings - emit workflows.executeWorkflow in YAML - comprehensive tests and examples enables modular workflow design and reusability
feature #3 is now fully implemented with clean API
improve code readability with proper formatting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements subworkflow functionality to enable composition of Cloud Workflows, allowing workflows to call other workflows as steps with proper dependency tracking and code generation.
Key changes:
- Introduces
SubworkflowStepclass for encapsulating subworkflow calls with input/output mappings and wait/fire-and-forget modes - Enhances
WorkflowBuilderto acceptWorkflowobjects via>>operator, automatically converting them toSubworkflowStepinstances - Implements dependency tracking system to maintain relationships between parent and child workflows
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/fastapi_cloudflow/core/subworkflow.py | New SubworkflowStep class for workflow composition |
| src/fastapi_cloudflow/core/workflow.py | Enhanced workflow builder with subworkflow support and dependency tracking |
| src/fastapi_cloudflow/codegen/workflows.py | YAML generation logic for subworkflow calls |
| tests/unit/test_subworkflow.py | Comprehensive unit tests for subworkflow functionality |
| tests/codegen/test_subworkflow_codegen.py | Tests for YAML code generation with subworkflows |
| examples/app/flows/order_with_subworkflow.py | Example demonstrating real-world subworkflow usage |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| # Apply input mapping if specified | ||
| if node.input_mapping: | ||
| mapped_args = {k: _as_yaml_expr(v) for k, v in node.input_mapping.items()} | ||
| args["argument"] = f"${mapped_args}" |
Copilot
AI
Sep 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mapped_args dictionary is being formatted as a string with f\"${mapped_args}\", which will produce invalid YAML syntax. This should use proper YAML expression formatting or direct assignment of the mapped arguments dictionary.
| args["argument"] = f"${mapped_args}" | |
| args["argument"] = mapped_args |
❌ 40 blocking issues (42 total)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the final PR Bugbot will review for you during this billing cycle
Your free Bugbot reviews will reset on October 25
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| if node.input_mapping: | ||
| mapped_args = {k: _as_yaml_expr(v) for k, v in node.input_mapping.items()} | ||
| args["argument"] = f"${mapped_args}" | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Cloud Workflows Argument Mapping Error
The input mapping for SubworkflowStep incorrectly formats arguments for Cloud Workflows. It converts the mapped_args dictionary into a string representation wrapped in a YAML expression, which is invalid syntax. This prevents proper argument passing to subworkflows.
Note
Add
SubworkflowStep, allow composing workflows as steps with YAML codegen (including mappings and async mode), and track/expose workflow dependencies.SubworkflowStepfor calling other workflows; export via__init__.Workflow/WorkflowBuilderto acceptWorkflowin>>, converting toSubworkflowStepand validating IO types.Workflow.dependencies) and exposeget_workflow_dependencies().workflows.executeWorkflowcalls forSubworkflowStep, with support for input/output mappings andwait(fire-and-forget) behavior.examples/app/flows/order_with_subworkflow.pydemonstrating an order flow calling a payment subworkflow.README.mdto mark "Subworkflows" as completed with brief usage note.0.0.3inpyproject.toml.Written by Cursor Bugbot for commit cada93a. This will update automatically on new commits. Configure here.