Skip to main content
File search, sometimes referred to as agentic RAG, gives your agents access to your business documents within an agentic application. When invoked, the tool retrieves the most relevant document chunks to help your agent complete its task. Anytime you have a use case where you want to leverage your business documentation to complete a task — summarize documents, answer questions based on company knowledge, or generate reports using internal data — configure a file search tool.

Prerequisites

File search requires a populated vector database. To create and populate one, see Create and populate a vector database.

Create a file search tool

Parameters

Best practices

Tool description

  • Write clear, concise descriptions that specify when the tool should be invoked — for example, “Use this tool to search internal company policies when a user asks about HR procedures.”
  • Include example queries or scenarios to help the agent understand the tool’s intended use.
  • Clearly define the scope and limitations of the tool — for example, “This tool only searches technical documentation, not customer support tickets.”

top_k

  • Higher values increase the likelihood of including relevant results but may introduce more noise. Use for exploratory queries or when context is broad.
  • Lower values give more focused results but risk missing relevant information. Use for targeted tasks.
  • Common settings are between 3 and 10.

score_threshold

  • Use score_threshold to filter out weak or irrelevant matches, improving overall result quality.
  • Start with a moderate threshold (such as 0.5–0.7) and adjust based on observed retrieval quality.

Source tracing

When file search retrieves chunks during a run, the assistant message includes source tracing fields for each chunk alongside the retrieved text. For the full retrieval workflow — from run response to original source file — see Source tracing.
Last modified on July 13, 2026