# Agentic Search for Context Engineering

Leonie Monigatti's post (an edited version of her AI Engineer Europe 2026 workshop) makes one argument and then builds it out in code: context engineering — deciding what from all possible sources goes into an agent's context window — is about 80% agentic search. What looks like a single "context curation" step is really a set of search tools the agent decides to call, and the design question is which of those tools belong in your stack given your latency and quality needs, not "shell tool versus everything else." See [[leonie-monigatti-blog]] for the author and [[agentic-search]] for the concept.

## Three eras

Search in the AI stack moved through three stages over three years. Fixed-pipeline RAG (2024) takes the user message, runs one vector search, staples the chunks onto the prompt, and generates. It works for narrow Q&A but breaks in three predictable ways, all from retrieving exactly once: it retrieves when no retrieval was needed and the junk confuses the model, it can't rerun a bad query, and it can't do multi-hop where the first results only tell you what to search for next. Agentic RAG replaces the fixed pipeline with a search tool the agent chooses to call, judge, rerun, or rewrite. Context engineering generalizes that to many sources at once — local files and scratch pads, databases, the web, long-term memory — each with a native search tool (file search, skill loading, database query tools, web search, memory tools). See [[rag-limitations]], [[context-engineering]].

## The shell tool

Cutting across all of those is the shell tool (LangChain's name; Anthropic's bash tool, OpenClaw's exec tool): one "run a command" tool that reaches files (`grep`, `ls`), databases (CLIs, `curl` to HTTPS APIs), and the web (`curl`). That breadth is why "Bash + Filesystem is all you need" keeps getting proposed. Monigatti's related Elastic post argues it isn't a silver bullet — the point isn't shell versus all, it's curating a stack.

## Three demos

The demos use LangChain over the conference schedule, one document per session.

Demo 1 — a single semantic search tool over Elasticsearch (`gpt-5.4-nano`, `jina-embeddings-v5`). Conceptual queries work ("which sessions discuss regulatory constraints?" finds the right talk). Keyword queries break: "which sessions cover GEPA?" returns unrelated results because the embedding confuses "GEPA" with "Gemma." This is where most agentic-search demos stop.

Demo 2 — swap in a general-purpose `execute_esql_query` tool that lets the agent write full ES|QL, and step up to `gpt-5.4-mini` because query generation is harder than passing a topic. It first fails by writing SQL-style `%` wildcards (`WHERE text LIKE '%GEPA%'`) where ES|QL uses `*`, returning zero rows. The fix is an Agent Skill: a minimal `elasticsearch-esql` skill loaded through LangChain's `load_skill` tool and `SkillMiddleware`, with the system prompt telling the agent to load the skill before querying and regenerate on error. After that it writes valid ES|QL (`LIKE "*GEPA*"`) and finds the session. Being general-purpose, it also answers analytical questions — "how many sessions on April 8?" via `STATS COUNT()` (result: 27) — useful because LLMs are bad at counting. The tradeoff: more power for ambiguous queries, but skill loading adds cost and latency and needs a stronger model. Compare [[mcp-vs-skills]].

Demo 3 — the shell tool over one `.txt` per session ("Bash + Filesystem is all you need"), the agent using `ls`/`grep`/`cat`. Grep nails exact terms. On a semantic query the agent "cheats": it greps for `regulat`, then chains synonyms (`compliance`, `constraints`, `GDPR`, `governance`) until something hits. It works unreasonably well but doesn't scale — asked for "movies with animal superheroes" it would have to enumerate every animal. Hence semantic-grep CLIs: LlamaIndex's `semtools`, LightOn's `colgrep`, Jina AI's `jina-grep-cli` (grep-compatible `-r`/`-R`/`-l` plus cosine `--threshold` default 0.5 and `--top-k` default 10). Loaded with a grep-vs-jina-grep decision rule in the prompt, the agent returns cosine-scored matches for the regulatory query more efficiently.

## What carries over

General-purpose tools handle harder queries but cost more and demand stronger models; narrow tools are cheap but brittle on the queries they weren't shaped for. Tool descriptions do real work — the agent picks tools from them. Sandbox the shell tool (it ships with no safeguards). And decide up front what a zero-result response means: nothing found, or retry with different parameters. Relates to [[hybrid-search]].

## Cross-references

- [[agentic-search]] — the concept: agent-driven, multi-source search and its shell-tool limits
- [[context-engineering]] — the frame this sits inside; Monigatti's ~80% claim added there
- [[rag-limitations]] — the fixed-pipeline failures that motivated the move
- [[mcp-vs-skills]] — the general-tool-plus-skill pattern in Demo 2
- [[hybrid-search]] — combining keyword and semantic retrieval, the gap Demos 1 and 3 expose
- [[leonie-monigatti-blog]] — the author
