ai-resilience

Implement retry, caching, and batching for Gemini AI calls in Python and TypeScript.

Updated Mar 19, 2026
One-click install
npx skills add https://github.com/rochaluiz8888/claude-code-skills --skill ai-resilience
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-resilience
Source: https://github.com/rochaluiz8888/claude-code-skills/tree/main/ai-resilience
Command: npx skills add https://github.com/rochaluiz8888/claude-code-skills --skill ai-resilience

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

AI/LLM integrations often suffer from intermittent failures, excessive latency, and inefficient usage of API quotas. This skill provides production-grade resilience patterns to make AI calls robust, efficient, and auditable.

Core Features & Use Cases

  • Exponential backoff with jitter for retries on 429/5xx responses and network errors.
  • Smart-skip content hashing to avoid reprocessing identical inputs.
  • Batch processing with bounded concurrency to scale AI workloads without overwhelming services.
  • Token optimization and structured JSON outputs to improve predictability and downstream consumption.

Quick Start

Integrate these patterns by wiring retry, caching, and batching into your Gemini-based AI calls and run a focused test to validate resilience.

Frequently Asked Questions about ai-resilience

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement retry with exponential backoff for Gemini AI calls?

To implement retry with exponential backoff for Gemini AI calls, you automate resilience patterns with exponential backoff and jitter for 429 and 5xx responses. This automatically retries transient network failures to ensure robust LLM integration.

What is content-hash caching for AI integrations?

Content-hash caching for AI integrations is a smart-skip mechanism that hashes inputs to avoid reprocessing identical requests. This optimizes token usage and reduces API latency by returning cached responses for duplicate queries.

How do I handle batch processing with bounded concurrency in TypeScript AI projects?

To handle batch processing with bounded concurrency in TypeScript AI projects, you process workloads with strict concurrency limits to scale AI calls. This prevents overwhelming the API service while maintaining high throughput for batch jobs.

Does this resilience pattern work with Python and TypeScript using google-genai?

Yes, these resilience patterns work with both Python and TypeScript projects using google-genai. They provide production-ready AI call hardening, batch processing, and resilience auditing applicable across both language environments.

Why do I need exponential backoff with jitter for LLM API rate limits?

You need exponential backoff with jitter for LLM API rate limits to prevent thundering herd problems when services return 429 errors. Jitter randomizes retry intervals, distributing load and improving the success rate of subsequent requests.

When should I not use smart-skip caching for AI calls?

You should not use smart-skip caching for AI calls when your application requires real-time data generation or dynamic context that changes per request. Content-hash caching assumes identical inputs yield identical outputs, which fails for time-sensitive queries.