Building a Universal Search Product with RAG and AI Agents

dropbox · Tech · 2025 · source Agentic: yes · promotional bias: low · source-backed · extracted with prompt 0.5.4 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Enterprise search and knowledge management

Dropbox needed Dash to answer business-user questions over fragmented, diverse, multi-modal enterprise data while preserving access controls, latency, quality, and safe multi-step agent execution.

Constraints:

Architecture

Dropbox Dash combines RAG for common retrieval and summarization tasks with AI agents for complex multi-step workflows. Retrieval uses traditional IR, on-the-fly chunking, and embedding-based reranking to keep quality high under latency constraints. Agents express plans in a Python-like DSL, then a custom minimal interpreter validates code with static analysis, dry runs, and runtime type enforcement before execution.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  dash-user[Dash User] --> dash-product[Dash Product]
  dash-product --> access-control[Access Control]
  enterprise-content-sources[Enterprise Content Sources] --> access-control
  access-control --> retrieval-system[Retrieval System]
  retrieval-system --> rag-pipeline[RAG Pipeline]
  rag-pipeline --> llm[LLM]
  dash-product --> ai-agent[AI Agent]
  llm --> ai-agent
  ai-agent --> dsl-plan[DSL Plan]
  dsl-plan --> custom-interpreter[Custom Interpreter]
  custom-interpreter --> enterprise-content-sources
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Dash User Business user asking search, Q&A, summarization, or multi-step workflow questions. Dash Product
Dash Product Universal search and knowledge-management interface with access controls and AI features. Dash User, Access Control, RAG Pipeline, AI Agent
Enterprise Content Sources Emails, documents, meeting notes, tasks, images, audio, video, and app data. Access Control, Retrieval System
Access Control Granular filtering so users and partners see only permitted content. Dash Product, Enterprise Content Sources, Retrieval System
Retrieval System Traditional IR, periodic/webhook sync, on-the-fly chunking, and reranking. Enterprise Content Sources, RAG Pipeline
RAG Pipeline Retrieves context and asks an LLM to summarize, answer, surface insights, or draft. Retrieval System, LLM
LLM Generates final RAG answers and agent DSL plans. RAG Pipeline, AI Agent
AI Agent Multi-step orchestration system for tasks that require planning and execution. Dash Product, LLM, DSL Plan, Custom Interpreter
DSL Plan Python-like code statements expressing high-level query logic. AI Agent, Custom Interpreter
Custom Interpreter Minimal Python-like runtime with static analysis, dry runs, security controls, and runtime type enforcement. DSL Plan, Enterprise Content Sources

Data flow

A Dash query first goes through access-controlled retrieval over fragmented enterprise content. For common questions, RAG retrieves relevant chunks through lexical IR, query-time chunking, and reranking, then an LLM generates an answer. For multi-step tasks, an LLM writes a simple DSL plan, Dropbox validates it with static analysis and type enforcement, fills missing helper functionality when needed, executes steps, and returns the final typed result.

4 supporting quotes
“RAG works by first retrieving the most relevant pieces of content from a dataset or knowledge base and then using a large language model (LLM) to generate a response”article, stated
“we landed on a traditional information retrieval (IR) approach combined with on-the-fly chunking and reranking”article, stated
“The planning stage involves breaking down a user's query into a sequence of high-level steps. This is done by an LLM, which interprets the query and generates simple code statements to express the logic of responding to the user’s query.”article, stated
“The code is validated through static analysis to ensure correctness, safety, and to detect missing functionality.”article, stated

Why this architecture

Dropbox split simple retrieval from multi-step agents because RAG is fast and reliable for common information retrieval, while business tasks like finding meeting notes need planning, tool/helper execution, and code-level validation for safety and debuggability.

3 supporting quotes
“Although RAG provides a solution for the most common types of questions—kinds that require fetching information from one or more documents—it’s incapable of performing complex, multi-step tasks.”article, stated
“RAG remains indispensable for simpler information retrieval tasks. The key is determining the appropriate tool for each scenario.”article, stated
“However, as a result of the LLM using code to express its logic in responding to the user, we’re able to make the LLM “show the work.” This helps with understanding at which step the logic failed, having more deterministic testing, and evaluating the response to a query. For example:”article, stated

Models used: large language models · embedding models · LLM judge

Scale

Alternatives considered (roads not taken)

Pure vector/semantic search over pre-chunked embeddings

Rejected because: Advanced semantic methods can add latency and may not satisfy Dash's response-time target.

“Because advanced or larger embedding-based semantic searches may take longer due to their complexity—whether that’s a heavier model or additional reranking steps.”article, stated

Direct API access to data sources for freshness

Rejected because: On-the-fly API calls can push latency above a few seconds.

“Alternatively, on-the-fly API calls to third-party data can push latency well above a few seconds. If near-real-time information is crucial (e.g., updating stock quotes), your system might spend more resources on frequent indexing or caching, throttling your ability to scale.”article, stated

Use RAG for complex multi-step business tasks

Rejected because: RAG cannot plan and execute multi-step workflows such as resolving dates, finding meetings, and retrieving attached documents.

“Although RAG provides a solution for the most common types of questions—kinds that require fetching information from one or more documents—it’s incapable of performing complex, multi-step tasks. This is where AI agents come in.”article, stated

Full-featured CPython-compatible interpreter

Rejected because: Dropbox only implemented minimal required functionality to reduce security risk.

“Only the minimal required functionality is implemented in its runtime—feature parity with CPython isn’t the goal.”article, stated

Patterns

rag-retrieval (retrieval)

Dash uses RAG for search, summarization, answers, insights, and drafts over business content.

“RAG's ability to combine external information retrieval with state-of-the-art generative models makes it the perfect fit for our product”article, stated

hybrid-search (retrieval)

Dropbox combines lexical IR with embedding-feature rerankers rather than relying on only lexical or only semantic search.

“We use a lexical-based system, along with smarter rerankers that use embedding features.”article, stated

retrieval-ranking (retrieval)

A larger but efficient embedding model reranks initial results to put relevant chunks first.

“A larger, but still efficient, embedding model then re-sorts those results to place the most relevant chunks at the top.”article, stated

tool-use-orchestration (agents)

Dash agents execute planned helper calls through a Python-like DSL and custom interpreter.

“functionality that acts as a building block for the LLM to use when expressing the logic of responding to the user’s query.”article, stated

structured-output-contract (agents)

The custom interpreter uses runtime type enforcement so generated logic returns expected typed values.

“Having run-time type enforcement helps ensure that the data and objects being operated on are the types of values that we expect.”article, stated

eval-driven-development (quality)

Dropbox evaluated retrieval/model options using public datasets, custom judges, source precision/recall/F1, correctness, and completeness metrics.

“We also designed hand-tuned metrics to help evaluate the quality of generated answers.”article, stated

Tradeoffs

Retrieval architecture

Chose Traditional IR with on-the-fly chunking and embedding reranking over Pure vector search or pure lexical search.

Rationale: The combination met Dropbox's speed and relevance goals while keeping costs in check.

“balancing speed and relevance. The combination allows us to keep costs in check while avoiding the pitfalls of purely semantic or purely lexical retrieval.”article, stated

Task architecture

Chose RAG for common information retrieval and agents for multi-step tasks over One universal LLM workflow.

Rationale: RAG handles simple retrieval well, but agents are required when a query needs planning and execution.

“AI agents excel at handling complex tasks through multi-step orchestration, RAG remains indispensable for simpler information retrieval tasks.”article, stated

Agent plan representation

Chose Python-like DSL with static analysis and type enforcement over Opaque natural-language reasoning only.

Rationale: Code plans expose where logic fails and make tests more deterministic.

“This helps with understanding at which step the logic failed, having more deterministic testing, and evaluating the response to a query.”article, stated

Interpreter scope

Chose Minimal custom interpreter over Feature parity with CPython.

Rationale: Minimal runtime functionality turns full-interpreter security risks into non-issues.

“feature parity with CPython isn’t the goal. This turns major security risks that exist in other full-featured interpreters into non-issues.”article, stated

Gotchas (what bit them)

Retrieval quality sets the ceiling for answer quality.

Root cause: The LLM can only answer from the context retrieved at inference time.

Resolution: Invest in IR, chunking, reranking, and end-to-end evaluation of retrieval plus generation.

“the retrieval system sets the bounds of what your LLM can “know” at inference time.”article, stated

Freshness, latency, quality, and cost pull against each other.

Root cause: Frequent re-indexing, third-party API calls, larger embeddings, and reranking all add latency or compute.

Resolution: Use periodic syncs/webhooks and a traditional IR plus on-the-fly chunking/reranking balance.

“But there are a few trade-offs to consider for each of these approaches:”article, stated

Model variations make prompt reuse unreliable.

Root cause: Different LLMs respond differently to the same prompt.

Resolution: Carefully select models and optimize prompts per task while preserving model-agnostic architecture.

“not all LLMs are equal: the same prompts can’t be used for different LLMs.”article, stated

Executing LLM-generated code creates security and correctness risk.

Root cause: Generated code may contain missing functionality, incorrect logic, or unsafe operations.

Resolution: Use a custom minimal interpreter with static analysis, dry runs, runtime type enforcement, and security controls.

“Static analysis allows our interpreter to examine the code without executing it, helping us automatically identify potential security risks”article, stated

Evaluation

Dropbox evaluated RAG and agent behavior with public datasets, custom LLM judges for correctness and completeness, source precision/recall/F1, static analysis, dry runs, runtime type enforcement, and type-level checks of agent outputs.

Metrics: Answer correctness · Answer completeness · Source precision · Source recall · Source F1 · Latency under 1-2 seconds for >95% of queries · Runtime type correctness · Step-level logic failures

3 supporting quotes
“an LLM judge for answer correctness (passing retrieved evidence through an LLM to score final answer accuracy), an LLM judge for completeness”article, stated
“source precision, recall, and F1 metrics to evaluate how accurately we retrieved key passages needed for correct answers.”article, stated
“Does resolving “tomorrow” always return the correct time window?”article, stated

Outcomes

The article reports production-target latency for Dash queries and detailed engineering choices, but not user-count or traffic-volume metrics.

“In practice, this yields high-quality results in under 2 seconds for over 95% of our queries”article, stated
“Our RAG system remains model agnostic: We want to provide the flexibility of choosing the models and providers our customers are most comfortable with.”article, stated