> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.vellum.ai/developers/workflows-sdk/api-reference/nodes/inline-subworkflow-node/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.vellum.ai/_mcp/server. # Inline Subworkflow Node > Execute subworkflows defined inline within your workflow code. `vellum.workflows.nodes.InlineSubworkflowNode` Used to execute a Subworkflow defined inline within your workflow. This allows you to modularize and reuse workflow logic. ### Attributes **`subworkflow`** `Type[BaseWorkflow[WorkflowInputsType, InnerStateType]]` — required The Subworkflow class to execute --- **`subworkflow_inputs`** `Dict[str, Any]` — required The inputs to pass to the subworkflow --- ### Outputs The outputs of this node are determined by the outputs defined in the subworkflow. Each output from the subworkflow will be streamed through this node. **`Example Usage`** ```python title="Example Usage" from vellum.workflows.nodes import InlineSubworkflowNode from vellum.workflows.inputs.base import BaseInputs from vellum.workflows.state import BaseState from vellum.workflows import BaseWorkflow class SubworkflowInputs(BaseInputs): query: str max_results: int class SubworkflowState(BaseState): pass class MySubworkflow(BaseWorkflow[SubworkflowInputs, SubworkflowState]): # Define your subworkflow logic here pass class MyInlineSubworkflowNode(InlineSubworkflowNode): subworkflow = MySubworkflow subworkflow_inputs = { "query": "search term", "max_results": 10 } ``` **`Complex Example with Multiple Outputs`** ```python title="Complex Example with Multiple Outputs" from vellum import ( InlineSubworkflowNode, BaseWorkflow, BaseInputs, BaseState, ) from typing import List class ProcessingInputs(BaseInputs): text: str categories: List[str] class ProcessingState(BaseState): pass class TextProcessingWorkflow(BaseWorkflow[ProcessingInputs, ProcessingState]): # Subworkflow implementation pass class TextProcessorNode(InlineSubworkflowNode): subworkflow = TextProcessingWorkflow subworkflow_inputs = { "text": "Process this text for analysis", "categories": ["sentiment", "topics", "entities"] } ``` **`Example Outputs`** ```python title="Example Outputs" # Outputs depend on the subworkflow's defined outputs MyInlineSubworkflowNode.Outputs( search_results=["Result 1", "Result 2", "Result 3"], metadata={ "total_found": 100, "processing_time": 0.5 } ) ``` **`Streaming Example`** ```python title="Streaming Example" # Outputs are streamed as they're generated by the subworkflow for output in node.run(): if output.is_streaming: print(f"Received partial output for {output.name}: {output.delta}") elif output.is_fulfilled: print(f"Received final output for {output.name}: {output.value}") ``` > Execute subworkflows defined inline within your workflow code.