Zohaib
10/03/2025, 6:17 AMAI Evy
10/03/2025, 6:17 AMAI Evy
10/03/2025, 6:18 AMjavascript
// Example retry logic
const maxRetries = 3;
let retryDelay = 1000; // Start with 1 second
for (let i = 0; i < maxRetries; i++) {
try {
await makeCall() ;
break;
} catch (error) {
if (error.code === 'rate_limited') {
await sleep(retryDelay) ;
retryDelay *= 2; // Exponential backoff
}
}
}AI Evy
10/03/2025, 6:18 AMAI Evy
10/03/2025, 6:18 AMAI Evy
10/03/2025, 6:18 AMZohaib
10/03/2025, 6:37 AMAI Evy
10/03/2025, 6:37 AMAI Evy
10/03/2025, 6:37 AMjavascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const concurrency = await client.concurrency.retrieve() ;
console.log(concurrency.base_concurrency) ;AI Evy
10/03/2025, 6:37 AMcurrent_concurrency and concurrency_limit [(3) ]() .
3. Process calls in batches - when calls complete and concurrency drops below 20, initiate the next batch of calls.
AI voice agents scale non-linearly, so doubling your call volume doesn't require doubling the amount of agents. Depending on the platform, one agent can handle tens to hundreds of calls [(4) ]() .
If you need to process all 100 calls simultaneously, you would need to upgrade your concurrency limit through the "Billing" page [(2) ]() .AI Evy
10/03/2025, 6:37 AMAI Evy
10/03/2025, 6:37 AMZohaib
10/03/2025, 6:39 AMAI Evy
10/03/2025, 6:39 AMAI Evy
10/03/2025, 6:39 AMjavascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const batchCallResponse = await client.batchCall.createBatchCall({
from_number: '+14157774444',
tasks: [{ to_number: '+12137774445' }],
}) ;
console.log(batchCallResponse.batch_call_id) ;
The batch call API accepts the following key parameters :
- `from_number`: Your purchased Retell number in E.164 format
- `tasks`: An array of call tasks, each with a to_number
- `retell_llm_dynamic_variables`: Optional dynamic variables for personalizing calls
Key advantages of batch calling [(2) ]() :
- **Send Now**: Dispatch all calls immediately
- **Scheduled Time**: Send calls at a scheduled time
- **No concurrency limits**: Batch calling queues your calls without hitting concurrency limits, ensuring a seamless experience
- **Cost**: $0.005 per dial (20k calls for $100)
The batch calling feature enables you to efficiently manage multiple calls by organizing them into groups [(3) ]() . You can create, schedule, and monitor calls in bulk, streamlining communication workflows .
For your 100-prospect campaign, batch calling would automatically handle the queuing and execution without you needing to manage the 20 concurrency limit manually.AI Evy
10/03/2025, 6:39 AMAI Evy
10/03/2025, 6:39 AMAI Evy
10/03/2025, 6:47 AMZohaib
10/03/2025, 6:47 AMAI Evy
10/03/2025, 6:47 AMcreate_phone_call, you have two main options to ensure all 100 calls get completed:
## Option 1: Switch to Batch Calling (Recommended)
The easiest solution is to use Retell AI's batch calling feature, which automatically handles queuing without concurrency limits [(1) ]() . Here's how to convert your current logic:
python
# Convert your current logic to batch calling
tasks = []
for prospect in prospects:
tasks.append({
"to_number": prospect.phoneNumber,
"retell_llm_dynamic_variables": {
"user_name": prospect.name,
"business_name": prospect.businessName,
"owner_name": prospect.ownerName,
"phoneNumber": prospect.phoneNumber,
"campaign_id": prospect.campaignId
}
})
batch_call_response = client.batchCall.createBatchCall({
"from_number": from_number,
"tasks": tasks
})
## Option 2: Implement Concurrency Management
If you need to stick with individual calls, you'll need to implement concurrency tracking. The documentation recommends implementing retry logic with exponential backoff to handle throttling gracefully [(2) ]() :
javascript
// Example retry logic
const maxRetries = 3;
let retryDelay = 1000; // Start with 1 second
for (let i = 0; i < maxRetries; i++) {
try {
await makeCall() ;
break;
} catch (error) {
if (error.code === 'rate_limited') {
await sleep(retryDelay) ;
retryDelay *= 2; // Exponential backoff
}
}
}AI Evy
10/03/2025, 6:47 AMAI Evy
10/03/2025, 6:48 AMAI Evy
10/03/2025, 6:48 AMZohaib
10/03/2025, 6:57 AMAI Evy
10/03/2025, 6:57 AMAI Evy
10/03/2025, 6:57 AMAI Evy
10/03/2025, 6:57 AMAI Evy
10/03/2025, 6:57 AMAI Evy
10/03/2025, 6:57 AM