xai-org / xai-org/xai-sdk-python
[FEATURE] Built-in Automatic Retry & Backoff Middleware
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 578
- Forks
- 191
- PR merge metrics
- No merged PRs in 30d
Description
Confirmation of Request Source
- I confirm that this feature request is for the xAI SDK Python library (e.g., client features, SDK methods, or documentation) and not for the xAI API itself (e.g., model capabilities or API changes).
Describe the feature you'd like
Concept: Add customizable retry policies for gRPC rate limits (RESOURCE_EXHAUSTED) and transient network dropouts (UNAVAILABLE).
Why it matters: Network glitches and API rate limits currently throw unhandled gRPC errors. A built-in exponential backoff decorator makes production applications resilient out of the box.
Additional Context
Implementation Scope:
from xai_sdk import Client, RetryPolicy
client = Client(
retry_policy=RetryPolicy(
max_retries=3,
backoff_factor=1.5,
retry_on=[grpc.StatusCode.UNAVAILABLE, grpc.StatusCode.RESOURCE_EXHAUSTED]
)
)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Python SDK's Client construction and current gRPC error handling. Review how UNAVAILABLE and RESOURCE_EXHAUSTED failures are surfaced, then define completion around configurable retry counts, exponential backoff, and status-code selection through the proposed RetryPolicy interface.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- grpc, python
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100