agents by elevenlabs/skills
npx skills add https://github.com/elevenlabs/skills --skill agents构建具备自然对话能力的语音 AI 智能体,支持多种 LLM 提供商、自定义工具,并可轻松嵌入网页。
设置: 有关 CLI 和 SDK 的设置,请参阅安装指南。
ElevenLabs CLI 是创建和管理智能体的推荐方式:
# 安装 CLI 并进行身份验证
npm install -g @elevenlabs/cli
elevenlabs auth login
# 初始化项目并创建智能体
elevenlabs agents init
elevenlabs agents add "我的助手" --template complete
# 推送到 ElevenLabs 平台
elevenlabs agents push
可用模板: complete, minimal, voice-only, text-only, customer-service,
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
assistantfrom elevenlabs import ElevenLabs
client = ElevenLabs()
agent = client.conversational_ai.agents.create(
name="我的助手",
enable_versioning=True,
conversation_config={
"agent": {
"first_message": "你好!有什么可以帮您?",
"language": "en",
"prompt": {
"prompt": "你是一个乐于助人的助手。请保持简洁和友好。",
"llm": "gemini-2.0-flash",
"temperature": 0.7
}
},
"tts": {"voice_id": "JBFqnCBsd6RMkjVDRZzb"}
}
)
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
const client = new ElevenLabsClient();
const agent = await client.conversationalAi.agents.create({
name: "我的助手",
enableVersioning: true,
conversationConfig: {
agent: {
firstMessage: "你好!有什么可以帮您?",
language: "en",
prompt: {
prompt: "你是一个乐于助人的助手。",
llm: "gemini-2.0-flash",
temperature: 0.7
}
},
tts: { voiceId: "JBFqnCBsd6RMkjVDRZzb" }
}
});
curl -X POST "https://api.elevenlabs.io/v1/convai/agents/create?enable_versioning=true" \
-H "xi-api-key: $ELEVENLABS_API_KEY" -H "Content-Type: application/json" \
-d '{"name": "我的助手", "conversation_config": {"agent": {"first_message": "你好!", "language": "en", "prompt": {"prompt": "你乐于助人。", "llm": "gemini-2.0-flash"}}, "tts": {"voice_id": "JBFqnCBsd6RMkjVDRZzb"}}}'
服务端(Python): 获取用于客户端连接的签名 URL:
signed_url = client.conversational_ai.conversations.get_signed_url(
agent_id="your-agent-id",
environment="staging",
)
客户端(JavaScript):
import { Conversation } from "@elevenlabs/client";
const conversation = await Conversation.startSession({
agentId: "your-agent-id",
environment: "staging",
onMessage: (msg) => console.log("智能体:", msg.message),
onUserTranscript: (t) => console.log("用户:", t.message),
onError: (e) => console.error(e)
});
React Hook:
import { useConversation } from "@elevenlabs/react";
const conversation = useConversation({ onMessage: (msg) => console.log(msg) });
// 从您的后端获取目标环境的签名 URL,然后:
await conversation.startSession({ signedUrl: token });
| 提供商 | 模型 |
|---|---|
| OpenAI | gpt-5, gpt-5-mini, gpt-5-nano, gpt-4.1, gpt-4.1-mini, gpt-4.1-nano, gpt-4o, gpt-4o-mini, gpt-4-turbo |
| Anthropic | claude-sonnet-4-6, claude-sonnet-4-5, claude-sonnet-4, claude-haiku-4-5, claude-3-7-sonnet, claude-3-5-sonnet, claude-3-haiku |
gemini-3.1-flash-lite-preview, gemini-3-pro-preview, gemini-3-flash-preview, gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.0-flash, gemini-2.0-flash-lite | |
| ElevenLabs | glm-45-air-fp8, qwen3-30b-a3b, gpt-oss-120b |
| 自定义 | custom-llm(使用您自己的端点) |
使用 GET /v1/convai/llm/list 来检查当前模型目录,包括弃用状态、令牌/上下文限制以及功能标志(例如图像输入支持)。
热门语音: JBFqnCBsd6RMkjVDRZzb (George), EXAVITQu4vr4xnSDxMaL (Sarah), onwK4e9ZLuTAKqWW03F9 (Daniel), XB0fDUnXU5powFXDhCwa (Charlotte)
对话急切度: patient(等待用户说完的时间更长), normal, 或 eager(快速响应)
所有选项请参阅智能体配置。
通过 Webhook、客户端或内置系统工具扩展智能体功能。工具在 conversation_config.agent.prompt 内定义:
工作区环境变量可以解析每个环境的服务器工具 URL、请求头和身份验证连接,运行时系统变量(如 {{system__conversation_history}})可以在需要时将完整的对话上下文传递到工具调用中。
"prompt": {
"prompt": "你是一个可以查询天气的助手。",
"llm": "gemini-2.0-flash",
"tools": [
# Webhook:服务端 API 调用
{"type": "webhook", "name": "get_weather", "description": "获取天气",
"api_schema": {"url": "https://api.example.com/weather", "method": "POST",
"request_body_schema": {"type": "object", "properties": {"location": {"type": "string"}}, "required": ["location"]}}},
# 客户端:在浏览器中运行
{"type": "client", "name": "show_product", "description": "展示产品",
"parameters": {"type": "object", "properties": {"productId": {"type": "string"}}, "required": ["productId"]}}
],
"built_in_tools": {
"end_call": {},
"transfer_to_number": {"transfers": [{"transfer_destination": {"type": "phone", "phone_number": "+1234567890"}, "condition": "用户请求人工支持"}]}
}
}
客户端工具 在浏览器中运行:
clientTools: {
show_product: async ({ productId }) => {
document.getElementById("product").src = `/products/${productId}`;
return { success: true };
}
}
完整文档请参阅客户端工具参考。
<elevenlabs-convai agent-id="your-agent-id"></elevenlabs-convai>
<script src="https://unpkg.com/@elevenlabs/convai-widget-embed" async type="text/javascript"></script>
使用属性自定义:avatar-image-url, action-text, start-call-text, end-call-text。
所有选项请参阅小部件嵌入参考。
通过 Twilio 集成,使用您的智能体拨打外呼电话:
response = client.conversational_ai.twilio.outbound_call(
agent_id="your-agent-id",
agent_phone_number_id="your-phone-number-id",
to_number="+1234567890",
call_recording_enabled=True
)
print(f"通话已启动:{response.conversation_id}")
const response = await client.conversationalAi.twilio.outboundCall({
agentId: "your-agent-id",
agentPhoneNumberId: "your-phone-number-id",
toNumber: "+1234567890",
callRecordingEnabled: true,
});
curl -X POST "https://api.elevenlabs.io/v1/convai/twilio/outbound-call" \
-H "xi-api-key: $ELEVENLABS_API_KEY" -H "Content-Type: application/json" \
-d '{"agent_id": "your-agent-id", "agent_phone_number_id": "your-phone-number-id", "to_number": "+1234567890", "call_recording_enabled": true}'
配置覆盖和动态变量请参阅外呼电话参考。
# 列出智能体并检查状态
elevenlabs agents list
elevenlabs agents status
# 从平台导入智能体到本地配置
elevenlabs agents pull # 导入所有智能体
elevenlabs agents pull --agent <agent-id> # 导入特定智能体
# 将本地更改推送到平台
elevenlabs agents push # 上传配置
elevenlabs agents push --dry-run # 先预览更改
# 添加工具
elevenlabs tools add-webhook "天气 API"
elevenlabs tools add-client "UI 工具"
CLI 会创建一个用于管理智能体的项目结构:
your_project/
├── agents.json # 智能体定义
├── tools.json # 工具配置
├── tests.json # 测试配置
├── agent_configs/ # 单个智能体配置
├── tool_configs/ # 单个工具配置
└── test_configs/ # 单个测试配置
# 列出
agents = client.conversational_ai.agents.list()
# 获取
agent = client.conversational_ai.agents.get(agent_id="your-agent-id")
# 更新(部分更新 - 仅包含要更改的字段)
client.conversational_ai.agents.update(agent_id="your-agent-id", name="新名称")
client.conversational_ai.agents.update(agent_id="your-agent-id",
conversation_config={
"agent": {"prompt": {"prompt": "新指令", "llm": "claude-sonnet-4"}}
})
# 删除
client.conversational_ai.agents.delete(agent_id="your-agent-id")
所有配置选项和 SDK 示例请参阅智能体配置。
try:
agent = client.conversational_ai.agents.create(...)
except Exception as e:
print(f"API 错误:{e}")
常见错误:401(密钥无效), 404(未找到), 422(配置无效), 429(速率限制)
每周安装量
1.6K
代码仓库
GitHub Stars
142
首次出现
2026年1月28日
安全审计
安装于
codex1.2K
gemini-cli1.2K
opencode1.2K
github-copilot1.1K
claude-code1.0K
kimi-cli996
Build voice AI agents with natural conversations, multiple LLM providers, custom tools, and easy web embedding.
Setup: See Installation Guide for CLI and SDK setup.
The ElevenLabs CLI is the recommended way to create and manage agents:
# Install CLI and authenticate
npm install -g @elevenlabs/cli
elevenlabs auth login
# Initialize project and create an agent
elevenlabs agents init
elevenlabs agents add "My Assistant" --template complete
# Push to ElevenLabs platform
elevenlabs agents push
Available templates: complete, minimal, voice-only, text-only, customer-service, assistant
from elevenlabs import ElevenLabs
client = ElevenLabs()
agent = client.conversational_ai.agents.create(
name="My Assistant",
enable_versioning=True,
conversation_config={
"agent": {
"first_message": "Hello! How can I help?",
"language": "en",
"prompt": {
"prompt": "You are a helpful assistant. Be concise and friendly.",
"llm": "gemini-2.0-flash",
"temperature": 0.7
}
},
"tts": {"voice_id": "JBFqnCBsd6RMkjVDRZzb"}
}
)
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
const client = new ElevenLabsClient();
const agent = await client.conversationalAi.agents.create({
name: "My Assistant",
enableVersioning: true,
conversationConfig: {
agent: {
firstMessage: "Hello! How can I help?",
language: "en",
prompt: {
prompt: "You are a helpful assistant.",
llm: "gemini-2.0-flash",
temperature: 0.7
}
},
tts: { voiceId: "JBFqnCBsd6RMkjVDRZzb" }
}
});
curl -X POST "https://api.elevenlabs.io/v1/convai/agents/create?enable_versioning=true" \
-H "xi-api-key: $ELEVENLABS_API_KEY" -H "Content-Type: application/json" \
-d '{"name": "My Assistant", "conversation_config": {"agent": {"first_message": "Hello!", "language": "en", "prompt": {"prompt": "You are helpful.", "llm": "gemini-2.0-flash"}}, "tts": {"voice_id": "JBFqnCBsd6RMkjVDRZzb"}}}'
Server-side (Python): Get signed URL for client connection:
signed_url = client.conversational_ai.conversations.get_signed_url(
agent_id="your-agent-id",
environment="staging",
)
Client-side (JavaScript):
import { Conversation } from "@elevenlabs/client";
const conversation = await Conversation.startSession({
agentId: "your-agent-id",
environment: "staging",
onMessage: (msg) => console.log("Agent:", msg.message),
onUserTranscript: (t) => console.log("User:", t.message),
onError: (e) => console.error(e)
});
React Hook:
import { useConversation } from "@elevenlabs/react";
const conversation = useConversation({ onMessage: (msg) => console.log(msg) });
// Get a signed URL for the target environment from your backend, then:
await conversation.startSession({ signedUrl: token });
| Provider | Models |
|---|---|
| OpenAI | gpt-5, gpt-5-mini, gpt-5-nano, gpt-4.1, gpt-4.1-mini, gpt-4.1-nano, gpt-4o, gpt-4o-mini, gpt-4-turbo |
| Anthropic | , , , , , , |
Use GET /v1/convai/llm/list to inspect the current model catalog, including deprecation state, token/context limits, and capability flags such as image-input support.
Popular voices: JBFqnCBsd6RMkjVDRZzb (George), EXAVITQu4vr4xnSDxMaL (Sarah), onwK4e9ZLuTAKqWW03F9 (Daniel), XB0fDUnXU5powFXDhCwa (Charlotte)
Turn eagerness: patient (waits longer for user to finish), normal, or eager (responds quickly)
See Agent Configuration for all options.
Extend agents with webhook, client, or built-in system tools. Tools are defined inside conversation_config.agent.prompt:
Workspace environment variables can resolve per-environment server tool URLs, headers, and auth connections, and runtime system variables such as {{system__conversation_history}} can pass full conversation context into tool calls when needed.
"prompt": {
"prompt": "You are a helpful assistant that can check the weather.",
"llm": "gemini-2.0-flash",
"tools": [
# Webhook: server-side API call
{"type": "webhook", "name": "get_weather", "description": "Get weather",
"api_schema": {"url": "https://api.example.com/weather", "method": "POST",
"request_body_schema": {"type": "object", "properties": {"location": {"type": "string"}}, "required": ["location"]}}},
# Client: runs in the browser
{"type": "client", "name": "show_product", "description": "Display a product",
"parameters": {"type": "object", "properties": {"productId": {"type": "string"}}, "required": ["productId"]}}
],
"built_in_tools": {
"end_call": {},
"transfer_to_number": {"transfers": [{"transfer_destination": {"type": "phone", "phone_number": "+1234567890"}, "condition": "User asks for human support"}]}
}
}
Client tools run in browser:
clientTools: {
show_product: async ({ productId }) => {
document.getElementById("product").src = `/products/${productId}`;
return { success: true };
}
}
See Client Tools Reference for complete documentation.
<elevenlabs-convai agent-id="your-agent-id"></elevenlabs-convai>
<script src="https://unpkg.com/@elevenlabs/convai-widget-embed" async type="text/javascript"></script>
Customize with attributes: avatar-image-url, action-text, start-call-text, end-call-text.
See Widget Embedding Reference for all options.
Make outbound phone calls using your agent via Twilio integration:
response = client.conversational_ai.twilio.outbound_call(
agent_id="your-agent-id",
agent_phone_number_id="your-phone-number-id",
to_number="+1234567890",
call_recording_enabled=True
)
print(f"Call initiated: {response.conversation_id}")
const response = await client.conversationalAi.twilio.outboundCall({
agentId: "your-agent-id",
agentPhoneNumberId: "your-phone-number-id",
toNumber: "+1234567890",
callRecordingEnabled: true,
});
curl -X POST "https://api.elevenlabs.io/v1/convai/twilio/outbound-call" \
-H "xi-api-key: $ELEVENLABS_API_KEY" -H "Content-Type: application/json" \
-d '{"agent_id": "your-agent-id", "agent_phone_number_id": "your-phone-number-id", "to_number": "+1234567890", "call_recording_enabled": true}'
See Outbound Calls Reference for configuration overrides and dynamic variables.
# List agents and check status
elevenlabs agents list
elevenlabs agents status
# Import agents from platform to local config
elevenlabs agents pull # Import all agents
elevenlabs agents pull --agent <agent-id> # Import specific agent
# Push local changes to platform
elevenlabs agents push # Upload configurations
elevenlabs agents push --dry-run # Preview changes first
# Add tools
elevenlabs tools add-webhook "Weather API"
elevenlabs tools add-client "UI Tool"
The CLI creates a project structure for managing agents:
your_project/
├── agents.json # Agent definitions
├── tools.json # Tool configurations
├── tests.json # Test configurations
├── agent_configs/ # Individual agent configs
├── tool_configs/ # Individual tool configs
└── test_configs/ # Individual test configs
# List
agents = client.conversational_ai.agents.list()
# Get
agent = client.conversational_ai.agents.get(agent_id="your-agent-id")
# Update (partial - only include fields to change)
client.conversational_ai.agents.update(agent_id="your-agent-id", name="New Name")
client.conversational_ai.agents.update(agent_id="your-agent-id",
conversation_config={
"agent": {"prompt": {"prompt": "New instructions", "llm": "claude-sonnet-4"}}
})
# Delete
client.conversational_ai.agents.delete(agent_id="your-agent-id")
See Agent Configuration for all configuration options and SDK examples.
try:
agent = client.conversational_ai.agents.create(...)
except Exception as e:
print(f"API error: {e}")
Common errors: 401 (invalid key), 404 (not found), 422 (invalid config), 429 (rate limit)
Weekly Installs
1.6K
Repository
GitHub Stars
142
First Seen
Jan 28, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
codex1.2K
gemini-cli1.2K
opencode1.2K
github-copilot1.1K
claude-code1.0K
kimi-cli996
99,500 周安装
claude-sonnet-4-6claude-sonnet-4-5claude-sonnet-4claude-haiku-4-5claude-3-7-sonnetclaude-3-5-sonnetclaude-3-haikugemini-3.1-flash-lite-preview, gemini-3-pro-preview, gemini-3-flash-preview, gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.0-flash, gemini-2.0-flash-lite |
| ElevenLabs | glm-45-air-fp8, qwen3-30b-a3b, gpt-oss-120b |
| Custom | custom-llm (bring your own endpoint) |