Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

AI SDK v7 Agent Tracing

A minimal Vercel AI SDK v7 agent traced with @arizeai/phoenix-otel. Importing instrumentation.ts registers Phoenix telemetry; agent.ts then runs a ToolLoopAgent with a single weather tool — the agent span, each LLM step, and the tool call all show up as one trace in Phoenix.

Version compatibility

Vercel AI SDK @arizeai/phoenix-otel
v7+ 2.x (this example)
v6 and older 1.x

AI SDK v7 requires Node.js 22.12 or newer.

Prerequisites

  • Node.js >= 22.12
  • A running Phoenix instance (defaults to http://localhost:6006)
  • OPENAI_API_KEY set in your environment

Run

# From the js/ directory
pnpm install
# Build the workspace-linked @arizeai/phoenix-otel package
pnpm --filter @arizeai/phoenix-otel build

export OPENAI_API_KEY=sk-...
pnpm --filter ai-sdk-agent start

Open http://localhost:6006 to see the trace in the ai-sdk-agent project.

Configuration

Environment variable Description Default
OPENAI_API_KEY OpenAI API key required
PHOENIX_COLLECTOR_ENDPOINT Phoenix OTLP endpoint http://localhost:6006
PHOENIX_API_KEY Phoenix API key (if auth is enabled) none