wrap() function.
OpenAI
Wrap your OpenAI client to automatically trace all API calls:Supported Methods
The OpenAI integration automatically traces:chat.completions.create()(streaming and non-streaming)embeddings.create()images.generate(),images.edit(),images.createVariation()audio.transcriptions.create(),audio.translations.create()
Vercel AI SDK
Wrap the Vercel AI SDK module to trace all AI operations:Supported Methods
The Vercel AI SDK integration automatically traces:generateText(),streamText()generateObject(),streamObject()embed(),embedMany()generateImage()transcribe()generateSpeech()
LangChain / LangGraph
Use the callback handler for LangChain and LangGraph applications:Claude Agent SDK
Anthropic’s@anthropic-ai/claude-agent-sdk is natively traced. Each agent query() call becomes its own ZeroEval trace, and all turns in the same Claude conversation are grouped into one ZeroEval session via the claude_session_id attribute.
Wrap the whole module (recommended)
Wrap only the query function
If you only need to tracequery() calls, you can wrap the function directly:
What gets traced
The Claude Agent SDK integration automatically captures:- Assistant output text and tool use summaries
- Token usage, total cost, and stop reason
- Permission decisions from
canUseToolcallbacks - Hook metadata
- Stream event counts when partial messages are enabled
- Session grouping across multi-turn conversations via
claude_session_id
Only public Claude Agent SDK APIs are instrumented — private transport and protocol internals are not patched.
Auto-Detection
Thewrap() function automatically detects which client you’re wrapping:
If
ze.init() hasn’t been called and ZEROEVAL_API_KEY is set in your environment, the SDK will automatically initialize when you first use wrap().Using with Prompts
The integrations automatically extract ZeroEval metadata from prompts created withze.prompt():
Need help? Check out our GitHub examples or reach out on Discord.