Fully Python Workflow

Replace the steps list with a single Python function that controls the whole run.

If you'd rather control the execution flow yourself, pass a single Python function as the workflow's steps instead of a list. You still get workflow features like storage, streaming, and session management.

fully_python_workflow.py
from agno.workflow import Workflow, WorkflowExecutionInput


def custom_workflow_function(
    workflow: Workflow,
    execution_input: WorkflowExecutionInput,
) -> str:
    topic = str(execution_input.input)
    sections = [
        f"Market definition for {topic}",
        "Customer segments",
        "Competitive risks",
    ]
    return "\n".join(f"- {section}" for section in sections)

workflow = Workflow(
    name="Function-Based Workflow",
    steps=custom_workflow_function,
)

workflow.print_response("Evaluate the market potential for quantum computing applications", markdown=True)

Developer Resources

Migrating from v1 workflows? See the Workflows migration guide.