Back to blog
AI & Agents

OpenSearch agentic search and agentic memory, tested for AI agents

Agentic search turns a natural language question into query DSL inside a search pipeline. We registered every piece on OpenSearch 3.9.0, recorded the real validation errors, and say when to keep orchestration in your app instead.

Abhilash B12 min read
#opensearch#agentic search#agentic memory#mcp#ai agents

OpenSearch agentic search lets a search request carry a natural language question: an agentic query clause goes through a search pipeline whose agentic_query_translator processor hands the question to an ML Commons agent, the agent's QueryPlanningTool asks an LLM to write query DSL, and OpenSearch runs that DSL as a normal search. It needs one LLM connector, one agent and one pipeline. Use it when the question targets indices you already know and you want the LLM step inside the cluster. Keep orchestration in your application, with Claude or GPT calling OpenSearch as an MCP tool, when the agent also works outside OpenSearch.

We ran every step that does not need a live model on OpenSearch 3.9.0 (Lucene 10.5.1, ML Commons 3.9.0.0), the current release as of 31 October 2026, in a single-node Docker container with the Security plugin disabled. We had no LLM credentials, so the connector holds placeholder keys and no request ever reached a model. Every response below is real output from that cluster. Steps that need a model are marked, and their behaviour comes from the docs.

What changed in which version

The official version history puts general availability of agentic search and the agentic memory APIs in 3.3. What 3.5 and 3.6 contributed is agent memory and a set of agentic search refinements:

VersionAgentic search and memory changes (from the version history and release posts)
3.0Plan-execute-reflect agents and native MCP support
3.2Agentic search introduced; agentic memory APIs experimental
3.3Agentic search and agentic memory APIs generally available; in-cluster MCP server on Streamable HTTP, old SSE endpoints removed
3.5Agents can use agentic memory for conversation context; hook-based context management
3.6Hybrid search over long-term memory; alias support, embedding_model_id on the translator processor, fallback query and reranking for agentic search; experimental unified agent registration and conversational_v2
3.7Unified agent registration and conversational_v2 generally available
3.8MCP connectors for flow and conversational flow agents; experimental memory retention policies
3.9No agentic search API changes listed

Nothing in the agentic search path was renamed or removed between 3.6 and 3.9. The only removals we found are the experimental MCP SSE Message and SSE Session APIs, dropped in 3.3. The agentic search examples in the docs still register flow and conversational agents, so that is what we used.

How OpenSearch agentic search runs a query

The agentic search guide offers two agent types. A flow agent runs only the QueryPlanningTool: one LLM call, and the index comes from the request path. A conversational agent can also call tools such as ListIndexTool and IndexMappingTool to discover indices first, keeps conversation memory, and returns a memory_id so the next question can build on the last one.

sequenceDiagram
  participant App as Application
  participant OS as OpenSearch search pipeline
  participant Ag as Conversational agent
  participant LLM as LLM connector
  participant Idx as Index
  App->>OS: _search with agentic query_text
  OS->>Ag: agentic_query_translator passes the question
  Ag->>LLM: question plus tool list
  LLM-->>Ag: call IndexMappingTool
  Ag->>Idx: read mapping
  Ag->>LLM: mapping plus question to QueryPlanningTool
  LLM-->>Ag: query DSL as JSON
  Ag-->>OS: DSL replaces the agentic clause
  OS->>Idx: run generated DSL
  Idx-->>OS: hits
  OS-->>App: hits plus ext.dsl_query and memory_id

Each arrow into the LLM is a model call billed by your provider, and a conversational agent can loop up to max_iteration times before it answers. Every extra step also multiplies the chance of a wrong turn, which is the subject of the reliability math of AI agents.

Setup on 3.9.0, step by step

Step 1: the connector and model (runs without a model)

The docs' Claude example calls a hosted Converse API endpoint. Our first attempt pointed the same connector at a host outside the allowlist, and it failed before anything was stored:

{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Connector URL is not matching the trusted connector endpoint regex"}],"status":400}}

The default plugins.ml_commons.trusted_connector_endpoints_regex on 3.9.0 is a fixed list of hosted model endpoints, including the ones the docs use for Claude and GPT. Any other host, such as a self-hosted Llama or Mistral server, has to be added to that setting first. With the URL from the docs, the connector and model registered with placeholder credentials:

POST /_plugins/_ml/connectors/_create
{
  "name": "Bedrock Claude Sonnet 4 connector",
  "version": 1,
  "protocol": "aws_sigv4",
  "parameters": {
    "region": "us-east-1",
    "service_name": "bedrock",
    "model": "us.anthropic.claude-sonnet-4-20250514-v1:0"
  },
  "credential": { "access_key": "<placeholder>", "secret_key": "<placeholder>" },
  "actions": [{
    "action_type": "predict",
    "method": "POST",
    "url": "https://bedrock-runtime.${parameters.region}.amazonaws.com/model/${parameters.model}/converse",
    "headers": { "content-type": "application/json" },
    "request_body": "{ \"system\": [{\"text\": \"${parameters.system_prompt}\"}], \"messages\": [${parameters._chat_history:-}{\"role\":\"user\",\"content\":[{\"text\":\"${parameters.user_prompt}\"}]}${parameters._interactions:-}]${parameters.tool_configs:-} }"
  }]
}
// {"connector_id":"BK2kkaEBu854I9t9-zjb"}

POST /_plugins/_ml/models/_register
{ "name": "claude-sonnet-4", "function_name": "remote", "connector_id": "BK2kkaEBu854I9t9-zjb" }
// {"task_id":"DK2kkaEBu854I9t9_DiP","status":"CREATED","model_id":"EK2kkaEBu854I9t9_Dj0"}

We also set plugins.ml_commons.only_run_on_ml_node to false, because the Docker node has no ml role. Registration does not contact the model provider, so a bad key only shows up at query time.

Step 2: the agent (runs without a model)

Two agents registered cleanly. The flow agent needs a response_filter so the tool extracts the DSL from the Converse API response; the conversational agent needs _llm_interface: "bedrock/converse/claude" for the same reason.

POST /_plugins/_ml/agents/_register
{
  "name": "agentic-search-flow",
  "type": "flow",
  "tools": [{
    "type": "QueryPlanningTool",
    "parameters": {
      "model_id": "EK2kkaEBu854I9t9_Dj0",
      "response_filter": "$.output.message.content[0].text",
      "fallback_query": "{\"size\":0,\"query\":{\"match_none\":{}}}"
    }
  }]
}
// {"agent_id":"KK2mkaEBu854I9t9OTil"}

The validation errors are short. A conversational agent without an llm block returns "We need model information for the conversational agent type", and an unknown type such as "agentic" returns "Invalid Agent Type".

That fallback_query line matters more than it looks. The QueryPlanningTool docs say that when the LLM returns no valid JSON, the tool substitutes {"size":10,"query":{"match_all":{}}} and logs at debug level, with no error. For a search box that means ten arbitrary documents presented as an answer. We override it with match_none so a planning failure looks like an empty result, which the application can detect. Note that the parameter is a JSON string.

Step 3: the search pipeline (runs without a model)

PUT /_search/pipeline/agentic-pipeline
{
  "request_processors": [
    { "agentic_query_translator": { "agent_id": "<flow-agent-id>" } }
  ],
  "response_processors": [
    { "agentic_context": { "dsl_query": true } }
  ]
}
// {"acknowledged":true}

The agentic_context response processor adds the generated DSL under ext.dsl_query. Log it on every request: it is the only record of what the model actually searched for. If you have not used request and response processors before, our search pipelines walkthrough covers the model.

Pipeline creation validates the shape and nothing else. A missing agent_id fails with "[agent_id] required property is missing", and an option the processor does not know, such as fallback_query (which belongs on the tool), fails with "processor [agentic_query_translator] doesn't support one or more provided configuration parameters: [fallback_query]". An agent_id that does not exist is accepted. The error only appears when a query runs:

{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Agentic search failed - Failed to get agent info - Agent ID: [does-not-exist], Error: [Failed to find agent with the provided agent id: does-not-exist]"}],"status":400}}

So a deploy script that creates the pipeline should run one canary query before it moves traffic.

Step 4: the agentic query (needs a model connector to run)

Both of the failure cases below came from our cluster. An agentic clause sent without the pipeline, or nested inside a bool, fails the same way:

{"type":"illegal_state_exception","reason":"Agentic search query must be used as top-level query, not nested inside other queries. Should be used with agentic_query_translator search processor"}

The working request is verified against the docs and needs a model connector to run:

GET /iris-index/_search?search_pipeline=agentic-pipeline
{
  "query": {
    "agentic": {
      "query_text": "List all the flowers present",
      "query_fields": ["species", "petal_length_in_cm"]
    }
  }
}

query_fields is optional and narrows which fields the LLM considers. memory_id continues a conversation and works with conversational agents only. Because the clause must be top level, you cannot combine it with your own filters in the same query. Tenant or permission filters therefore have to come from the index, an alias with a filter, or document-level security.

OpenSearch agentic memory: containers, namespaces and search

Agentic memory stores agent context in memory containers. A container holds four memory types: sessions, working memory, long-term memory and history. Namespaces such as user_id or session_id partition it. The APIs are on by default (plugins.ml_commons.agentic_memory_enabled: true on 3.9.0).

The useful surprise is how much works with no model at all. A container without embedding or LLM models accepts raw conversation turns and structured agent state:

POST /_plugins/_ml/memory_containers/_create
{ "name": "support-agent-memory", "configuration": { "disable_history": true } }
// {"memory_container_id":"Ga2lkaEBu854I9t9ajgN","status":"created"}

POST /_plugins/_ml/memory_containers/Ga2lkaEBu854I9t9ajgN/memories
{
  "messages": [
    { "role": "user", "content": [{ "text": "Our cluster runs OpenSearch 3.9 with Faiss HNSW indices", "type": "text" }] },
    { "role": "assistant", "content": [{ "text": "Noted: OpenSearch 3.9, Faiss HNSW", "type": "text" }] }
  ],
  "namespace": { "user_id": "u-42", "session_id": "s-1" },
  "payload_type": "conversational",
  "infer": false
}
// {"session_id":"s-1","working_memory_id":"Ia2lkaEBu854I9t9ajie"}

A term query on namespace.user_id against memories/working/_search returned that one document, from the system index .plugins-ml-am-default-memory-working. The structured payload_type: "data" entry we wrote under agent_id did not match, as expected.

Everything that extracts or ranks meaning needs models, and the errors say exactly which:

Call on a container with no modelsResponse on 3.9.0
Add memory with "infer": trueinfer=true requires llm_model_id to be configured in memory storage
long-term/_semantic_searchThis memory container does not have an embedding model configured. Semantic search requires ...
long-term/_hybrid_search (3.6+)... Hybrid search requires a memory container with an embedding model (TEXT_EMBEDDING or SPARSE_ENCODING) ...
Create with embedding_model_type but no IDEmbedding model ID is required when embedding model type is provided

With an embedding model and at least one strategy (SEMANTIC, USER_PREFERENCE or SUMMARY), the hybrid search memory API combines a BM25 match on the memory text with a neural query on its embedding, normalized with min_max and combined with arithmetic_mean. bm25_weight and neural_weight default to 0.5 each and must sum to 1.0. That part is verified against the docs and needs a model connector to run, because long-term memories only exist after an LLM extracts them.

To connect memory to agentic search, register the conversational agent with "memory": {"type": "agentic_memory", "memory_container_id": "..."}. That registration succeeded on our cluster. What the agent then writes into the container needs a model connector to run.

The MCP server: OpenSearch as a tool for Claude or GPT

The in-cluster MCP server exposes registered ML Commons tools at /_plugins/_ml/mcp over stateless Streamable HTTP. It is off by default, and the first call says so:

{"error":{"root_cause":[{"type":"exception","reason":"The MCP server is not enabled. To enable, please update the setting plugins.ml_commons.mcp_server_enabled"}],"status":500}}

After enabling it, we registered one narrow tool and drove the JSON-RPC sequence with curl. None of this needs a model on the OpenSearch side, because the LLM lives in the client.

curl -s -X PUT localhost:9218/_cluster/settings -H 'Content-Type: application/json' \
  -d '{"persistent":{"plugins.ml_commons.mcp_server_enabled":true}}'

curl -s -X POST localhost:9218/_plugins/_ml/mcp/tools/_register -H 'Content-Type: application/json' -d '{
  "tools": [{
    "name": "search_iris",
    "type": "SearchIndexTool",
    "description": "Searches the iris-index of flower measurements. Provide a query written in OpenSearch query DSL.",
    "attributes": { "input_schema": {
      "type": "object",
      "properties": { "index": { "type": "string", "enum": ["iris-index"] }, "query": { "type": "object" } },
      "required": ["index", "query"], "additionalProperties": false } }
  }]
}'
# {"jFPxbCmBS7uDdJPGwnrFMg":{"created":true}}

initialize returned serverInfo OpenSearch-MCP-Stateless-Server 0.1.0 with protocol 2025-03-26, notifications/initialized returned 202 Accepted, a GET returned 405 Method Not Allowed as the docs describe, and tools/list returned our one tool with its schema. A tools/call for species: setosa returned document 1 with "isError":false.

Then we called the same tool with an index outside its enum:

{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"search_iris",
  "arguments":{"index":".plugins-ml-am-default-memory-working","query":{"size":1,"_source":["messages"]}}}}

It returned the stored conversation from the agentic memory system index, with "isError":false. The input_schema guides the model. The server did not enforce it. Our cluster had security disabled, so this is the worst case, but the lesson holds: the schema is documentation for the LLM, and the boundary has to be permissions.

Guardrails that actually hold

The docs state that MCP tools run with the permissions of the user the client authenticates as, and that ml_full_access grants no index permissions. We did not test with the Security plugin enabled. Our setup for any agent-facing cluster would be:

  1. A dedicated OpenSearch user per agent, with read on one alias and nothing else. Point the alias at the indices the agent may see, with an alias filter for tenancy if needed. 3.6 added alias support to agentic search, so the agentic pipeline can target the same alias.
  2. cluster:admin/opensearch/ml/mcp/server for that user, and none of the mcp_tools/register|update|remove permissions.
  3. A fallback_query of match_none, and an alert on empty agentic results.
  4. Memory containers treated as PII stores. The agentic memory docs make the container owner responsible for access control, including document-level security, which matters most when use_system_index is false.

Filtered vector queries generated by an LLM have the same failure modes as hand-written ones, so check them for the k-NN filter pitfall that returns fewer than k results.

Built-in agentic search vs app-side orchestration

flowchart TD
  Q([Natural language question]) --> D1{"Does the agent need tools<br/>outside OpenSearch?"}
  D1 -- yes --> APP["App-side agent: Claude or GPT<br/>calls OpenSearch through MCP or your own tool"]
  D1 -- no --> D2{"Are the target indices<br/>known per request?"}
  D2 -- yes --> FLOW["Flow agent:<br/>one LLM call, index from request path"]
  D2 -- no --> CONV["Conversational agent:<br/>index discovery and memory_id"]
  FLOW --> LOG[Log ext.dsl_query and evaluate]
  CONV --> LOG
  APP --> LOG
SituationOur recommendation
Search box over one product or document index, users type full questionsBuilt-in, flow agent
Follow-up questions that refine the last result setBuilt-in, conversational agent with memory_id
Agent also calls a CRM, ticketing system or code repoApp-side orchestration with OpenSearch as one MCP tool
You need your own prompts, model routing or offline evals on every stepApp-side orchestration
Strict latency budget on every queryNeither for every query: route only long natural language queries through agentic search

Built-in agentic search wins when OpenSearch is the only system the question touches. The mapping is right there, and the pipeline keeps the LLM step next to the data, with one request from your application. It is weaker when the agent's job spans systems, because the OpenSearch agent cannot see your other tools unless you wire them in through MCP connectors (3.8 extended those to flow agents). And debugging a reasoning loop through agent_steps_summary is harder than debugging it in your own runtime.

Whichever side runs the agent, answer quality is bounded by the retrieval underneath it, as we argue in your agent is only as good as its retriever. Generated DSL that picks the wrong field fails quietly, which is one of the patterns in how RAG fails in production. Logging ext.dsl_query next to a relevance judgment is the cheapest way to catch it.

Where we can help

We set up agentic search pipelines, MCP tool permissions and memory containers on OpenSearch, then test the generated queries against your relevance judgments before users see them. See our OpenSearch consulting service for the cluster side and our AI agent builder service when the agent runs in your application.

Advisor, Query Quotient

Abhilash B is an advisor at Query Quotient and an information retrieval and AI expert who holds patents in the field. Abhilash brings that retrieval depth to the search, RAG and agent systems Query Quotient builds for clients.

Keep reading

Building something similar?

Tell us what you are working on. In a free 30-minute call we will give you an honest view of the approach, the effort and how to measure success.