#is it possible to create only one agent that can talk like an outbound outreach as well as inbound
1 messages · Page 1 of 1 (latest)
Short answer: You can use a single ElevenLabs agent for both inbound and outbound calls, and switch its behavior per call direction at runtime. You do not need two separate agents for this use case.
How to implement it
- One agent, both directions: A Twilio number imported via the native integration can be assigned to an agent for inbound calls and used by the same agent for outbound calls. Verified Caller IDs are outbound-only. (elevenlabs.io)
- Change behavior per direction without duplicating agents:
- Use Overrides or Dynamic Variables to alter the system prompt and first message at conversation start (e.g., âoutbound outreach scriptâ vs. âinbound support greetingâ). Overrides are explicitly designed to avoid creating multiple agents; Dynamic Variables can also expose call context like caller/called numbers. (elevenlabs.io)
- Outbound: when initiating a call via the outbound-call API, pass conversation_initiation_client_data to set direction-specific first_message and/or prompt. (elevenlabs.io)
- Inbound (native Twilio): configure the Twilio personalization webhook so ElevenLabs fetches your conversation initiation data on each incoming call, letting you inject inbound-specific overrides or variables. (elevenlabs.io)
- If you keep your own Twilio flow (register-call), you can set the direction parameter (inbound/outbound) and also pass conversation_initiation_client_data to tailor behavior. (elevenlabs.io)
Reference capability note
- The integration is designed for seamless inbound/outbound handling with a single agent and single integration path. (elevenlabs.io)
In summary: Yesâcreate one agent and switch its role at runtime using overrides/dynamic variables provided via outbound-call payloads or inbound webhooks; only create a second agent if you explicitly want completely separate configurations you donât plan to control at runtime. (elevenlabs.io)
Sources:
Twilio native integration | ElevenLabs Documentation
Overrides | ElevenLabs Documentation
Outbound call via twilio | ElevenLabs Documentation
Twilio personalization | ElevenLabs Documentation
Register call | ElevenLabs Documentation
Connect Twilio to ElevenLabs Conversational AI Voice Agents
Overrides | ElevenLabs Documentation
what condition to hardcode in the prompt
Use a dynamic variable that tells the agent the call direction, then branch on it in the system prompt.
Recommended approach
- Pass call_direction at conversation start:
- Inbound via Twilio webhook: return conversation_initiation_client_data with dynamic_variables: { "call_direction": "inbound" }. (elevenlabs.io)
- Outbound via API: include conversation_initiation_client_data when calling the outbound Twilio endpoint. (elevenlabs.io)
- In your system prompt, add explicit instructions using the injected variable:
- âIf {{call_direction}} == 'outbound', act as an outreach SDR. If {{call_direction}} == 'inbound', act as a support assistant.â Dynamic variables are inserted with {{...}} and are fixed for the system prompt at conversation start. (elevenlabs.io)
Alternative (no extra variable)
- Infer direction from telephony system variables:
- Use {{system__caller_id}} and {{system__called_number}}. For example: âTreat the call as inbound if {{system__called_number}} is one of our business numbers; otherwise treat it as outbound.â These system variables are available in prompts. (elevenlabs.io)
Notes
- There is no documented system variable named call_direction inside the prompt; you either pass your own dynamic variable or instruct the agent using system__caller_id/system__called_number. (elevenlabs.io)
- The Twilio register-call API also accepts a direction field (âinboundâ/âoutboundâ), which you can mirror into your call_direction dynamic variable. (elevenlabs.io)
References:
- Dynamic variables (syntax, system variables). (elevenlabs.io)
- Twilio personalization webhook (set dynamic variables for inbound). (elevenlabs.io)
- Outbound call API (pass initiation data). (elevenlabs.io)
can you give me a step by step solution
Below is a singleâagent, inbound/outbound setup you can implement using only documented features.
- Create one agent with a dualârole prompt
- In Agents Platform > create an agent. Set a neutral âFirst messageâ and âSystem prompt.â (elevenlabs.io)
- Add a dynamic variable placeholder in the prompt: include âcall_direction = {{call_direction}}â and instruct behavior for each case (e.g., âIf call_direction is inbound, act as an assistant; if outbound, act as outreach and open proactively.â). Dynamic variables use double curly braces and can be inserted in both prompts and first messages. (elevenlabs.io)
- Enable perâcall overrides (optional but recommended)
- In the agentâs Security tab, enable overrides for First message and/or System prompt so you can swap the opener or tone per call without making multiple agents. (elevenlabs.io)
- Inbound calls (Twilio, native integration)
- Import or connect your Twilio number and assign this agent; it will handle inbound calls to that number. (elevenlabs.io)
- If you want the agent to âknowâ itâs an inbound call and/or customize the greeting, configure the Twilio Personalization webhook. Your webhook receives caller_id, called_number, etc. and returns conversation initiation data. Return:
- dynamic_variables: { "call_direction": "inbound", ... }
- optionally conversation_config_override: { agent: { first_message: "...", prompt: { prompt: "..." } } }
The platform applies this before the call audio starts. (elevenlabs.io)
- Outbound calls (single agent)
Pick one of these documented paths:
-
Native Twilio integration (dashboard button/batch calls):
- Start an outbound call from your connected number and select the same agent. Ensure your agentâs First message is written for an opening line (since the agent initiates). (elevenlabs.io)
- For large campaigns, use Batch Calling and select this same agent. (elevenlabs.io)
Note: the dashboard flow doesnât inject custom variables per call; use a webhook/API approach if you need perâcall branching.
-
Register Call API (full control; supports âdirectionâ and perâcall data):
- From your server, create the Twilio call and point Twilioâs webhook to your handler.
- In your handler, call ElevenLabs register_call with:
- agent_id = your single agent
- direction = "outbound"
- conversation_initiation_client_data.dynamic_variables = { "call_direction": "outbound", ... }
- (optional) conversation_initiation_client_data.conversation_config_override.agent.first_message = "âŠ" for an outreach opener
ElevenLabs returns TwiML to connect the call to your agent. (elevenlabs.io)
- Prompt condition to âhardcodeâ
- Rely on the dynamic variable you pass: call_direction â {"inbound","outbound"}.
- Example structure inside your System prompt (use your own content): âcall_direction = {{call_direction}}. If inbound: wait for caller context, handle support. If outbound: open with the outreach first_message, confirm identity/consent, and proceed.â Dynamic variable syntax and usage are documented; the logic instructions live in your prompt. (elevenlabs.io)
6
how to setup twilio webhook
Below are the two âTwilio webhookâ setups you might need. Pick the one that matches your goal, or use both.
A) Twilio â your server (to connect phone calls to an ElevenLabs Agent)
- Prereqs: In your Agent, set both TTS output and input audio format to Ό-law 8000 Hz. (elevenlabs.io)
- Expose a public HTTPS endpoint (e.g., /twilio/inbound). For local dev you can use ngrok. (elevenlabs.io)
- In Twilio Console, open Phone Numbers â Manage â Active numbers â your number â Voice Configuration, set the webhook URL to your endpoint and method to POST. (elevenlabs.io)
- In your endpoint, read Twilioâs form fields (From, To), call ElevenLabsâ register_call with agent_id, from_number, to_number, and optional conversation_initiation_client_data, then return the TwiML ElevenLabs gives you directly back to Twilio. The docs provide working Python/TypeScript examples. (elevenlabs.io)
- For outbound: place the call with Twilioâs API and point the callâs URL to another webhook (e.g., /twilio/outbound) that also calls register_call with direction="outbound". (elevenlabs.io)
Notes: This âregister callâ approach keeps full control in your Twilio account; call transfers arenât available in this mode. (elevenlabs.io)
B) ElevenLabs â your server (to personalize inbound Twilio calls before the Agent speaks)
- In ElevenLabs Agents Platform â Settings, set your webhook URL and add any secrets (these are sent in headers). (elevenlabs.io)
- In the target Agent â Security tab, enable âfetch conversation initiation data for inbound Twilio callsâ and choose which fields may be overridden. (elevenlabs.io)
- Implement the webhook to accept a POST containing caller_id, agent_id, called_number, and call_sid. (elevenlabs.io)
- Respond with JSON type "conversation_initiation_client_data" including:
- dynamic_variables: provide all variables defined on the Agent
- conversation_config_override: optional per-call overrides (e.g., prompt, voice_id, first_message, language)
An example schema is in the docs. (elevenlabs.io)
- Security: use HTTPS, authenticate via headers, store secrets in the ElevenLabs secrets manager, and ensure the webhook responds promptly. (elevenlabs.io)
If you prefer not to manage Twilio webhooks yourself, the ânative Twilio integrationâ in ElevenLabs handles configuration automatically when you import your number.
how to use branches
Hereâs how to use branches in the ElevenLabs Agents Platform (Agent Versioning):
- Enable versioning on the agent (either at creation with enable_versioning or by updating an existing agent). Note: once enabled, it canât be disabled. (elevenlabs.io)
- Create a branch from any version on Main. Branches have ids (agtbrch_xxxx), names/descriptions, and follow naming rules (letters/numbers and () [] {} - / . up to 140 chars). (elevenlabs.io)
- Make changes on a branch and commit by updating the agent with branch_id; each commit creates an immutable version on that branch. Drafts are per-user/per-branch and are discarded on commit or merge. (elevenlabs.io)
- Deploy traffic by creating a deployment that splits 100% across branches; routing is deterministic by conversation ID. (elevenlabs.io)
- Merge back to Main when satisfied. Merging creates a new Main version from the source branch, transfers traffic, and (by default) archives the source branch. Only merges into Main are supported. (elevenlabs.io)
- Manage branches: list/get details, archive only when the branch has 0% traffic, and unarchive by setting archived=false. You can also fetch the agent at a branch tip (and optionally include_draft). (elevenlabs.io)
Documentation: Agent versioning and branches. (elevenlabs.io)
Sources:
Agent versioning | ElevenLabs Documentation
Agent versioning | ElevenLabs Documentation
Agent versioning | ElevenLabs Documentation
Agent versioning | ElevenLabs Documentation
Agent versioning | ElevenLabs Documentation
Agent versioning | ElevenLabs Documentation
Agent versioning | ElevenLabs Documentation
can i initiate call using branch id of the agent