Skip to main content

Overview

The Anyway SDK provides two decorators to structure your traces:
  • @workflow - High-level operations that orchestrate multiple tasks
  • @task - Individual units of work (like LLM calls)
These work identically with any LLM provider.

Basic Setup

The @workflow Decorator

Use @workflow for top-level operations that coordinate multiple steps:
Workflows create parent spans that contain all nested operations.

The @task Decorator

Use @task for individual operations, especially LLM calls:
Tasks create child spans within workflows.

Complete Example

Streaming

Tool Use / Function Calling

Async Support

Both decorators work seamlessly with async functions:

View in Dashboard

After running your code, view traces in the Anyway Dashboard:
  1. Navigate to Traces
  2. Find your workflow trace
  3. Expand to see nested task spans
  4. View timing, inputs, and outputs for each operation

Next Steps

Configuration

Configure endpoints and authentication

Customer & Order Attribution

Link traces to customers and orders

Cost Tracking

Monitor your AI spend