When this input is passed to an
Agent or Team, it will be serialized to a
string before being passed to the agent or team.Structured Inputs with Pydantic
Leverage Pydantic models for type-safe, validated workflow inputs:Validating the input
You can setinput_schema on the Workflow to validate the input. If you then pass the input as a dictionary, it will be automatically validated against the schema.
Developer Resources
Structured Input/Output at Step Level
Workflows feature a powerful type-safe data flow system enabling each step to:- Receive structured input (Pydantic models, lists, dicts, or raw strings)
- Produce structured output (validated Pydantic models)
- Maintain type safety throughout entire workflow execution
Data Flow Between Steps
Input Processing- First step receives the workflow’s input message
- Subsequent steps receive the previous step’s structured output
- Each Agent processes input using its configured
output_schema - Output is automatically validated against the defined model
Structured Data Transformation in Custom Functions
Custom functions can access structured output from previous steps viastep_input.previous_step_content, preserving original Pydantic model types.
Transformation Pattern
- Type-Check Inputs: Use
isinstance(step_input.previous_step_content, ModelName)to verify input structure - Modify Data: Extract fields, process them, and construct new Pydantic models
- Return Typed Output: Wrap the new model in
StepOutput(content=new_model)for type safety
Developer Resources
Media Input and Processing
Workflows seamlessly handle media artifacts (images, videos, audio) throughout the execution pipeline, enabling rich multimedia processing workflows. Media Flow System- Input Support: Media can be provided to
Workflow.run()andWorkflow.print_response() - Step Propagation: Media is passed through to individual steps (Agents, Teams, or Custom Functions)
- Artifact Accumulation: Each step receives shared media from previous steps and can produce additional outputs
- Format Compatibility: Automatic conversion between artifact formats ensures seamless integration
- Complete Preservation: Final
WorkflowRunOutputcontains all accumulated media from the entire execution chain
If you are using
Workflow.run(), you need to use WorkflowRunOutput to access the images, videos, and audio.Video and Audio as input.