Skip to content

docs: add TypeScript examples for retry strategies#767

Open
nol4lej wants to merge 1 commit into
strands-agents:mainfrom
nol4lej:docs/typescript-retry-examples
Open

docs: add TypeScript examples for retry strategies#767
nol4lej wants to merge 1 commit into
strands-agents:mainfrom
nol4lej:docs/typescript-retry-examples

Conversation

@nol4lej
Copy link
Copy Markdown

@nol4lej nol4lej commented Apr 18, 2026

Description

Add TypeScript code examples to replace // Not supported in TypeScript and
// This feature is not yet available in TypeScript SDK placeholders in
retry-strategies.mdx and hooks.mdx.

Changes:

  • Add retry-strategies.ts with three snippet sections:

    • customizing_retry — exponential backoff using AfterModelCallEvent and ModelThrottledError
    • disabling_retry — explanation that TypeScript has no built-in retry mechanism
    • custom_retry_logic — custom retry logic via event.retry = true
  • Update hooks.ts with three plugin class examples:

    • RetryOnServiceUnavailable — retries on ServiceUnavailableException with exponential backoff
    • PropagateUnexpectedExceptions — re-throws non-allowlisted errors from tool calls
    • RetryOnToolError — retries failed tool calls tracking attempts per toolUseId
  • Update retry-strategies.mdx and hooks.mdx to use snippet inclusions in the existing TypeScript tabs

Type of Change

  • Content update/revision

Checklist

  • I have read the CONTRIBUTING document
  • My changes follow the project's documentation style
  • I have tested the documentation locally using npm run dev
  • Links in the documentation are valid and working

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Replace \"// Not supported in TypeScript\" placeholders in
retry-strategies.mdx and hooks.mdx with working TypeScript
examples using agent.addHook() and AfterModelCallEvent.retry.
Copy link
Copy Markdown
Author

@nol4lej nol4lej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct

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.

1 participant