CLAUDE LABJP
FORK — Claude Code 2.1.212 changes what /fork does: it copies your conversation into a new background session with its own row in claude agents, so you can keep working. The old in-session subagent is now /subtaskLIMITS — WebSearch calls are now capped at 200 per session by default, and subagent spawns get the same 200 ceiling, so a runaway search or delegation loop stops on its ownMCPBG — MCP tool calls running past two minutes now move to the background automatically, keeping the session usable. Tune the threshold with CLAUDE_CODE_MCP_AUTO_BACKGROUND_MSPLANFIX — Fixed plan mode auto-running file-modifying Bash commands such as touch and rm without a permission prompt or an SDK canUseTool callbackSONNET5 — Claude Sonnet 5 is running on introductory pricing of $2 per million input tokens and $10 per million output. After August 31 it moves to $3 and $15IPO — Bankers are reportedly lining up investor meetings for Anthropic ahead of a possible public listing as soon as OctoberFORK — Claude Code 2.1.212 changes what /fork does: it copies your conversation into a new background session with its own row in claude agents, so you can keep working. The old in-session subagent is now /subtaskLIMITS — WebSearch calls are now capped at 200 per session by default, and subagent spawns get the same 200 ceiling, so a runaway search or delegation loop stops on its ownMCPBG — MCP tool calls running past two minutes now move to the background automatically, keeping the session usable. Tune the threshold with CLAUDE_CODE_MCP_AUTO_BACKGROUND_MSPLANFIX — Fixed plan mode auto-running file-modifying Bash commands such as touch and rm without a permission prompt or an SDK canUseTool callbackSONNET5 — Claude Sonnet 5 is running on introductory pricing of $2 per million input tokens and $10 per million output. After August 31 it moves to $3 and $15IPO — Bankers are reportedly lining up investor meetings for Anthropic ahead of a possible public listing as soon as October
Articles/API & SDK
API & SDK/2026-04-24Advanced

Shadow Mode with Claude Agent SDK — Measuring Agent Accuracy on Live Traffic Without Touching Users

You want to ship an AI agent to production, but you can't measure its real accuracy without exposing real users. Shadow mode solves that paradox. This guide shows how to run a Claude Agent SDK agent alongside your existing workflow, log the deltas, and promote it step by step.

claude-agent-sdk6production111observability20shadow-moderollout

Premium Article

"I want to put this agent in production, but I can't bring myself to flip the switch because I'm not sure how accurate it really is." I have heard this exact sentence more times than I can count. Every time, the engineering team has already exhausted offline evaluation, demoed the agent internally, and watched colleagues poke at it. What they are missing is the final step: confidence that the agent won't misbehave on live traffic.

I hit the same wall when I first shipped a Claude Agent SDK-based assistant. Offline eval scored well, but production traffic always contained patterns my eval set did not anticipate. I needed a way to feed production-identical inputs into the agent while still keeping users untouched. The answer was shadow mode.

This article walks through a complete pattern for running a Claude Agent SDK agent in the shadow of your existing production workflow — recording its decisions, comparing them to the system of record, and eventually promoting it through canary into full production. Every code example is written at a level you can actually deploy.

The pre-production wall for agents

There is a specific pain signature to this problem. You have finished the MVP, internal demos go well, and then someone — usually the CTO or a principal engineer — asks the question that stalls every agent rollout I have seen: "How do we know it won't be weird in production?" Everyone in the room knows that offline eval is a partial answer, but nobody has a better one on hand. The rollout stalls, the agent stays on the shelf, and the conversation restarts every sprint until someone forces the question.

Offline evaluation is not enough. Your evaluation set is built from historical logs or synthetic data, and it rarely captures the long tail of what production really looks like. Agents — which dispatch across multiple tools — suffer this more than simple LLM calls. The combinatorial explosion of inputs means the number of distinct patterns in production can easily be ten times the size of your eval set.

Evaluation metrics themselves are fuzzy. "The response is correct" is not a unique function; human evaluation is accurate but slow and expensive. On one project, we spent two engineer-days per 100 samples of human-judged data, and shipping decisions were bottlenecked on that cadence.

The obvious escape is a classic A/B test, but for agents the initial blast radius is too large. If you route 1% of "auto-reply to customer email" traffic to a misbehaving agent, the affected customers will have received an inappropriate reply that can't be recalled. A/B testing that triggers rollback after damage is too late for this class of feature.

You need a third option: feed the same inputs as production, but have zero user impact. Shadow mode is that option. The existing system makes the real decisions; the agent just runs alongside and records what it would have done.

Design principles behind shadow mode

The word "shadow" is borrowed from larger-scale systems engineering, where it describes running a new implementation in parallel with the production one, silently, to validate that they produce equivalent results. In machine learning, "shadow deployment" has been used for model rollouts at companies like Uber and Netflix for years. What is new here is applying the pattern to LLM-based agents, where the output is non-deterministic and comparison requires softer metrics than byte-for-byte equality.

The core idea is "judge without acting." The existing production path (rule-based, human, or otherwise) is the source of truth. The agent consumes the same inputs, makes its own decision, and only that decision is logged.

This gives you three wins. First, zero impact on the user experience — an agent misfire never leaks out. Second, real input distribution — you measure the agent on this moment's real traffic instead of a frozen eval set. Third, an improvement loop grounded in operational data — every discrepancy between shadow and truth feeds straight back into prompt tuning or fine-tuning data.

There are also costs. The most significant is API cost: running the agent on full (or a large share of) production traffic doubles your Claude API bill. A system doing 10M requests per month that shadows everything on Claude Haiku 4.5 can easily add thousands of dollars per month. We'll tackle this in the pitfalls section.

The other cost is observability load. Logging each decision adds kilobytes per request. Check whether your pipeline (Datadog, BigQuery, ClickHouse, whatever you use) can absorb that — and whether the storage bill fits your budget. Plan this before you flip the sampling switch.

A subtle but important point: shadow mode is not an evaluation platform — it is an operational platform. Offline eval measures how well the model reasons. Shadow mode measures how the system behaves under your company's real operating conditions: holiday traffic spikes, shifts in customer tone, seasonal category mixes. Once you internalize this difference, you start feeding shadow findings back into your offline eval set, which in turn strengthens future offline measurement. The two systems reinforce each other.

I describe this pattern as a "non-invasive observation layer on top of the existing process." You leave production behavior untouched but keep a virtual record of what the agent would have done. That property is what makes it the final safety gate before shipping.

One more framing I find useful: shadow mode converts the "release a new agent" problem into a "measure a new agent on live traffic" problem. Those are fundamentally different risk profiles. Releasing a model without measurement is a binary event — either it works, or you have to roll back under pressure. Measuring a model for weeks before release lets you enter the release decision with numerical confidence and a plan for known edge cases. That shift, from event-driven to measurement-driven rollout, is what separates teams that ship agents regularly from teams that ship them once and back them out.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Break out of the 'I want to ship the agent but I'm afraid of its accuracy' loop by measuring on real traffic with zero user impact
Walk away with a working skeleton for shadow execution, delta logging, and drift detection that you can drop into your system this week
Replace gut-feeling 'is it ready?' meetings with a numeric promotion ladder: shadow → canary → full, with thresholds your team can agree on
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

API & SDK2026-06-23
When Claude API Prompt Caching Quietly Stops Hitting in Production — Field Notes on TTL and Measured Savings
Prompt caching works beautifully the day you ship it, then quietly stops hitting in production. The five things that break the prefix, how to choose between 5-minute and 1-hour TTL, and how to measure real savings from usage instead of guessing.
API & SDK2026-06-18
When Your Claude API Response Cache Returns Stale Answers and Near-Miss Wrong Ones — Field Notes on Freshness and False-Hit Suppression
A Claude API response cache improves latency and cost immediately, but the problems that hurt in production are not average hit rate — they are stale hits and semantic false hits. Here is the key design, freshness management, false-hit suppression, and observability that keep a cache honest.
API & SDK2026-06-16
PII Masking for Claude API Lives or Dies on the Ledger — Restore, Encrypt, Measure
The hard part of masking PII before Claude API isn't detection — it's operating the token ledger you restore from. Encrypted storage, multi-instance sharing, and a daily leak-rate loop, with working code.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →