- Custom Logic: Implement complex business rules and data transformations
- Agent Integration: Call agents and teams within your custom processing logic
- Data Flow Control: Transform outputs between steps for optimal data handling
Step with a custom function as the executor. The function must accept a StepInput object and return a StepOutput object, ensuring seamless integration with the workflow system.

Example
Class-based executor
You can also use a class-based executor by defining a class that implements the__call__ method.
- Configuration at initialization: Pass in settings, API keys, or behavior flags when creating the executor
- Stateful execution: Maintain counters, caches, or track information across multiple workflow runs
- Reusable components: Create configured executor instances that can be shared across multiple workflows
__call__ method to be an async function.
Streaming execution with custom function step on AgentOS:
If you are running an agent or team within the custom function step, you can enable streaming on the AgentOS chat page by settingstream=True and stream_events=True when calling run() or arun() and yielding the events.
Using the AgentOS, runs will be asynchronous and responses will be streamed.
This means you must keep the custom function step asynchronous, by using
.arun() instead of .run() to run your Agents or Teams.custom_function_step_async_stream.py
Streaming in case of a class-based executor also works the same way by defining the
__call__ method to yield the events.