Reed
10/27/2025, 6:54 AMAI Evy
10/27/2025, 6:54 AMAI Evy
10/27/2025, 6:55 AMgeneral_tools parameter [(1) ]() . Here's how to structure it:
python
llm_response = self.client.llm.create(
model="gpt-5-nano",
model_temperature=0.8,
general_prompt=agent_prompt,
general_tools=self._get_custom_functions()
)
[(2) ]()
The custom function structure follows this format:
python
{
"name": "send_email",
"type": "custom",
"url": "<https://some_real_url.app/api/tools/send-email%22,>
"description": "sends an email to an email address",
"headers": {},
"method": "POST",
"query_params": {},
"parameters": {
"type": "object",
"properties": {
"body": {
"type": "string",
"description": "Email body",
},
"subject": {
"type": "string",
"description": "Email subject line based on the call content",
},
"to": {
"type": "array",
"items": {"type": "string"},
"description": 'Array of email addresses',
},
},
"required": ["to", "subject", "body"],
},
"response_variables": {},
"timeout_ms": 15000,
"tool_id": "tool-send-email",
}
[(3) ]()
The parameters should be defined using JSON schema format [(4) ]() . When Retell calls your custom function, it sends a POST request to your specified URL with the function name and parameters .
**AI Evy
10/27/2025, 6:55 AMAI Evy
10/27/2025, 6:55 AMReed
10/27/2025, 7:03 AMAI Evy
10/27/2025, 7:03 AMAI Evy
10/27/2025, 7:04 AMllm_id, but the custom functions themselves are defined within the LLM configuration .
Here's the flow:
1. Create your LLM with custom functions defined in the general_tools parameter
2. Create your agent and attach the LLM using the response_engine parameter
For example, when creating an agent with the Python SDK:
python
const agentResponse = await client.agent.create({
response_engine: { llm_id: 'llm_234sdertfsdsfsdf', type: 'retell-llm' },
voice_id: '11labs-Adrian',
}) ;
[(3) ]()
The llm_id references your previously created LLM that already has the custom functions configured .
So to answer your question directly: custom functions should be added during LLM creation, and then you attach that LLM to your agent during agent creation [(1) ]() .
**AI Evy
10/27/2025, 7:09 AMAI Evy
10/27/2025, 7:09 AMReed
10/27/2025, 7:19 AMAI Evy
10/27/2025, 7:19 AMAI Evy
10/27/2025, 7:19 AMtype value for custom functions is "custom_function", not "custom" [(1) ]() .
When creating a custom function in the Python SDK, use this structure in your general_tools array [(2) ]() :
python
{
"type": "custom_function",
"name": "your_function_name",
"description": "Description of what the function does",
"url": "<https://your-endpoint.com/api/function%22,>
"method": "POST",
"parameters": {
"type": "object",
"properties": {
"param1": {
"type": "string",
"description": "Description of param1"
}
},
"required": ["param1"]
}
}
The error you're seeing occurs because the type field must be one of the allowed values: end_call, transfer_call, check_availability_cal, book_appointment_cal, press_digit, or custom_function [(1) ]() .
Make sure your custom function definition includes [(2) ]() [(3) ]() :
- `type`: Set to "custom_function"
- `name`: Unique identifier with underscores
- `description`: Clear description for the LLM
- `url`: Valid endpoint URL
- `method`: HTTP method (POST, GET, PUT, PATCH, DELETE)
- `parameters`: JSON schema defining the function parameters (for POST, PATCH, PUT)AI Evy
10/27/2025, 7:19 AMAI Evy
10/27/2025, 7:19 AMReed
10/27/2025, 7:31 AMAI Evy
10/27/2025, 7:31 AMAI Evy
10/27/2025, 7:32 AMtype field value used in the SDK for the version you're asking about .
For the most accurate information about SDK version 4.54.0 specifically, I recommend:
Check out these potentially useful sources: [Integrate any system with custom function]() , [Custom Function]()
Would you like me to provide a general answer based on my knowledge instead?AI Evy
10/27/2025, 7:32 AMAI Evy
10/27/2025, 7:32 AMReed
10/27/2025, 7:47 AMColin - Integrations @ Retell AI
10/27/2025, 7:47 AMReed
10/27/2025, 9:21 AMAI Evy
10/27/2025, 9:21 AMAI Evy
10/27/2025, 9:21 AMget_user_details)
- `description`: Clear description for the LLM
- `url`: Valid endpoint URL where Retell sends POST requests
- `method`: HTTP method (POST, GET, PUT, PATCH, DELETE)
- `parameters`: JSON schema defining function parameters (for POST, PATCH, PUT)
The parameters should use JSON schema format with type, properties, and required fields .
Given the error you're experiencing with the type field, and since the team member suggested creating a bug report ticket, it appears there may be an issue with how custom functions are currently being handled in your SDK version.
Check out these potentially useful sources: [Integrate any system with custom function]() , [Integrate Function Calling]()
Would you like me to provide a general answer based on my knowledge instead?AI Evy
10/27/2025, 9:21 AMAI Evy
10/27/2025, 9:21 AMReed
10/27/2025, 9:22 AMAI Evy
10/27/2025, 9:22 AMAI Evy
10/27/2025, 9:22 AMpython
from retell import Retell
client = Retell(api_key=os.environ["RETELL_API_KEY"])
# Define your custom function
custom_function = {
"type": "custom_function",
"name": "check_weather",
"description": "Check the weather for a given city",
"url": "<https://your-endpoint.com/check-weather%22,>
"method": "POST",
"parameters": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "The city to check weather for"
}
},
"required": ["city"]
}
}
# Create LLM with custom function
llm_response = client.llm.create(
model="gpt-4o",
general_prompt="You are a helpful assistant",
general_tools=[custom_function]
)
The custom function structure must include :
- `type`: Set to "custom_function"
- `name`: Unique identifier with underscores
- `description`: Clear description for the LLM
- `url`: Valid endpoint URL
- `method`: HTTP method (POST, GET, PUT, PATCH, DELETE)
- `parameters`: JSON schema defining function parameters (for POST, PATCH, PUT)
When Retell calls your custom function, it sends a request to your specified URL with the function name and parameters .
**AI Evy
10/27/2025, 9:22 AMAI Evy
10/27/2025, 9:22 AM