$npx -y skills add jezweb/claude-skills --skill elevenlabs-agentsBuild conversational AI voice agents on the ElevenLabs platform. Configure agent + tools + knowledge base, integrate SDK (React / React Native / Swift / JS / server-side), test, deploy. Use whenever the user mentions ElevenLabs, building a voice agent, an AI phone system, an AI r
| 1 | # ElevenLabs Agent Builder |
| 2 | |
| 3 | Build a production-ready conversational AI voice agent. Produces a configured agent with tools, knowledge base, and SDK integration. |
| 4 | |
| 5 | ## Packages |
| 6 | |
| 7 | ```bash |
| 8 | npm install @elevenlabs/react # React SDK |
| 9 | npm install @elevenlabs/client # JavaScript SDK (browser + server) |
| 10 | npm install @elevenlabs/react-native # React Native SDK |
| 11 | npm install @elevenlabs/elevenlabs-js # Full API (server only) |
| 12 | npm install -g @elevenlabs/agents-cli # CLI ("Agents as Code") |
| 13 | ``` |
| 14 | |
| 15 | **DEPRECATED:** `@11labs/react`, `@11labs/client` -- uninstall if present. |
| 16 | |
| 17 | **Server-only warning:** `@elevenlabs/elevenlabs-js` uses Node.js `child_process` and won't work in browsers. Use `@elevenlabs/client` for browser environments, or create a proxy server. |
| 18 | |
| 19 | ## Workflow |
| 20 | |
| 21 | ### Step 1: Create Agent via Dashboard or CLI |
| 22 | |
| 23 | **Dashboard:** https://elevenlabs.io/app/conversational-ai -> Create Agent |
| 24 | |
| 25 | **CLI (Agents as Code):** |
| 26 | ```bash |
| 27 | elevenlabs agents init |
| 28 | elevenlabs agents add "Support Bot" --template customer-service |
| 29 | # Edit agent_configs/support-bot.json |
| 30 | elevenlabs agents push --env dev |
| 31 | ``` |
| 32 | |
| 33 | Templates: `default`, `minimal`, `voice-only`, `text-only`, `customer-service`, `assistant`. |
| 34 | |
| 35 | Configure: |
| 36 | - **Voice** -- Choose from 5000+ voices or clone |
| 37 | - **LLM** -- GPT, Claude, Gemini, or custom |
| 38 | - **System prompt** -- Use the 6-component framework below |
| 39 | - **First message** -- What the agent says when conversation starts |
| 40 | |
| 41 | ### Step 2: Write the System Prompt |
| 42 | |
| 43 | Use the 6-component framework for effective agent prompts: |
| 44 | |
| 45 | **1. Personality** -- who the agent is: |
| 46 | ``` |
| 47 | You are [NAME], a [ROLE] at [COMPANY]. |
| 48 | You have [EXPERIENCE]. Your traits: [LIST TRAITS]. |
| 49 | ``` |
| 50 | |
| 51 | **2. Environment** -- communication context: |
| 52 | ``` |
| 53 | You're communicating via [phone/chat/video]. |
| 54 | Consider [environmental factors]. Adapt to [context]. |
| 55 | ``` |
| 56 | |
| 57 | **3. Tone** -- speech patterns and formality: |
| 58 | ``` |
| 59 | Tone: Professional yet warm. Use contractions for natural speech. |
| 60 | Avoid jargon. Keep responses to 2-3 sentences. Ask one question at a time. |
| 61 | ``` |
| 62 | |
| 63 | **4. Goal** -- objectives and success criteria: |
| 64 | ``` |
| 65 | Primary Goal: Resolve customer issues on the first call. |
| 66 | Success: Customer verbally confirms issue is resolved. |
| 67 | ``` |
| 68 | |
| 69 | **5. Guardrails** -- boundaries and ethics: |
| 70 | ``` |
| 71 | Never: provide medical/legal/financial advice, share confidential info. |
| 72 | Always: verify identity before account access, document interactions. |
| 73 | Escalation: customer requests manager, issue beyond knowledge base. |
| 74 | ``` |
| 75 | |
| 76 | **6. Tools** -- available functions and when to use them: |
| 77 | ``` |
| 78 | 1. lookup_order(order_id) -- Use when customer mentions an order. |
| 79 | 2. transfer_to_supervisor() -- Use when issue requires manager approval. |
| 80 | Always explain what you're doing before calling a tool. |
| 81 | ``` |
| 82 | |
| 83 | ### Step 3: Add Tools |
| 84 | |
| 85 | **Client-side tools (run in browser):** |
| 86 | |
| 87 | ```typescript |
| 88 | const clientTools = { |
| 89 | updateCart: { |
| 90 | description: "Add or remove items from the shopping cart", |
| 91 | parameters: z.object({ |
| 92 | action: z.enum(['add', 'remove']), |
| 93 | item: z.string(), |
| 94 | quantity: z.number().min(1) |
| 95 | }), |
| 96 | handler: async ({ action, item, quantity }) => { |
| 97 | const cart = getCart(); |
| 98 | action === 'add' ? cart.add(item, quantity) : cart.remove(item, quantity); |
| 99 | return { success: true, total: cart.total, items: cart.items.length }; |
| 100 | } |
| 101 | }, |
| 102 | navigate: { |
| 103 | description: "Navigate user to a different page", |
| 104 | parameters: z.object({ url: z.string().url() }), |
| 105 | handler: async ({ url }) => { window.location.href = url; return { success: true }; } |
| 106 | } |
| 107 | }; |
| 108 | ``` |
| 109 | |
| 110 | **Server-side tools (webhooks):** |
| 111 | |
| 112 | ```json |
| 113 | { |
| 114 | "name": "get_weather", |
| 115 | "description": "Fetch current weather for a city", |
| 116 | "url": "https://api.weather.com/v1/current", |
| 117 | "method": "GET", |
| 118 | "parameters": { |
| 119 | "type": "object", |
| 120 | "properties": { |
| 121 | "city": { "type": "string", "description": "City name" } |
| 122 | }, |
| 123 | "required": ["city"] |
| 124 | }, |
| 125 | "headers": { |
| 126 | "Authorization": "Bearer {{secret__weather_api_key}}" |
| 127 | } |
| 128 | } |
| 129 | ``` |
| 130 | |
| 131 | Use `{{secret__key_name}}` for API keys in webhook headers -- never hardcode. |
| 132 | |
| 133 | **MCP Tools -- CRITICAL COMPATIBILITY NOTE:** |
| 134 | |
| 135 | ElevenLabs labels their MCP integration as "Streamable HTTP" but does NOT support the actual MCP 2025-03-26 Streamable HTTP spec (SSE responses). ElevenLabs expects: |
| 136 | |
| 137 | - Plain JSON responses (`application/json`), NOT SSE (`text/event-stream`) |
| 138 | - Protocol version `2024-11-05`, NOT `2025-03-26` |
| 139 | - Simple JSON-RPC over HTTP with direct JSON responses |
| 140 | |
| 141 | What does NOT work: |
| 142 | - Official MCP SDK's `createMcpHandler` (returns SSE) |
| 143 | - Cloud |