Skip to main content
While Helicone automatically tracks LLM requests, your AI workflows often include other operations: database queries, API calls, vector searches, and custom business logic. Traces let you log these non-LLM operations to get complete end-to-end visibility into your application.

Why Use Traces

LLM requests are only part of the story. A typical AI agent workflow includes:
  • 🔍 Vector database searches for retrieval
  • 🗄️ Database queries to fetch context
  • 🌐 External API calls to tools and services
  • ⚙️ Custom processing and validation logic
  • 📊 Data transformations and formatting
With traces, you can:
  • ✅ See the complete workflow, not just LLM calls
  • ✅ Measure latency across your entire stack
  • ✅ Debug issues in non-LLM components
  • ✅ Understand the full cost of operations (time, API calls)
  • ✅ Visualize traces alongside LLM requests in sessions

Quick Start

1

Install the SDK (Optional)

While you can use raw HTTP, the SDK makes it easier:
2

Log a Custom Trace

Log any operation by sending request/response data:
3

View in Dashboard

Traces appear alongside LLM requests:
  • View all traces in the Requests page
  • Filter by custom properties to find specific traces
  • When used with sessions, traces appear in the session timeline

Trace API Endpoint

Helicone provides a REST API for logging custom traces:

Endpoint

Headers

Request Body

Log the “request” and “response” of any operation:

Common Trace Patterns

Database Query

Log database operations to track query performance:
Track vector searches and embeddings:

External API Call

Log calls to external services:

Tool Execution

Log AI agent tool calls:

Traces in Sessions

Combine traces with sessions to see your complete workflow:
In the session view, you’ll see:
  • /research/search - Vector search trace
  • /research/analyze - LLM request
  • /research/save - Database write trace

Typed Trace API

For stricter type safety, use the typed trace endpoint:

Endpoint

Request Body

Example

Trace Metadata

Add custom properties to traces for filtering and analysis:

Performance Tracking

Traces include timing information to help you identify bottlenecks:

OpenTelemetry Integration

Helicone also supports native OpenTelemetry traces:
Send OpenTelemetry span data directly to Helicone. This is useful if you’re already using OpenTelemetry in your application. See the trace proto file for the expected format.

Best Practices

What to Trace

Do trace:
  • Database queries (especially slow ones)
  • External API calls
  • Vector database searches
  • Tool executions in agents
  • Custom business logic with significant latency
  • Operations that could fail or timeout
Don’t trace:
  • Trivial in-memory operations
  • Simple variable assignments
  • Fast operations (<1ms)
  • Operations with sensitive data (unless you sanitize it)

Trace Granularity

Good granularity:
Too granular:

Sensitive Data

Sanitize sensitive information before logging:

Troubleshooting

Traces Not Appearing

Problem: Traces aren’t showing up in the dashboard. Solutions:
  • Verify API key is correct and has write permissions
  • Check that request body matches the expected format
  • Look for HTTP error responses (400, 401, 500)
  • Ensure resultRecorder.appendResults() is called

Traces Not in Sessions

Problem: Traces aren’t appearing in session timeline. Solutions:
  • Include all three session headers:
    • Helicone-Session-Id
    • Helicone-Session-Path
    • Helicone-Session-Name
  • Use the same session ID as other requests in the session
  • Verify paths follow the /parent/child format

Performance Impact

Problem: Logging traces is slowing down your application. Solutions:
  • Use async logging (don’t await the log call if possible)
  • Batch multiple operations before logging
  • Only log operations that are actually slow (>100ms)
  • Consider sampling: only log a percentage of traces

Sessions

Group traces and LLM requests into sessions

Custom Properties

Add metadata to traces for filtering and analysis

Requests

View traces alongside LLM requests

Manual Logger

Helicone SDK for easier trace logging

Questions?

Need help or have questions? We’re here to help: