> ## Documentation Index
> Fetch the complete documentation index at: https://docs.poly.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Recipes

> Copy-paste patterns for common voice agent workflows — tested, annotated, and ready to adapt.

export const LessonMeta = ({level, difficulty, time}) => {
  const levelConfig = {
    1: {
      badge: 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200',
      label: 'Level 1'
    },
    2: {
      badge: 'bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200',
      label: 'Level 2'
    },
    3: {
      badge: 'bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200',
      label: 'Level 3'
    }
  };
  const difficultyConfig = {
    Beginner: 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200',
    Intermediate: 'bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200',
    Advanced: 'bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200'
  };
  const lvl = levelConfig[level] || levelConfig[1];
  const diffColor = difficultyConfig[difficulty] || difficultyConfig['Beginner'];
  return <div className="flex flex-wrap items-center gap-2 my-4 not-prose">
      <span className={`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold ${lvl.badge}`}>
        {lvl.label}
      </span>
      <span className={`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold ${diffColor}`}>
        {difficulty}
      </span>
      {time && <span className="inline-flex items-center gap-1 text-xs text-gray-500 dark:text-gray-400">
          <svg className="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
            <path strokeLinecap="round" strokeLinejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z" />
          </svg>
          {time}
        </span>}
    </div>;
};

Recipes are focused, working examples for the patterns you'll build most often. Each recipe shows the complete code, explains the key decisions, and flags common mistakes.

<Info>
  Recipes assume you're comfortable with [functions](/learn/guides/advanced/using-tools) and basic [return values](/learn/guides/advanced/tool-return-values). Most Level 2+ learners can use them directly; Level 1 learners should finish the core lessons first.
</Info>

## Available recipes

<CardGroup cols={2}>
  <Card title="SMS confirmation" icon="message" href="/learn/recipes/sms-confirmation">
    Send an SMS after collecting consent. Handles the full consent → send → confirm loop.
  </Card>

  <Card title="Retry with handoff" icon="arrow-rotate-right" href="/learn/recipes/retry-with-handoff">
    Deterministic retry counter that escalates to a live agent after N failures.
  </Card>

  <Card title="Caller ID validation" icon="id-card" href="/learn/recipes/caller-id-validation">
    Collect and verify a caller's identity before proceeding to sensitive information.
  </Card>

  <Card title="Intent-based routing" icon="route" href="/learn/recipes/smart-routing">
    Route calls to different destinations based on what the caller says they need.
  </Card>
</CardGroup>

## How to use recipes

Each recipe is a starting point, not a final implementation. Adapt the function names, prompts, and logic to match your agent's context. The comments in each snippet explain *why* each decision was made — read them before editing.

<Tip>
  If you find yourself writing the same pattern more than once, it's a good candidate for a recipe. The [ADK](/extend/adk) makes it easy to pull patterns into reusable utility files.
</Tip>
