Prerequisites
- Node.js 18 or higher
- A ZeroEval API key (get one at zeroeval.com)
- An OpenAI API key (for this example)
Installation
Set up environment variables
Create a
.env file in your project root with your API keys:.env
The SDK auto-initializes on first span if
ZEROEVAL_API_KEY is set in your environment.Create your first traced application
Create a new file called
app.ts and add the following code:app.ts
The
ze.wrap() function automatically detects the client type and instruments all API calls for tracing.What’s next?
Manual tracing
Learn how to manually instrument your code
Integrations
Explore integrations with Vercel AI SDK and LangChain
Signals
Add custom metrics and signals to your traces
Prompts
Manage and version your prompts with ZeroEval
Integrations
Explore integrations with Vercel AI SDK and LangChain
Signals
Add custom metrics and signals to your traces
Prompts
Manage and version your prompts with ZeroEval
Advanced example with custom spans
Here’s a more advanced example showing how to use custom spans and tags:The
withSpan() helper creates a new span context and ensures proper parent-child relationships between spans.