result = await workflow.arun("Research AI trends")result.content # Final step's contentresult.success # True if all steps succeededresult.duration_ms # Total execution timeresult.step_outputs # List[StepOutput] for each step
Workflow.arun() returns a WorkflowOutput, which is different from RunOutput. It includes step-level results.
Accessing Step Results
# By nameresearch = result.get_step_output("researcher")print(research.content)print(research.duration_ms)# Iterate all stepsfor step_output in result.step_outputs: print(f"{step_output.step_name}: {step_output.duration_ms:.0f}ms")
Step Context
Each step receives a StepInput with context from previous steps:
from definable.agent.workflow import StepInputasync def custom_step(ctx: StepInput): original = ctx.input # Original workflow input prev = ctx.get_last_step_content() # Previous step's output research = ctx.get_step_content("researcher") # Specific step by name api_key = ctx.session_state.get("api_key") # Shared session state return f"Processed: {research}"