Skip to content

Comments

feat: expose error and retry messages to SDK consumers#47

Merged
cpacker merged 1 commit intomainfrom
feat/expose-error-retry-messages
Feb 23, 2026
Merged

feat: expose error and retry messages to SDK consumers#47
cpacker merged 1 commit intomainfrom
feat/expose-error-retry-messages

Conversation

@cpfiffer
Copy link
Contributor

Summary

  • Add SDKErrorMessage and SDKRetryMessage types to the SDK message union
  • Handle type=error and type=retry wire messages in transformMessage() instead of silently dropping them
  • Export both new types from the SDK entry point

Previously, when the Letta API returned errors (rate limiting, auth failures, etc.), the SDK dropped the type=error wire message that contained the actual error detail (message, stop_reason, api_error). Consumers only saw the subsequent type=result with the opaque string "error" as both its error and stopReason fields. Similarly, type=retry messages with attempt counts and backoff timing were silently discarded.

Now both message types flow through to consumers, enabling meaningful error display instead of "Agent run failed: error [error]".

Test plan

  • bun test -- 47/47 pass
  • bun run build -- clean
  • Tested end-to-end against a 429 rate-limit error on lettabot (Telegram channel). Error message now surfaces actual API error detail to the bot's stream loop.

Written by Cameron and Letta Code

"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies." -- C.A.R. Hoare

Previously, `transformMessage()` returned null for `type=error` and
`type=retry` wire messages, causing them to be silently dropped in
the background pump. Consumers only saw the opaque `type=result`
with `error="error"` and `stopReason="error"`, losing all detail.

Now both message types are transformed into `SDKErrorMessage` and
`SDKRetryMessage` and included in the `SDKMessage` union, so
consumers can access the actual error text, API error details,
retry attempt counts, and backoff timing.

Written by Cameron and Letta Code

"There are two ways of constructing a software design: One way is
to make it so simple that there are obviously no deficiencies, and
the other way is to make it so complicated that there are no
obvious deficiencies." -- C.A.R. Hoare
@cpacker cpacker merged commit bf2edbc into main Feb 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants