https://retellai.com/?utm_source=discord&utm_medium=seo logo
Do custom functions return data synchronously duri...
# ❓・ai-evy-support
k
@AI Evy Do custom functions return data synchronously during live calls? Can the agent receive and use the response immediately? Or do functions only work asynchronously/after the call?
a
Thanks for tagging me @kait_23901. I'll look through relevant sources and get back to you shortly.
### Answer Yes, custom functions work synchronously during live calls [(1) ]() [(2) ]() . When the LLM determines a function is needed, Retell sends a POST request to your specified endpoint with the function name and parameters [(1) ]() . The agent can receive and use the response immediately during the conversation [(2) ]() . How it works: 1. **Agent Decision**: The LLM determines when a function is needed based on conversation context 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 The function calling uses structured JSON to communicate between the LLM and your systems :
Copy code
json
{
 "function": "book_appointment",
 "arguments": {
 "date": "2024-03-15",
 "time": "14:00",
 "customer_name": "John Smith"
 }
}
Custom functions enable real-time actions like checking availability, booking appointments, processing orders, retrieving information from CRMs, and updating records—all during the live call .
​ To learn more, see the sources I considered: [[1] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) [[2] Function Calling Overview](https://docs.retellai.com/build/single-multi-prompt/function-calling) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.