Learn how to build your own compound flow using Mira Flows SDK
This guide explains how to create, test, and deploy compound flows that implement complex, multi-stage processing pipelines. Compound flows provide sophisticated capabilities for implementing business logic, custom processing stages, and integration with existing elemental flows. ππ‘
# Flow specification versionversion:"0.1.0"# Flow specification versionmetadata:flow_type:"compound"# Specifies this as a compound flowname:"your-flow-name"# Unique identifierdescription:"Describe what this compound flow accomplishes"author:"your-username"# Your Mira Flows usernametags:[tag1, tag2, tag3]# Discovery keywordsprivate:true# Access control settinginputs:prime_input_1:# Primary input parametertype: stringdescription:"What is this input used for"required:trueexample:"Example value"prime_input_2:# Secondary input parametertype: stringdescription:"Description of this input"required:falseexample:"Example"workflow:# Elemental Flow stage - starts immediatelyfirst_flow:# First processing stagetype:"elemental"flow_name:"john_doe/first_elemental_flow" inputs:abc: ${inputs.prime_input_1}xyz: ${inputs.prime_input_2}# Custom processing stage - starts immediately (parallel to first_flow)second_flow:# Parallel processing stagetype:"custom" inputs:input1: ${inputs.prime_input_1} model:provider:"provider-name"# e.g., anthropic, openai, meta, etc.name:"model-name"# Specific model identifierprompt:| Your flow's primary instruction or role... You can use {input1} placeholders to reference inputs.# Waits for both first_flow and second_flow to completethird_flow:type:"custom"depends_on:[first_flow, second_flow]# Dependent on fist_flow and second_flow inputs:input1: ${first_flow.output}# uses output of first_flow as inputinput2: ${second_flow.output}# uses output of second_flow as input model:provider:"provider-name"name:"model-name" dataset:source:"author_name/dataset_name"prompt:| Your flow's primary instruction or role... You can use {input1} and {input2} placeholders to reference inputs.output:value:# Combine & customise outputs in order- ${first_flow.output}- ${second_flow.output}- ${third_flow.output}readme:| This is a detailed explanation of what your flow does.### Workflow Overview:1. **First Flow**: Executes `john_doe/first_elemental_flow` with the provided inputs2. **Second Flow**: Runs in parallel with first flow3. **Third Flow**: Depends on both previous flows, executes after they complete### Outputs:- Combined outputs from all flows are returned in order
from mira_sdk import MiraClientfrom mira_sdk.exceptions import FlowErrorflow = client.flow.get("your-username/your-flow-name")# Retrieve existing flowflow.save("/path/to/compound_flow.yaml")# Save for editingtry: client.flow.deploy(flow)# Deploy updated versionprint("Updated flow deployed successfully!")# Success messageexcept FlowError as e:print(f"Update error: {str(e)}")# Handle update error# In case you forget to bump the flow version, it will get bumped by default every time you deploy the same flow.
By following these steps, you can create, test, deploy, and manage your own custom compound flows on the Mira Flows platform. ππ§