https://retellai.com/?utm_source=discord&utm_medium=seo logo
how does the agent knowledgebase works
# ❓・ai-evy-support
k
@AI Evy how does the agent knowledgebase works?
a
Thanks for tagging me @krudy. I'll look through relevant sources and get back to you shortly.
### Answer The Knowledge Base enhances your AI agent by providing access to a collection of information sources that can be retrieved during calls to provide additional context [(1) ]() . How It Works: When you create a knowledge base and link it to your agent, the system chunks the source content, embeds it, and stores it in a vector database . During a call, when the agent is about to respond, it uses the transcript so far to find the most relevant chunks from the knowledge base and feeds them to the LLM as context . The agent automatically tries to retrieve information from the knowledge base before responding—no prompt changes needed . Supported Sources: - Website content via URLs - Documents in formats like .pdf, .docx, .txt, .csv, .md, and more - Custom text snippets Key Features: - **Auto-refreshing**: Re-fetches all URLs every 24 hours to ensure latest content - **Auto-crawling**: Automatically crawls all pages under specified URL paths every 24 hours - **Retrieval Settings**: You can configure chunks to retrieve (1-10, default 3) and similarity threshold (default 0.6) Retrieved knowledge base content is appended to the LLM prompt under the header "Related Knowledge Base Contexts" . **
​ To learn more, see the sources I considered: [[1] Knowledge Base](https://docs.retellai.com/build/knowledge-base) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
k
@AI Evy son can I add an excel sheet to retrieve information to the knowledge base?
a
Thanks for the follow-up, @krudy. I'll get back to you soon.
### Answer Yes, you can add Excel sheets to your knowledge base [(1) ]() . The Knowledge Base supports Excel files in the following formats: .xls and .xlsx . File Limits: - Maximum 25 files per knowledge base - Each file can be up to 50MB - For Excel files (.xls, .xlsx) , there's a limit of 1000 rows and 50 columns If you need to work with larger Excel files or more files, you can create multiple knowledge bases and link them all to your agent .
​ To learn more, see the sources I considered: [[1] Knowledge Base](https://docs.retellai.com/build/knowledge-base) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
k
@AI Evy So if want the agent to have information about 20k records with about 10 columns of information, and i separate that into individual files, while I run into accuracy problems when retrieving?
a
Thanks for the follow-up, @krudy. I'll get back to you soon.
### Answer ### Answer With 20k records and 10 columns, you'll need to split your data across multiple files due to the limits [(1) ]() . Each Excel file (.xls, .xlsx) has a limit of 1000 rows and 50 columns . You can create multiple knowledge bases to overcome these limits, and an agent can have more than one knowledge base linked to it . Regarding Accuracy: The retrieval system uses the transcript so far to find the most relevant chunks from the knowledge base and feeds them to the LLM as context . You can configure retrieval settings to optimize accuracy : - **Chunks to retrieve**: The max number of chunks to retrieve from the KB, range 1-10, default 3 - **Similarity Threshold**: Adjust how strict the system is when matching chunks to the context, with a higher setting giving fewer but more similar matches, default 0.6 Increasing "Chunks to retrieve" gives the LLM more context, but also increases the prompt length and can interfere with generation quality . For most cases, the recommended settings are 3 chunks and a 0.60 similarity threshold . Best Practices for Better Accuracy: - Prefer
.md
(Markdown) files over
.txt
, as well-structured Markdown is chunked and retrieved more accurately - Group related information within the same section so chunks remain cohesive and relevant - Avoid ambiguity and use specificity in references, including names, dates, units, and avoiding ambiguous pronouns like
it
or
this
, because prior chunks may not be present
​ To learn more, see the sources I considered: [[1] Knowledge Base](https://docs.retellai.com/build/knowledge-base) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
k
@AI Evy are xls more accurate than txt or md?
a
Thanks for the follow-up, @krudy. I'll get back to you soon.
### Answer ### Answer No,
.xls
files are not more accurate than
.txt
or
.md
files for knowledge base retrieval [(1) ]() . In fact, the documentation recommends the opposite. Best Practice Recommendation: Prefer
.md
(Markdown) files over
.txt
. Well-structured Markdown is chunked and retrieved more accurately . Why Markdown Works Better: - Use clear, descriptive headings and keep each section focused and reasonably short - Write short paragraphs and lists to separate concepts; avoid walls of text - For tabular or image-heavy content, retrieval may be less reliable Excel File Limitations: For CSV, TSV, XLS, and XLSX, the row limit is 1000 rows and the column limit is 50 columns . Excel files contain primarily short words and structured data, which can make it harder for the LLM to understand context compared to narrative text in Markdown format. Recommendation for Your 20k Records: Given your large dataset with 20k records and 10 columns, consider converting your Excel data into well-structured Markdown files with clear headings, descriptive text, and organized sections. This will improve retrieval accuracy compared to splitting the data across multiple Excel files.
​ To learn more, see the sources I considered: [[1] Knowledge Base](https://docs.retellai.com/build/knowledge-base) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
Thanks for the follow-up, @krudy. I'll get back to you soon.
k
@AI Evy how do I make an agent store a variable that was obtained in a call, like a phone number, to be used an posted in a webhook url
a
### Answer ### Answer Based on the available sources, I can see that agents support webhook functionality [(1) ]() [(2) ]() , but I don't have specific documentation on how to extract and store variables during a call (like a phone number) to be posted to a webhook URL. The sources show that agents can be configured with a
webhook_url
[(2) ]() , and webhooks can trigger actions and send structured JSON data to external systems [(1) ]() . However, the exact mechanism for capturing call variables and including them in webhook payloads isn't detailed in the provided documentation. What I can confirm: - Agents support webhook configuration via the
webhook_url
parameter [(2) ]() - Webhooks can send structured data to external systems when events occur [(1) ]() - You can configure
webhook_timeout_ms
(default shown as 10000ms) [(2) ]() I'd be happy to provide a general answer based on common voice AI patterns if you'd like. Alternatively, for specific implementation details on variable extraction and webhook payloads, I recommend: - Visit [Contact Sales]() - Visit [) Would you like me to provide a general answer about how this typically works in voice AI systems? **
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
​ To learn more, see the sources I considered: [[1] Webhook](https://www.retellai.com/glossary/webhook) [[2] Get Agent Versions](https://docs.retellai.com/api-references/get-agent-versions) ​
k
@AI Evy how are response variables from a custom function setup and why my agent is not interpreting them in the call?
a
Thanks for the follow-up, @krudy. I'll get back to you soon.
### Answer ### Answer How to Set Up Response Variables from Custom Functions: When configuring a custom function, you can extract values from the API response and save them as dynamic variables for use later in the conversation [(1) ]() [(2) ]() . For example, you can extract a user's name from the response and reference it later using
{{user_name}}
. Example response body:
Copy code
json
{
 "properties": {
 "user": {
 "name": "John Doe",
 "age": 26
 }
 }
}
You can save
properties.user.name
as a variable like
user_name
, and use it in follow-ups [(3) ]() . Using Response Variables in Subsequent Functions: Yes, you can use the "Response Variables" from a previous function inside of the JSON of another future function [(4) ]() . For example, if you get
clientName
back from a "search_customer" function, you can then use
{{clientName}}
inside the JSON for another future function . Why Your Agent Might Not Be Interpreting Response Variables: Based on community reports, there are known issues with response variables in certain contexts [(5) ]() : 1. **Chat vs Voice Mode**: Response variables may work correctly in voice testing but fail in chat mode (playground-completion API) . The tool invokes correctly and returns results, but the variables don't get used in following conversation nodes during chat testing . 2. **MCP Tools**: When using MCP tools specifically, response variables may not save properly . When you edit an MCP tool, the form may appear clean without showing previously added response variables, suggesting they aren't being saved . 3. **Workaround**: If MCP response variables aren't working, switching to HTTP API custom functions with the same tool configuration has been reported to work . Troubleshooting Steps: - Verify your response variable syntax matches the exact format shown in the documentation [(1) ]() [(2) ]() - Test in voice mode rather than chat mode to isolate the issue [(5) ](
9/1406261286270144564) - If using MCP tools, consider switching to custom HTTP functions as a workaround - Check that your function returns a proper response with status code 200-299 [(2) ]() **
​ 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] Custom Function](https://docs.retellai.com/build/conversation-flow/custom-function) [[3] Connect any AI Voice Agent to MCP with Retell AI MCP Node (Guide) | Retell AI](https://www.retellai.com/blog/connect-any-ai-voice-agent-to-mcp-with-retell-ai-mcp-node) [[4] Response Variables - Part of Future Function Calls in JSON?](https://discord.com/channels/1186424376300679209/1396550506347761686) [[5] Conversation Flow Agent - MCP Response Variables not working](https://discord.com/channels/1186424376300679209/1406261286270144564) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.