Agent skill

Retellai SDK Patterns

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Production-ready Retell AI SDK patterns for voice agent applications.

MITAuto-check passedAI & LLM Engineering

Install Retellai SDK Patterns

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill retellai-sdk-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace retellai-sdk-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/retellai-sdk-patterns .claude/skills/retellai-sdk-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
retellai-sdk-patterns
GitHub stars
2.8k
Token cost
~1.2k tokens
SKILL.md length
180 words
Files
2 (incl. references)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Production-ready Retell AI SDK patterns for voice agent applications.

  • Works in 4 steps: Singleton Client → Typed Agent Configuration → Call Manager with Retry → …
  • Building production voice agents
  • SKILL.md covers Overview, Prerequisites, Instructions and Output, plus 4 more sections
  • Needs RETELL_API_KEY

What it does

Retellai SDK Patterns is an agent skill from jeremylongshore/tons-of-skills-marketplace. Production-ready Retell AI SDK patterns for voice agent applications. Use when building production voice agents, implementing retry logic, or establishing patterns. Trigger with phrases like "retell patterns", "voice agent patterns", "retell best practices".

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/code-patterns.md`). Compatibility notes: Designed for Claude Code

It sits in AI & LLM Engineering, covering Speech recognition and synthesis and Error handling. It works with Vercel AI SDK. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • Building production voice agents
  • Implementing retry logic
  • Establishing patterns
  • With phrases like retell patterns

Example prompts

  • “retell patterns”
  • “voice agent patterns”
  • “retell best practices”
  • “/retellai-sdk-patterns”

Requirements

  • A credential in RETELL_API_KEY
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Singleton Client
  2. Typed Agent Configuration
  3. Call Manager with Retry
  4. Batch Call Campaign

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • npmjs.com
    • docs.retellai.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • RETELL_API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Retellai SDK Patterns loads about 1.2k tokens when it runs, and up to ~1.7k if it reads all its reference files. Until then it costs about 70 tokens; SKILL.md has 180 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~70
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~1.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 180 words, ~1,160 tokens.

Download SKILL.mdSave it as .claude/skills/retellai-sdk-patterns/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
retellai-sdk-patterns
description
Production-ready Retell AI SDK patterns for voice agent applications. Use when building production voice agents, implementing retry logic, or establishing patterns. Trigger with phrases like "retell patterns", "voice agent patterns", "retell best practices".
allowed-tools
Read, Write, Edit
compatibility
Designed for Claude Code
version
1.9.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, retellai, voice, telephony, patterns

Retell AI SDK Patterns

Overview

Production-ready patterns for Retell AI: client singletons, typed agent configurations, call management, and error handling.

Prerequisites

  • Completed retellai-install-auth
  • retell-sdk installed

Instructions

Step 1: Singleton Client
typescript
import Retell from 'retell-sdk';

let _retell: Retell | null = null;

export function getRetellClient(): Retell {
  if (!_retell) {
    _retell = new Retell({ apiKey: process.env.RETELL_API_KEY! });
  }
  return _retell;
}
Step 2: Typed Agent Configuration
typescript
interface AgentConfig {
  name: string;
  voiceId: string;
  prompt: string;
  functions?: FunctionConfig[];
  maxCallDurationMs?: number;
  endCallAfterSilenceMs?: number;
}

async function createAgent(config: AgentConfig) {
  const retell = getRetellClient();

  const llm = await retell.llm.create({
    model: 'gpt-4o',
    general_prompt: config.prompt,
    functions: config.functions,
  });

  const agent = await retell.agent.create({
    response_engine: { type: 'retell-llm', llm_id: llm.llm_id },
    voice_id: config.voiceId,
    agent_name: config.name,
    max_call_duration_ms: config.maxCallDurationMs || 300000,
    end_call_after_silence_ms: config.endCallAfterSilenceMs || 10000,
  });

  return { agentId: agent.agent_id, llmId: llm.llm_id };
}
Step 3: Call Manager with Retry
typescript
async function makeCallWithRetry(
  fromNumber: string, toNumber: string, agentId: string, maxRetries = 2
) {
  const retell = getRetellClient();
  for (let attempt = 0; attempt <= maxRetries; attempt++) {
    try {
      const call = await retell.call.createPhoneCall({
        from_number: fromNumber,
        to_number: toNumber,
        override_agent_id: agentId,
      });
      return call;
    } catch (err: any) {
      if (attempt === maxRetries || err.status < 500) throw err;
      await new Promise(r => setTimeout(r, 2000 * (attempt + 1)));
    }
  }
}
Step 4: Batch Call Campaign
typescript
async function runCallCampaign(
  numbers: string[], agentId: string, concurrency = 3, delayMs = 2000
) {
  const results: Array<{ number: string; callId?: string; error?: string }> = [];
  const queue = [...numbers];
  const active = new Set<Promise<void>>();

  while (queue.length > 0 || active.size > 0) {
    while (active.size < concurrency && queue.length > 0) {
      const number = queue.shift()!;
      const p = (async () => {
        try {
          const call = await makeCallWithRetry(process.env.RETELL_PHONE_NUMBER!, number, agentId);
          results.push({ number, callId: call.call_id });
        } catch (err: any) {
          results.push({ number, error: err.message });
        }
        await new Promise(r => setTimeout(r, delayMs));
      })();
      active.add(p);
      p.finally(() => active.delete(p));
    }
    if (active.size > 0) await Promise.race(active);
  }
  return results;
}

Output

  • Singleton Retell client
  • Typed agent creation with LLM configuration
  • Retry logic for call creation
  • Concurrent call campaign manager

Error Handling

PatternUse CaseBenefit
SingletonAll SDK callsOne client instance
Typed configAgent creationType safety, defaults
Retry wrapperCall failuresAutomatic recovery
Campaign managerOutbound callsRate-limited concurrency

Examples

Use an idempotency boundary around call creation

Generate a request identifier at the application edge and persist its state before invoking the Retell SDK. If the network response is lost, retrieve the existing result by that identifier or operator-visible correlation data before attempting another call. Keep retries bounded and limited to operations whose outcome can be established; this prevents a transient client failure from creating multiple customer calls.

Resources

Next Steps

Apply in retellai-core-workflow-a for agent building.

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in skills/.curated/retellai-sdk-patterns of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • references/code-patterns.md

Open the folder on GitHubat commit cfae287

Compare with similar skills

Retellai SDK Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Retellai SDK Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Retellai SDK Patterns this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.2kAutomated safety check: PassMIT
Building Livekit Agentslivekit-examples/agent-starter-python2641 repos~2.4kAutomated safety check: NotesMIT
Cline Prompt Cache Ladder CheckOnlyTerp/prompt-cache-skills114—~2kAutomated safety check: PassCustom licence
Qv SDK Update Modelstetherto/qvac685—~2.8kAutomated safety check: PassApache-2.0
Reviewing Changerapidaai/voice-ai745—~751Automated safety check: PassCustom licence
AI SDKvercel-labs/ai-facts16820 repos~1.2kAutomated safety check: PassNone

Similar skills

  • Building Livekit Agents

    livekit-examples/agent-starter-python

    Builds voice and chat AI agents with LiveKit Agents and LiveKit Cloud.

    264 GitHub starsUsed in 1 repo~2.4k tokens
    AI & LLM EngineeringAuto-check: notes
  • Cline Prompt Cache Ladder Check

    OnlyTerp/prompt-cache-skills

    Verifies how Cline marks Anthropic prompt-cache breakpoints on the wire, then adds a tools breakpoint and tunes the cache TTL in its AI SDK code.

    114 GitHub stars~2k tokensUpdated 1 mo ago
    AI & LLM EngineeringAuto-check passed
  • Regenerates SDK model constants from the live QVAC registry and opens a [mod] PR.

    685 GitHub stars~2.8k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • Reviewing Change

    rapidaai/voice-ai

    Perform an evidence-based review of a fixed change boundary.

    745 GitHub stars~751 tokensUpdated 4 days ago
    AI & LLM EngineeringAuto-check passed
  • AI SDK

    vercel-labs/ai-facts

    Official

    Answer questions about the AI SDK and help build AI-powered features.

    168 GitHub starsUsed in 20 repos~1.2k tokens
    AI & LLM EngineeringAuto-check passed
  • Adds persistent memory to Vercel AI SDK apps with the Mem0 provider, using a wrapped model or standalone retrieve and store utilities.

    67k GitHub stars~2.3k tokensUpdated 2 days ago
    AI & LLM EngineeringAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Works with

Questions about Retellai SDK Patterns

What does Retellai SDK Patterns do?

Production-ready Retell AI SDK patterns for voice agent applications. Retellai SDK Patterns is an agent skill from jeremylongshore/tons-of-skills-marketplace. Production-ready Retell AI SDK patterns for voice agent applications.

When should I use Retellai SDK Patterns?

Retellai SDK Patterns fits situations like: building production voice agents; implementing retry logic; establishing patterns; with phrases like retell patterns.

How do I install Retellai SDK Patterns in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill retellai-sdk-patterns -a claude-code`. Or copy the skill folder (skills/.curated/retellai-sdk-patterns in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/retellai-sdk-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Retellai SDK Patterns in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill retellai-sdk-patterns -a codex`. Or copy the skill folder (skills/.curated/retellai-sdk-patterns in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/retellai-sdk-patterns in your project. Codex loads it when a task matches its description.

Can I use Retellai SDK Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill retellai-sdk-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/retellai-sdk-patterns, .gemini/skills/retellai-sdk-patterns, .github/skills/retellai-sdk-patterns and .opencode/skills/retellai-sdk-patterns in your project.

What does Retellai SDK Patterns need to run?

Going by SKILL.md and its folder, Retellai SDK Patterns needs credentials named RETELL_API_KEY. Our summary lists: A credential in RETELL_API_KEY. Its frontmatter pre-approves these tools: Read, Write, Edit. Compatibility (from SKILL.md): Designed for Claude Code.

Does Retellai SDK Patterns access the network?

SKILL.md names 2 domains. As links in the text: npmjs.com and docs.retellai.com. This is read from the text; nothing was executed.

Is Retellai SDK Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Retellai SDK Patterns use?

Retellai SDK Patterns is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Retellai SDK Patterns use?

About 1.2k tokens (SKILL.md is roughly 4.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 552 tokens, read only when the agent opens those files.

What are the alternatives to Retellai SDK Patterns?

Skills that share tags, products or a category with Retellai SDK Patterns: Building Livekit Agents (livekit-examples/agent-starter-python, 264 stars), Cline Prompt Cache Ladder Check (OnlyTerp/prompt-cache-skills, 114 stars), Qv SDK Update Models (tetherto/qvac, 685 stars) and Reviewing Change (rapidaai/voice-ai, 745 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Retellai SDK Patterns?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.