Anthropic SDK 0.102/0.107 Turns Agent Operations Into Typed API Surface

There's a class of SDK bug that doesn't crash anything, doesn't log an error, and produces a failure that looks like your cloud provider is having a bad day. That's the signing-order bug that Anthropic fixed in TypeScript SDK 0.102.0, shipped June 6 alongside a matching Python 0.107.0. Middleware — the layer where production teams put tracing, retries, redaction, and policy checks — now runs before request signing, not after. If you're running Claude through AWS, Bedrock, or any client that signs requests, this fix matters more than the version number suggests.

The commit is dry: "fix(client): run middleware before request signing." The implication is not. Request signing is where the SDK turns a URL, body, and headers into something AWS-style infrastructure will authenticate. If signing happens before middleware changes any of those values — a redirect URL, a rewritten header, a request body mutated for compliance — the signature describes a request that is no longer the one going over the wire. The failure mode looks like auth flakiness, intermittent 403s, or provider-side weirdness. The real bug is ordering inside the SDK.

What the signing fix actually does

AWS and Bedrock clients sign requests with Authorization and x-amz-* headers derived from the request URL, body, and timestamp. Middleware that mutates those values before signing used to produce a signed payload that didn't match the actual request. In most cases the bug was latent: middleware that didn't touch auth-sensitive fields worked fine, and teams never knew their SDK had an ordering problem. In cases where middleware did mutate the URL or body — retry logic, request rewriting, compliance header injection — the signature could be invalid by the time the request left the client.

The fix makes signing the last step before fetch, after all middleware has run. Anthropic's code comments in the patch are unusually informative: middleware may call next() more than once (for retries or replays), so signing hooks must be idempotent and must overwrite stale auth headers rather than accumulating them. That's the right invariant. If middleware replays a request, the second attempt gets a fresh signature, not a ghost from the first attempt.

The test added 139 lines specifically covering signing-client cases — verifying that middleware-modified URL and body values are what actually get signed. If you're using Bedrock, Claude Platform on AWS, or any custom request middleware that rewrites URLs or bodies, you should upgrade and then test your retry and replay paths specifically.

The Managed Agents type surface, getting real

TypeScript SDK 0.102.0 also shipped "small updates to Managed Agents types," which sounds like boilerplate until you read what changed. BetaManagedAgentsCustomToolInputSchema.type is now required as 'object'. Tool schemas can now carry arbitrary additional keys via [k: string]: unknown. The required field on custom tools is now optional and nullable. These are small structural changes that add up to a more expressive and safer tool-definition contract.

Tool schemas are the interface between the model and your code. Too loose and the model invents shapes your runtime can't safely execute. Too strict and JSON Schema features get stripped, leaving you with worse validation than handwritten code. The SDK is inching toward a better middle: required object root, nullable required arrays, room for additional schema vocabulary. If you're generating tool schemas from Pydantic models or JSON Schema definitions, this release gives you more precision without requiring a schema redesign.

The advisor tool types added max_tokens?: number | null, described as bounding the advisor's total output — thinking plus text — per call. Anthropic's own docs note that advisor calls typically produce 400–700 text tokens and 1,400–1,800 tokens total including thinking. Their testing on a hard reasoning benchmark found that setting max_tokens: 2048 reduced mean advisor output roughly 7x compared with no cap, with near-zero truncation. That's not a micro-optimization — it's the difference between a deployable cost pattern and a surprise bill at end of month.

What this means for operator teams

The uncomfortable truth is that Claude API applications are moving from "call a model" to "operate an agent runtime." SDK releases like this are where that transition becomes concrete — not in a product announcement, but in a required type: "object", a fixed signing order, and a new advisor token cap that actually works.

If you're running TypeScript middleware through Bedrock or any AWS-signed client, upgrade to 0.102.0 and add regression tests for signed requests under retry and replay conditions. If you generate tool schemas programmatically, verify your schema still validates correctly with the stricter object-root requirement. If you use advisor tools, set max_tokens deliberately — start at 2,048, measure actual output, adjust from there. And if you use Managed Agents, note that sessions are stateful and server-side-persisted, which Anthropic's docs explicitly flag as not currently ZDR- or HIPAA-BAA-eligible. "Managed" doesn't mean "compliance solved."

The middleware signing fix is the one that could have been silently wrong for months. The Managed Agents type additions are the ones that tell you where Anthropic is investing: agent harness as a first-class product surface, with persistent sessions, typed tool contracts, and cost controls that go beyond "set a budget and hope." The advisor max_tokens is the one that will show up on your invoice if you don't set it. Pick your priority order accordingly.

Sources: GitHub — anthropic-sdk-typescript sdk-v0.102.0, GitHub — anthropic-sdk-python v0.107.0, Anthropic Advisor tool docs, Anthropic Managed Agents overview