https://retellai.com/?utm_source=discord&utm_medium=seo logo
hello new to retell, does it support dynamic agent...
# ❓・ai-evy-support
s
@AI Evy hello new to retell, does it support dynamic agent selection via API if i have say a single phone number in my environment. Is there a way to enable that?
a
Thanks for tagging me @songyuanyi. I'll look through relevant sources and get back to you shortly.
### Answer Yes, Retell AI supports dynamic agent selection via API for scenarios where you have a single phone number. You can use the override_agent_id field when making a call through the API to specify which agent should handle that particular call, even if the underlying phone number stays the same. This enables you to programmatically select different agents as needed for each outbound call [(1) ]() . For example, when creating a phone call:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const phoneCallResponse = await client.call.createPhoneCall({
  from_number: '+14157774444',
  to_number: '+12137774445',
  override_agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
}) ;
console.log(phoneCallResponse.agent_id) ;
This approach allows you to route calls to different agents dynamically through the API, without needing multiple phone numbers .
​ To learn more, see the sources I considered: [[1] Create Phone Call](https://docs.retellai.com/api-references/create-phone-call) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.