Observe, evaluate, and improve your Claude Agent SDK agents
Capture every Claude Agent SDK tool call through the same hooks the SDK itself exposes for permission control — PreToolUse and PostToolUse — not a separate interception layer.
What Prefactor records from Claude Agent SDK
Claude Agent SDK + Prefactor
Observe for Claude Agent SDK
Prefactor observes your Claude Agent SDK agents in real time — every LLM call, tool invocation, and custom span captured
Open → EvaluateEvaluate for Claude Agent SDK
Prefactor evaluates your Claude Agent SDK agents — score outcome quality against the captured spans, track drift by comp
Open → ObserveAct for Claude Agent SDK
Prefactor acts on your Claude Agent SDK agents at runtime — block, throttle, sandbox, or escalate a tool call or data ac
Open →How the Claude Agent SDK integration works
- Each agent turn, tool use, and sub-agent call is captured as a nested span.
- PreToolUse is a native permission-decision hook — it returns allow, deny, ask, or defer before the tool call executes; that's the real, built-in mechanism a Prefactor runtime policy runs through to block or hold a Claude Agent SDK tool call, not a workaround bolted onto the SDK.
- PostToolUse can replace a tool's output before Claude ever sees it (updatedToolOutput) — useful for redacting sensitive data out of a result after the tool ran but before it reaches the model.
- A native Claude Agent SDK package (@prefactor/claude) is available — verify its snippet against docs.prefactor.ai before switching this page to it.
Claude Agent SDK integration FAQ
Do I need a dedicated package for Claude Agent SDK?
Claude Agent SDK has a native package (@prefactor/claude); you can also instrument it today with the framework-agnostic prefactor-core SDK.
What does Prefactor capture from Claude Agent SDK?
Prefactor records agent turns, tool use, sub-agent calls and LLM calls as structured, timestamped spans — so every Claude Agent SDK run is captured as trace data you can reconstruct, search and export end to end.
Does Prefactor add latency or change how Claude Agent SDK runs?
No. Observability capture is designed to stay off your agent's critical path, so it doesn't alter your Claude Agent SDK logic or your users' responses. The only part that acts inline is the optional runtime guardrails you enable per agent — by design, so a high-risk or low-confidence action can be held for human approval before it executes.
Can I evaluate agents built with Claude Agent SDK and catch regressions?
Yes. Once runs are captured, eval suites score quality and groundedness on real traffic, drift detection flags behaviour changes after deployment, and versioned eval history catches regressions before they ship — the observe → evaluate → improve loop applied to your Claude Agent SDK agents.
Related guides
See it on your Claude Agent SDK agents
Book a 15-minute setup and our team gets you tracing in production.