Loading...
Loading...
Build voice AI agents with ElevenLabs. Use when creating voice assistants, customer service bots, interactive voice characters, or any real-time voice conversation experience.
npx skill4agent add elevenlabs/skills agentsSetup: See Installation Guide for CLI and SDK setup.
# 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 default
# Push to ElevenLabs platform
elevenlabs agents pushdefaultminimalvoice-onlytext-onlycustomer-serviceassistantfrom elevenlabs.client import ElevenLabs
client = ElevenLabs()
agent = client.conversational_ai.agents.create(
name="My Assistant",
conversation_config={
"agent": {"first_message": "Hello! How can I help?", "language": "en"},
"tts": {"voice_id": "JBFqnCBsd6RMkjVDRZzb"}
},
prompt={
"prompt": "You are a helpful assistant. Be concise and friendly.",
"llm": "gpt-4o-mini",
"temperature": 0.7
}
)import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
const client = new ElevenLabsClient();
const agent = await client.conversationalAi.agents.create({
name: "My Assistant",
conversationConfig: {
agent: { firstMessage: "Hello! How can I help?", language: "en" },
tts: { voiceId: "JBFqnCBsd6RMkjVDRZzb" }
},
prompt: { prompt: "You are a helpful assistant.", llm: "gpt-4o-mini", temperature: 0.7 }
});curl -X POST "https://api.elevenlabs.io/v1/convai/agents/create" \
-H "xi-api-key: $ELEVENLABS_API_KEY" -H "Content-Type: application/json" \
-d '{"name": "My Assistant", "conversation_config": {"agent": {"first_message": "Hello!", "language": "en"}, "tts": {"voice_id": "JBFqnCBsd6RMkjVDRZzb"}}, "prompt": {"prompt": "You are helpful.", "llm": "gpt-4o-mini"}}'signed_url = client.conversational_ai.conversations.get_signed_url(agent_id="your-agent-id")import { Conversation } from "@elevenlabs/client";
const conversation = await Conversation.startSession({
agentId: "your-agent-id",
onMessage: (msg) => console.log("Agent:", msg.message),
onUserTranscript: (t) => console.log("User:", t.message),
onError: (e) => console.error(e)
});import { useConversation } from "@elevenlabs/react";
const conversation = useConversation({ onMessage: (msg) => console.log(msg) });
// Get signed URL from backend, then:
await conversation.startSession({ signedUrl: token });| Provider | Models |
|---|---|
| OpenAI | |
| Anthropic | |
| |
| Custom | |
JBFqnCBsd6RMkjVDRZzbEXAVITQu4vr4xnSDxMaLonwK4e9ZLuTAKqWW03F9XB0fDUnXU5powFXDhCwaserver_vadturn_basedtools=[
# Webhook: server-side API call
{"type": "webhook", "name": "get_weather", "description": "Get weather",
"webhook": {"url": "https://api.example.com/weather", "method": "POST"},
"parameters": {"type": "object", "properties": {"location": {"type": "string"}}, "required": ["location"]}},
# System: built-in capabilities
{"type": "system", "name": "end_call"},
{"type": "system", "name": "transfer_to_number", "phone_number": "+1234567890"}
]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-urlaction-textstart-call-textend-call-textresponse = client.conversational_ai.twilio.outbound_call(
agent_id="your-agent-id",
agent_phone_number_id="your-phone-number-id",
to_number="+1234567890"
)
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",
});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"}'# 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 to agents
elevenlabs agents tools add "Weather API" --type webhook --config-path ./weather.jsonyour_project/
├── agents.json # Agent definitions
├── tools.json # Tool configurations
├── agent_configs/ # Individual agent configs
└── tool_configs/ # Individual tool 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",
prompt={"prompt": "New instructions", "llm": "claude-3-5-sonnet"})
# Delete
client.conversational_ai.agents.delete(agent_id="your-agent-id")try:
agent = client.conversational_ai.agents.create(...)
except Exception as e:
print(f"API error: {e}")