Overview
The@workflow decorator creates a root trace span. All nested @task, @agent, and @tool spans are captured as children under this workflow.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
name | str | None | Function name | Display name for the workflow span. |
version | int | None | None | Version number for the workflow. |
method_name | str | None | None | Required when decorating a class. Specifies which method to use as the entry point. |
processors | str | List[str] | None | None | Route this span to specific named processors. See add_processor. |
Function usage
Class usage
When decorating a class, usemethod_name to specify the entry point. Calling that method creates the workflow span.
Processor routing
Useprocessors to send workflow spans to specific exporters only.
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