https://retellai.com/?utm_source=discord&utm_medium=seo logo
Is the agent able to retrieve and review summaries...
# ❓・ai-evy-support
j
@AI Evy @AINerd @retell questions Is the agent able to retrieve and review summaries of prior calls? In a callback or follow-up scenario, what prompt or lookup mechanism allows the agent to access previous call records using the same phone number or other unique identifiers?
a
Thanks for tagging me @Jake Concha. I'll look through relevant sources and get back to you shortly.
### Answer Retell AI agents don't have built-in access to prior call summaries or historical call records. However, you can implement this functionality using a combination of features: ## Approach for Callback/Follow-up Scenarios 1. Use the caller's phone number as an identifier For phone calls, the system variable
{{user_number}}
contains the user's phone number (from_number for inbound, to_number for outbound) . [(1) ]() 2. Build a custom function to retrieve prior call data Create a Custom Function that queries your own database/CRM using the caller's phone number. The function/tool call should return the user details, which you will then be able to use during the call. [(2) ]() 3. Inject retrieved data via Dynamic Variables For inbound calls, you can supply dynamic variables in the Inbound Call Webhook. [(1) ]() For outbound calls, set your variables in the
retell_llm_dynamic_variables
field when using the Create Phone Call API:
Copy code
json
{
  "user_name": "John Smith",
  "product_name": "Premium Plan",
  "account_status": "active"
}
4. Store call summaries using Post-Call Analysis Post-call analysis automatically analyzes customer conversations after they have ended. [(3) ]() You can extract text data like call summaries and action items. Store these summaries in your database, then retrieve them via your custom function on subsequent calls. ## Recommended Workflow 1. When a call ends, use the
call_analyzed
webhook to capture the summary and store it in your database keyed by phone number 2. On the next inbound call, use the Inbound Call Webhook to look up prior call data using
{{user_number}}
3. Pass the retrieved summary as a dynamic variable to the agent's prompt
​ To learn more, see the sources I considered: [[1] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[2] Populating dynamic variables (caller details) based on the entity provided by the user (inbound)](https://discord.com/channels/1186424376300679209/1257709468251066439) [[3] Post Call Analysis Overview](https://docs.retellai.com/features/post-call-analysis-overview) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.