@workflow
Overview
The @workflow decorator creates a root trace span. All nested @task, @agent, and @tool spans are captured as children under this workflow.
Parameters
Function usage
Class usage
When decorating a class, use method_name to specify the entry point. Calling that method creates the workflow span.
Processor routing
Use processors to send workflow spans to specific exporters only.
Export filtering
Use export_filter to conditionally export spans based on their attributes. All conditions use AND logic.
Supported operators: "" (equals), "not", "gt", "gte", "lt", "lte", "contains", "icontains", "startswith", "endswith", "regex", "in", "not_in", "empty", "not_empty".
Best practices
- Use descriptive workflow names for easy navigation in the Traces dashboard
- Keep workflows coarse-grained — use
@taskfor internal steps - One workflow per user request or pipeline run