madhav_89676
09/09/2025, 11:47 AMAI Evy
09/09/2025, 11:47 AMAI Evy
09/09/2025, 11:48 AMjavascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const agentResponse = await client.agent.update('16b980523634a6dc504898cda492e939', { agent_name: 'Jarvis' }) ;
console.log(agentResponse.agent_id) ;
[(3) ]()
## Function Calling for Actions
For callback scheduling and appointment booking, you can implement function calling [(4) ]() . This allows your agent to take actions like booking appointments or scheduling callbacks:
export interface FunctionCall {
id: string;
funcName: string;
rguments: Record<string, any>;
result?: string;
}
// some class boilerplate codes
private PrepareFunctions() : ChatCompletionsFunctionToolDefinition[] {
let functions: ChatCompletionsFunctionToolDefinition[] = [{
type: "function",
function: {
name: "end_call",AI Evy
09/09/2025, 11:48 AMAI Evy
09/09/2025, 11:48 AMAI Evy
09/09/2025, 11:48 AMmadhav_89676
09/09/2025, 11:51 AMmadhav_89676
09/09/2025, 11:54 AMAI Evy
09/09/2025, 11:54 AMAI Evy
09/09/2025, 11:54 AMjson
{
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "The city of the weather"
}
},
"required": [
"city"
]
}AI Evy
09/09/2025, 11:54 AM{{call_type}} or {{appointment_time}} .
## Single Number Configuration
For using a single number for all calls, you'll need to configure your phone number settings in the agent configuration [(2) ]() . The voice settings and call settings can be configured to maintain consistency across all outbound calls .
## Custom Function Implementation
To handle different scripts, you can create a custom function that:
1. Receives the call context (callback vs appointment reminder)
2. Returns the appropriate script or talking points
3. Uses dynamic variables to personalize the conversation [(1) ]()
The function execution process works as follows [(3) ]() :
1. **Agent Decision**: Based on the conversation context, the LLM determines when a function is needed
2. **Parameter Extraction**: The agent extracts required information from the conversation
3. **Function Execution**: Retell calls your function with the extracted parameters
4. **Response Handling**: The function result is processed and incorporated into the conversation
However, the specific implementation details for scheduling callbacks at exact times and appointment reminders would require custom backend development that integrates with Retell's webhook system. The available sources don't provide complete guidance on the automated scheduling system you're looking to build.
Would you like me to provide general guidance on how such scheduling systems typically work with voice AI platforms?AI Evy
09/09/2025, 11:54 AMAI Evy
09/09/2025, 11:54 AMmadhav_89676
09/09/2025, 12:23 PMAI Evy
09/09/2025, 12:23 PMAI Evy
09/09/2025, 12:23 PMAI Evy
09/09/2025, 12:23 PMAI Evy
09/09/2025, 12:23 PMjavascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const conversationFlowResponse = await client.conversationFlow.create({
model_choice: { model: 'gpt-5', type: 'cascading' },
nodes: [
{
id: 'start',
instruction: { text: 'Greet the customer and ask how you can help them.', type: 'prompt' },
type: 'conversation',
},
],
start_speaker: 'agent',
}) ;
## Best Practice Structure
Use sectional prompts within your Conversation Flow nodes [(3) ]() . Break large prompts into focused sections for better organization and LLM comprehension :
- **Identity section**: Define your agent's role and expertise
- **Style Guardrails**: Set tone and response length
- **Response Guidelines**: Specify formatting and interaction patterns
For your specific needs with callbacks and appointment reminders, you can create separate nodes with tailored instructions for each scenario, ensuring consistent and appropriate responses for different call contexts.AI Evy
09/09/2025, 12:23 PMmadhav_89676
09/09/2025, 12:25 PMAI Evy
09/09/2025, 12:25 PMAI Evy
09/09/2025, 12:26 PMAI Evy
09/09/2025, 12:26 PMAI Evy
09/09/2025, 12:26 PMAI Evy
09/09/2025, 12:26 PMAI Evy
09/09/2025, 12:41 PMmadhav_89676
09/09/2025, 12:42 PMAI Evy
09/09/2025, 12:42 PMAI Evy
09/09/2025, 12:42 PMAI Evy
09/09/2025, 12:42 PMAI Evy
09/09/2025, 12:42 PMmadhav_89676
09/09/2025, 8:44 PMAI Evy
09/09/2025, 8:44 PMAI Evy
09/09/2025, 8:45 PM3. Confirm the date, time, and timezone selected by user: "Just to confirm, you want to book the appointment at ...". Make sure this is a time from the available slots.
4. Once confirmed, call function book_appointment to book the appointment.
## Step 6: Create Custom Functions for Integration
Set up custom functions for your GHL integration and scheduling [(3) ]() . Configure the function with:
- Name (e.g., schedule_callback)
- Description for the LLM
- HTTP method (POST recommended)
- Endpoint URL for your backend
- Parameter schema for callback timing and user details
## Step 7: Use API for Multi-Prompt Creation
For programmatic creation, use the Retell API with states configuration [(4) ]() . The API endpoint supports multi-prompt agent creation through the states parameter structure.
## Important Considerations
Multi-prompt agents can experience behavioral drift, function calling issues, and context confusion as complexity increases [(5) ]() . Consider upgrading when your prompt exceeds 500 words or uses more than 3 functions .
For your specific requirements (exact callback timing, appointment reminders, GHL integration) , you'll need custom backend development to handle the scheduling logic that integrates with Retell's webhook system.AI Evy
09/09/2025, 8:45 PM7. Ask if user is interested in an in person tour.
- if yes, transition to schedule_tour.
- if no or hesitant, call function end_call to hang up politely and say will reach out if any other interesting properties pop up.
## Step 3: Structure Your Prompts by Section
Use sectional prompts for better organization [(2) ]() :
///## Identify
You are a friendly AI assistant for Retell AI. ....
///## Style Guardrails
Be concise: ...
Be conversational: ...
...
///## Response Guideline
Return dates in their spoken forms: ...
Ask up to one question at a time: ...
...
///## Task
1. Greet the user
...
## Step 4: Write Tasks as Sequential Steps
For reliable conversation flow, structure your tasks as numbered steps :
///## Task
1. Ask for user's name.
2. Ask if user needs a refund, need a replacement, or just retriving information.
- if user needs a refund, transition to refund state.
- if user needs a replacement, transition to replacement state.
3. If user is just retriving information, ask for the order number.
...AI Evy
09/09/2025, 8:45 PMAI Evy
09/09/2025, 8:45 PMmadhav_89676
09/09/2025, 8:48 PMAI Evy
09/09/2025, 8:48 PMAI Evy
09/09/2025, 8:48 PM///## Identity
You are a friendly AI assistant for [Company Name].
Your role is to [specific purpose].
You have expertise in [relevant domains].
///## Style Guardrails
Be concise: Keep responses under 2 sentences unless explaining complex topics.
Be conversational: Use natural language, contractions, and acknowledge what the caller says.
Be empathetic: Show understanding for the caller's situation.
///## Response Guidelines
Return dates in spoken form: Say "January fifteenth" not "1/15".
Ask one question at a time: Avoid overwhelming the caller with multiple questions.
Confirm understanding: Paraphrase important information back to the caller.
///## Task Instructions
[Specific steps the agent should follow]
///## Objection Handling
If the caller says they're not interested: "I understand. Is there anything specific..."
If the caller is frustrated: "I hear your frustration, let me help resolve this..."AI Evy
09/09/2025, 8:48 PM7. Ask if user is interested in an in person tour.
- if yes, transition to schedule_tour.
- if no or hesitant, call function end_call to hang up politely and say will reach out if any other interesting properties pop up.
## Step 3: Configure Function Calling
Define when to call functions for your specific actions :
3. Confirm the date, time, and timezone selected by user: "Just to confirm, you want to book the appointment at ...". Make sure this is a time from the available slots.
4. Once confirmed, call function book_appointment to book the appointment.
## Step 4: Use Recommended Prompt Structure
Structure your prompts using sections for better LLM processing [(2) ]() :AI Evy
09/09/2025, 8:48 PMAI Evy
09/09/2025, 8:48 PMAI Evy
09/09/2025, 8:48 PMmadhav_89676
09/09/2025, 8:49 PMmadhav_89676
09/09/2025, 8:50 PMAI Evy
09/09/2025, 8:50 PMAI Evy
09/09/2025, 8:50 PMAI Evy
09/09/2025, 8:50 PMAI Evy
09/09/2025, 8:50 PMAI Evy
09/09/2025, 8:50 PM