Skip to main content
Back to integrations
Exa
Backend ServicesWeb search context

LLMSlim + Exa

Live web search results as bounded, untrusted context for planning.

ExaSearchSource searches the web with Exa and returns each result as an untrusted RAG ContextItem with its URL, so fresh pages can join an agent’s context without promoting themselves into instructions. A usage guard caps requests and spend.

1. Package installation

Install LLMSlim and the official Exa SDK using your package manager.

terminalbash
pip install 'llmslim[exa]'

2. Architecture & execution flow

1

Read EXA_API_KEY on the server and build the source with from_env().

2

Search for the current question with a small result limit.

3

Results become untrusted RAG ContextItems that keep their source URLs.

4

Plan or compress them together with the rest of the context.

3. Production code pattern

exa_context.pypython
from llmslim.integrations.exa import ExaSearchSource

source = ExaSearchSource.from_env()  # reads EXA_API_KEY
items = await source.search("Sarvam-105B context window", limit=5)
# Pass items to plan_context(documents=items); web results stay untrusted.

4. Deployment best practices

Keep EXA_API_KEY server-side. Set LLMSLIM_EXA_REQUESTS_PER_MINUTE and LLMSLIM_EXA_MAX_REQUESTS before exposing search to users, and keep result limits small so the planner, not the search, decides what reaches the model.

5. Key optimization tips

  • Search with the user’s actual question; LLMSlim compresses around the same query.
  • Restrict domains when the answer must come from known sources.
  • Never let page text set SYSTEM or DEVELOPER provenance.

Frequently asked questions

Troubleshooting