Eliminating production SDK bugs while accelerating V1 API launch

Stainless generated:

Letta migrated their Python SDK, TypeScript SDK, and their docs site to Stainless in just a couple of weeks, strengthening their V1 API launch with an improved developer experience.

Founded by the creators of the original MemGPT research paper, Letta helps users create persistent agents that maintain context and learn over time, unlike traditional stateless APIs.

Prior to working with Stainless, Letta began to run into friction and reliability issues with their SDKs as they scaled their platform. “We had a pretty major bug with a customer that came directly from the translation layer,” said Charles Packer, Letta’s technical lead, describing problems in their TypeScript SDK generated by their existing solution.

Growing pains

Letta initially adopted an SDK generation approach to replace a hand-written Python SDK that had fallen out of sync with their API. While this resolved early drift and consistency issues, new limitations surfaced as they prepared for their V1 API launch:

1. Translation layer vulnerabilities

Letta experienced “major production bugs” caused by snake case to camel case translation layer in their TypeScript SDK. Disabling the translation layer would have required using snake case in TypeScript, which violated JavaScript conventions.

2. Type collisions

Multiple response types were generated for the same underlying objects across different endpoints. "For a single type, for a single object, we may have like four or five different definitions across our SDK which is pretty ugly," noted Charles. This made imports cumbersome and the SDK harder to use.

3. Maintenance overhead

All pagination helpers required manual implementation across routes, consuming significant engineering resources during Letta’s critical launch period.

4. Unreliable docs code snippets

Auto-generated documentation snippets frequently dropped parameters or failed to populate, making their API reference docs less useful.

Migrating SDKs to Stainless

With their API launch on the horizon, Letta's team saw an opportunity to address both their SDK reliability issues and set the stage for not only a successful V1 launch, but many other launches to come. Charles explained, "We figured that if we are going to migrate... we should rip the bandaid now as opposed to after the V1.”

Implementation process

Phase 1: Rapid validation

With a sandbox environment, Letta was able to complete an immediate validation of critical needs in hours, not days or weeks: native camel case generation, shared type definitions, and auto-pagination support.

Phase 2: Advanced configuration

Stainless helped Letta address complex OpenAPI challenges. A seemingly complex issue was that Letta’s FastAPI + Pydantic setup didn’t consider some fields populated by a generator as being required when they needed to be, but our team showed Letta how to use Stainless transforms to resolve the issue quickly and with no changes required on their end (and especially no breaking changes!).

For schemas that lacked a required array entirely, they used the merge transform to create one. The transforms solution successfully enabled auto-pagination across their endpoints while maintaining the existing API architecture.

Phase 3: Production deployment

The team completed the migration on schedule, consolidated shared types, deployed auto-pagination across all endpoints, and established same-day publishing to npm and PyPI.

Docs platform migration

Beyond SDKs, Letta also migrated their entire documentation site to Stainless. Because the Stainless Docs Platform is built on Astro, they were able to move more than 150 MDX files quickly, using astro-auto-import to keep their existing global components working without refactors.

The rest of the migration focused on practical cleanup. Cloudflare caching conflicts and ViewTransition issues were resolved with help from the Stainless team. Letta kept their existing docs structure, improved search, and moved to a custom domain at docs.letta.com with automated publishing in place. The result was a faster, more maintainable docs stack without disrupting their content or workflows.

Results and impact

The migration eliminated critical production issues while enabling Letta to launch their V1 API on schedule. Key technical outcomes included:

  • Eliminated entire class of camel case conversion issues through native TypeScript generation

  • Consolidated type definitions from multiple endpoint-specific versions to single shared types

  • Automated pagination implementation across all endpoints, removing manual work

  • Automated publishing to npm and PyPI for immediate SDK updates

Instead of spending cycles on SDK breakages, the Letta team was able to re-focus on core product development, all in just a few weeks. The migration itself went smoothly thanks to advanced diagnostic tooling quickly pinpointing issues and direct support provided by Stainless via Slack.