Claude Agent SDK logo+P
Integration

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.

§01 / CAPABILITIESframework: Claude Agent SDK
§02 / SETUPhow it works
Setup

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.

See setup and the install snippet →

§03 / QUESTIONSClaude Agent SDK
Questions

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.

§04 / RELATEDgo deeper
Related guides

Related guides

See it on your Claude Agent SDK agents

Book a 15-minute setup and our team gets you tracing in production.