Sequential Workflows
Linear, deterministic processes where each step depends on the output of the previous step.
Sequential workflows ensure predictable execution order and clear data flow between steps.
Example Flow: Research → Data Processing → Content Creation → Final Review
Sequential workflows ensure predictable execution order and clear data flow between steps.
1from kern.workflow import Step, Workflow, StepOutput23def data_preprocessor(step_input):4 # Custom preprocessing logic56 # Or you can also run any agent/team over here itself7 # response = some_agent.run(...)8 return StepOutput(content=f"Processed: {step_input.input}") # <-- Now pass the agent/team response in content here910workflow = Workflow(11 name="Mixed Execution Pipeline",12 steps=[13 research_team, # Team14 data_preprocessor, # Function15 content_agent, # Agent16 ]17)1819workflow.print_response("Analyze the competitive landscape for fintech startups", markdown=True)For more information on how to use custom functions, refer to the Workflow with custom function step page.
See Example:
- Sequence of Functions and Agents - Complete workflow with functions and agents
StepInput and StepOutput provides standardized interfaces for data flow between steps:
So if you make a custom function as an executor for a step, make sure that the input and output types are compatible with the StepInput and StepOutput interfaces.
This will ensure that your custom function can seamlessly integrate into the workflow system.
Take a look at the schemas for StepInput and StepOutput.