Skip to main content

Multi-Step Workflows

Learn how to implement Proxy in real-world scenarios, from simple single API calls to complex multi-step workflows with automatic trace and span generation.

Understanding Traces and Spans

  • Trace: A complete request journey through your application
  • Span: Individual operations within a trace (e.g., each AI API call)
  • Automatic Generation: Proxy creates these automatically without manual instrumentation

Headers Reference

Proxy heavily relies on headers to mutate traces and spans created in Adaline. Refer to the Headers Reference for more details beyond the examples below.

Example 1: Simple RAG Pipeline

A Retrieval-Augmented Generation (RAG) system that combines embedding generation, vector search, and chat completion in a single trace.

Example 2: Multi-Step Content Generation

A content generation workflow that uses multiple embedding calls and chat completions with span attributes and variables tracking.

Example 3: Conversational Agent with Tools

A conversational agent that uses tool calling with trace status updates and comprehensive error handling.

Best Practices for Complex Workflows

1. Consistent Trace Management

Use a single trace ID across all related operations:

2. Meaningful Span Names

Use descriptive span names that indicate the operation:

3. Error Handling with Trace Status

Update trace status to reflect workflow state: