Skip to main content
The Scorecard SDK lets you evaluate AI systems with structured inputs, outputs, and scores. Tracing captures every LLM call, tool use, and retry with full observability. SDK + Tracing combines both into a single record.

Why combine SDK + Tracing?

Oftentimes, traces become cluttered with data, and SDK records don’t contain enough information to understand why something went wrong. To supplement the shortcomings of one or the other, we allow you to link the traces created by runs to the SDK, showing all of your data in one place:
  • Full observability into every LLM call, tool use, and retry
  • Cost and latency breakdown per span
  • Conversation view for chat-based traces
  • Debugging context when a test case fails — see exactly which step went wrong

Setup

You need two things: the Scorecard SDK to create records, and tracing instrumentation so your system emits OpenTelemetry traces.

1. Install the SDK

2. Enable tracing in your system

Choose any instrumentation method. The simplest approach depends on your stack: Agents and frameworks (Claude Code, Claude Agent SDK, OpenAI Agents SDK) — set environment variables:
SDK wrappers (OpenAI, Anthropic) — wrap your client:
Python

3. Use runAndEvaluate() with your traced system

For agent frameworks, pass otelLinkId from the options argument into your agent’s OTEL_RESOURCE_ATTRIBUTES so traces link to records.
In TypeScript, the env option replaces the subprocess environment rather than extending it, so spread process.env in as shown below—otherwise the agent loses its API credentials and PATH. The Python SDK merges env on top of the inherited environment automatically.
The key is setting scorecard.otel_link_id in OTEL_RESOURCE_ATTRIBUTES — this tells the trace pipeline which record to merge into.

How it works

runAndEvaluate() generates a unique otelLinkId for each testcase and passes it to your system function via the options argument. Your system can then insert this ID into the trace’s resource attributes (scorecard.otel_link_id), which tells the tracing pipeline to merge the trace into the corresponding record.

Multi-trace sessions

Some systems emit multiple traces per invocation — for example, the Claude Agent SDK generates a separate trace for each turn in a multi-turn conversation. Scorecard groups these into a single record using the session ID. When multiple traces share the same session.id, they are combined into a unified span tree under a session root, with trace IDs accumulated rather than overwritten. Your SDK inputs and outputs are preserved across all session merges.

Troubleshooting


Next steps