Skip to main content
AI agents make multiple LLM calls, tool invocations, and database queries to complete tasks. This tutorial shows you how to use Helicone Sessions to monitor entire agent workflows from start to finish.

What You’ll Build

A monitored AI research agent that:
  • Takes a user query
  • Searches multiple sources
  • Synthesizes findings
  • Generates a report
All tracked as a single session with hierarchical traces.

Prerequisites

  • Helicone API key (get one here)
  • OpenAI API key
  • Node.js 18+ or Python 3.8+

Step 1: Set Up Your Project

Step 2: Configure the Helicone Client

Step 3: Create Session Structure

Define your agent’s workflow hierarchy:
Use descriptive paths that represent the type of work, not the order. Multiple requests can use the same path if they do the same conceptual task.

Step 4: Implement Agent Steps

1

Query Analysis

First, have the agent analyze the user’s query:
2

Search Multiple Sources

Perform searches for each identified topic:
3

Synthesize Results

Combine findings into coherent insights:
4

Generate Final Report

Create the final research report:

Step 5: Orchestrate the Agent

Put it all together:

Step 6: View Results in Helicone

1

Navigate to Sessions

Go to Helicone Sessions in your dashboard.
2

Find Your Session

Filter by session name “Research Agent” or search for your session ID.
3

Analyze the Flow

You’ll see:
  • Complete request hierarchy
  • Duration of each step
  • Costs per operation
  • Total agent cost and latency
  • Request/response details for debugging

Expected Output

After running the agent, you’ll see in Helicone:

Best Practices

Use descriptive paths: /research/search/web is better than /step3
Add custom properties: Track user tiers, environments, or feature flags with Helicone-Property-* headers
Reuse session names: All research tasks should use “Research Agent” so you can compare performance across runs
Don’t reuse session IDs across different workflows. Each agent run should have a unique session ID.

Troubleshooting

Check that:
  • All three headers are present: Helicone-Session-Id, Helicone-Session-Path, Helicone-Session-Name
  • Session ID is consistent across all requests
  • Requests are successfully reaching Helicone (check response headers for helicone-id)
  • Paths must start with /
  • Use / to separate levels: /parent/child
  • Ensure paths are consistent across related requests
Costs depend on accurate model detection. If using custom models or providers, costs may show as “not supported”. Contact help@helicone.ai to add support.

Next Steps

Sessions Documentation

Deep dive into session features and configuration

Custom Properties

Add metadata to track environments, users, and features

Cost Tracking

Monitor and optimize agent costs

User Metrics

Track agent usage per user