Open Source & Case StudiesANTHROPIC SDK · PUBLIC VALIDATION
UPSTREAM SHIPPED

Stable User-Agent Identity in Anthropic’s TypeScript SDK

A focused SDK reliability contribution showing that constructor-derived User-Agent names drift under subclassing or minification. Anthropic closed the PR after shipping the same fix and regression scenario in v0.116.0.

Role

  • SDK observability
  • JavaScript runtime analysis
  • Regression design
  • TypeScript validation
  • Open-source contribution

Category

SDK Reliability

Engineering discipline

UPSTREAM SHIPPED

Anthropic release:SDK v0.116.0
Public contribution:PR #1135 · closed
Focused tests:51 passed
Patrick Ribbsaeter Anthropic TypeScript SDK v0.116.0 stable User-Agent fix shipped upstream

Patrick Ribbsaeter · Independent open-source contribution

Engineering objective

System challenge

The SDK generated its User-Agent from constructor.name. Subclassing or JavaScript minification can rename that constructor, producing unstable client identity in network traffic and weakening observability across builds.

Constraints

Working within real limits

  • Preserve the established Anthropic/JS <version> header format
  • Remain stable under subclassing and minification
  • Keep the change focused on SDK identity rather than request behavior
  • Classify the outcome accurately because PR #1135 was not merged

Approach

How it was built

  1. 01

    Demonstrated the failure with a subclass whose constructor name differs from the canonical SDK name.

  2. 02

    Specified a stable Anthropic/JS versioned token independent of runtime class names.

  3. 03

    Added a regression that rejects leaked subclass names while preserving the public header format.

  4. 04

    Validated the focused Jest suite, formatting, linting, and TypeScript compilation.

Workflow

Implementation flow

Instantiate subclassed SDK client
Build representative API request
Inspect generated User-Agent
Assert stable Anthropic/JS identity
Validate SDK toolchain
Compare against upstream release

Technical validation

Implementation evidence

Observable engineering evidence. Discipline: UPSTREAM SHIPPED

Anthropic release

SDK v0.116.0

Public contribution

PR #1135 · closed

Focused tests

51 passed

Outcome boundary

Shipped independently

Public evidence

Review the upstream contribution

Outcome

What was delivered

  • Anthropic confirmed that the same fix shipped in SDK v0.116.0

  • The released implementation included regression coverage for the subclass/minified-name scenario

  • The focused Jest run passed all 51 tests alongside lint, format, and TypeScript checks

  • PR #1135 was closed without merge because upstream had already shipped the correction

Technologies

Stack and tools

TypeScriptAnthropic SDKJavaScriptJestHTTP headersSDK observabilityMinification safety

Next engineering system

CLAUDE AGENT SDK · MERGED OPEN SOURCE

Claude Agent SDK: Generation-Only Tool Isolation

Have an ambitious AI system to build?

Let’s build something serious.

I work across AI architecture, product engineering, private inference, automation, SaaS infrastructure, and production hardening.