Agentic Search and Context Engineering for Production LLM Systems
elastic · Tech · 2026 · source Agentic: yes · promotional bias: med · source-backed · extracted with prompt 0.5.2 (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: Production search and retrieval for LLM applications
Elastic needed search systems that could assemble context dynamically instead of relying on a fixed one-shot RAG pipeline.
Constraints:
- multiple context sources
- tool-selection reliability
- latency-sensitive retrieval choices
Architecture
Elastic frames context engineering as a tool-mediated search layer between many context sources and the LLM context window. The demos move from fixed RAG to an agent that decides when to call a semantic Elasticsearch tool, then to a general ESQL query-execution tool plus an agent skill for syntax guidance and error correction, and finally to shell/file-system search with exact grep and semantic CLI search. The production lesson is to curate a low-floor/high-ceiling tool stack, log agent behavior and breakages, then add purpose-built tools where repeated failures or excessive tool calls appear.
Diagram confidence: reconstructed (reconstructed from prose).
flowchart LR llm-agent[LLM agent] --> semantic-search-tool[Semantic search tool] semantic-search-tool --> elasticsearch-vector-store[Elasticsearch vector store] llm-agent --> agent-skill-loader[Agent skill loader] agent-skill-loader --> esql-query-tool[ESQL query tool] esql-query-tool --> elasticsearch-vector-store llm-agent --> shell-tool[Shell tool] shell-tool --> local-file-system[Local file system] shell-tool --> semantic-cli[Semantic CLI] llm-agent --> logging-feedback-loop[Logging feedback loop]
Components
| Component | Role | Interacts with |
|---|---|---|
llm-agent |
Chooses whether and how to retrieve context, invokes tools, reads tool responses, and produces the final answer. | semantic-search-tool, esql-query-tool, shell-tool, agent-skill-loader, logging-feedback-loop |
semantic-search-tool |
Simple low-floor retrieval tool over an Elasticsearch vector store using an embedding model and top-k similarity search. | elasticsearch-vector-store |
elasticsearch-vector-store |
Database holding chunked conference-session text and metadata fields for semantic search and ESQL demos. | semantic-search-tool, esql-query-tool |
esql-query-tool |
General-purpose database query tool that lets the agent execute full Elasticsearch query-language statements and self-correct errors. | elasticsearch-vector-store, agent-skill-loader |
agent-skill-loader |
Progressively loads ESQL syntax guidance into context before the agent calls the general-purpose query tool. | llm-agent, esql-query-tool |
shell-tool |
General-purpose terminal tool for navigating local files, running grep, invoking semantic CLI search, and using database or web CLIs under sandboxing. | local-file-system, semantic-cli |
local-file-system |
File-based context source containing session data for shell-search demonstrations. | shell-tool |
semantic-cli |
A semantic-search CLI paired with the shell tool for fuzzy retrieval over files when grep-style exact matching is insufficient. | shell-tool |
logging-feedback-loop |
Observed agent behavior, breaks, and repeated tool-call patterns used to decide when to add more purpose-built search interfaces. | — |
Data flow
A user asks a question. The agent decides whether it needs retrieval, chooses among available search tools, and either calls a semantic search tool against Elasticsearch, loads an ESQL skill before generating a database query for the general-purpose query tool, or uses a shell tool to explore local files. Tool responses are returned to the LLM context window and the agent answers. In production, teams log tool behavior and use observed breakages or repeated tool calls to decide where to add more specialized interfaces.
4 supporting quotes
Why this architecture
Elastic argues that no single search tool is sufficient. Specialized tools give the agent a reliable low floor for common operations, while general-purpose query and shell tools provide a high ceiling for unexpected or complex questions. Skills, system prompts, error handling, sandboxing, and behavior logging are the controls that keep flexible tools usable in production.
4 supporting quotes
Models used: GPT 5.4 Nano · GPT 5.4 Mini · new genome embeddings v5
Scale
- The demo uses top-k three semantic search to intentionally show how a narrow search tool can be brittle.“I'm setting the limit or the top K to three. This is a little bit of foreshadowing because I'm limiting the capabilities of this tool”transcript, stated
- The ESQL example uses database-side aggregation to count 27 sessions rather than asking the LLM to count items in context.“it's filtering for April 8th. And then it also does an aggregation, some some counting and tells me today there are 27 sessions.”transcript, stated
- Elastic's practical threshold for adding specialized tools includes seeing four or five tool calls per question.“Um, but if you notice, maybe your agent is taking four or five tool calls per question. That's too many tool calls. Then you probably that's probably an indicator that the tool your agent has is too difficult for it to use.”transcript, stated
Alternatives considered (roads not taken)
Fixed RAG retrieval pipeline
Rejected because: It retrieves whether or not context is needed and cannot naturally perform multi-hop retrieval when the first result reveals another query.
A single simple semantic-search tool
Rejected because: It is useful only for a narrow scope and fails on keyword/filtering needs such as the GDPA session demo.
A one-sentence or underspecified tool description
Rejected because: As parameters and tool counts grow, the agent needs trigger conditions, relationships, and sometimes system-prompt reinforcement.
Only a shell tool for all search
Rejected because: Shell tools are versatile but risky, require sandboxing, and exact grep can be inefficient for semantic search unless extended with specialized CLIs.
Patterns
tool-use-orchestration (retrieval)
The agent decides whether to call retrieval tools and can make multiple calls when the first result reveals a need for additional search.
hybrid-search (retrieval)
Elastic frames production search as a curated stack of vector, keyword, sparse, dense, and multi-vector approaches selected by need.
Tradeoffs
How much general-purpose capability to expose to the agent.
Chose shell/database query tools for flexible search over only a narrow semantic-search tool.
Rationale: General tools unlock more search strategies but require sandboxing and safeguards.
How broad the agent search-tool set should be.
Chose a curated mix of specialized low-floor tools and general-purpose high-ceiling tools over one silver-bullet search tool.
Rationale: Common queries benefit from simple reliable tools, while unexpected or complex queries need flexible query/shell interfaces.
How to choose new purpose-built search interfaces over time.
Chose start general, log agent behavior, then add specialized tools where repeated breaks appear over designing all specialized retrieval tools before observing real agent use.
Rationale: The presenter recommends behavior logging as the signal for tool difficulty, repeated calls, and useful future interfaces.
How to make general database query tools reliable enough for agents.
Chose agent skills plus error-returning query tools over letting the agent generate complex ESQL with only a terse tool description.
Rationale: Complex query syntax is a failure mode; skill guidance and tool-level errors let the agent self-correct instead of crashing the workflow.
Gotchas (what bit them)
Agents can skip retrieval or pick the wrong search tool.
Root cause: Tool descriptions and system prompts may not give enough situational guidance when several tools are available.
Resolution: Add trigger conditions, relationship guidance, and system-prompt reinforcement for tool choice.
Evaluation
The presentation uses live demos that deliberately break simple search setups and then tests richer retrieval tools.
Metrics: tool call correctness · retrieval relevance · latency fit
Outcomes
- The case yields reusable design guidance for moving from fixed RAG to tool-mediated context engineering.
Presented as a production pattern from Elastic work with internal and external teams rather than a single deployment metric.