FocalCXM is recognized as a Major Contender in the Veeva Services PEAK Matrix® Assessment 2025 by Everest Group.

703.868.6393 contact@focalcxm.com

Beyond Keyword Search: Building Agentic and Conversational Search with Amazon OpenSearch Service

Manogna Batchali

30 October 2026, Friday

Introduction

Enterprise organizations generate and manage large volumes of information across document management systems, knowledge bases, CRM platforms, and enterprise applications. Yet having information stored and indexed does not necessarily mean that people can find the information they need quickly.

Consider a simple question: “What are the adverse reactions of azithromycin?”

A user expects a straightforward answer. However, retrieving the right documents may require knowledge of the underlying index, document fields, search operators, metadata filters, and query syntax. The user may need to experiment with different keywords or ask someone with search expertise to help.

The challenge is not simply storing information or making it searchable. It is bridging the gap between how people express their information needs and how a search engine needs those needs to be represented.

To address this challenge, we built two complementary patterns on Amazon OpenSearch Service:

• Agentic search, where a large language model (LLM) helps plan the search query before OpenSearch executes it.

• Conversational search, where an AI agent uses conversation memory and enterprise document retrieval to support follow-up questions.

Both patterns use Amazon Bedrock to access language models and OpenSearch to retrieve enterprise information. Our application layer adds answer generation, evidence checks, source references, and conversation management.

This article explains the problem we set out to solve, how the two patterns work, and the lessons we learned while building them.

The Problem: Moving from Keywords to Intent

Consider a question such as:

What are the adverse reactions of azithromycin?

A useful answer may require retrieving documents that mention the medicine under different terminology, locating relevant passages, and preserving references to the source material.

A keyword-only workflow can require users to guess the right terms or refine their search repeatedly. A natural-language search experience aims to reduce that effort by interpreting the question and translating it into a query suited to the available index structure.

The challenge is not simply to generate a query. A reliable enterprise-search workflow must also:

  • Search the appropriate indexes and fields.
  • Rank relevant documents.
  • Extract useful passages and metadata.
  • Generate a response based on retrieved evidence.
  • Provide references that users can inspect.
  • Preserve conversation context when a user asks a follow-up question.

These requirements motivate the two architectures described below.

Solution Overview

The solution separates retrieval, orchestration, and answer generation into distinct responsibilities.

Prerequisites:

Use Amazon OpenSearch Service with OpenSearch version 3.2 or later for agentic search; the agentic search query and the agentic_query_translator processor were introduced in 3.2. Confirm feature availability in the target AWS Region and domain configuration. You also need an IAM connector role that can invoke the selected Amazon Bedrock foundation model or inference profile, model access enabled in the AWS account and Region, and an OpenSearch ML agent configured with QueryPlanningTool. The exact model IDs and connector response filter depend on the selected model and connector.

Model ID placeholders used in the examples:

<BEDROCK_MODEL_ID_OR_INFERENCE_PROFILE_ID> is the model ID or inference-profile ID placed in the connector configuration.

<BEDROCK_QUERY_PLANNER_MODEL_ID> is the OpenSearch ML model ID returned after registering and deploying that connector; use it in the flow agent and in the conversational agent’s QueryPlanningTool.

<CONVERSATIONAL_MODEL_ID> is the OpenSearch ML model ID used by the conversational agent’s top-level LLM. These are separate IDs even if they ultimately call the same Bedrock foundation model.

<FLOW_AGENT_ID> and <CONVERSATIONAL_AGENT_ID> are the IDs returned by their respective agent-registration calls. The Bedrock model is configurable; the example ID is only a placeholder, not a recommendation.

<MODEL_ID> in the GET /_plugins/_ml/models/<MODEL_ID> example means the OpenSearch ML model resource ID returned by registration, not the Bedrock foundation-model ID.

Choosing an approach: Flow agent vs. conversational agent

Use the flow-agent pattern when the index and retrieval path are known and a single query is the main task. Choose a conversational agent when follow-up context and multi-tool orchestration are important, while accounting for additional model calls and stronger application-side controls.

In this implementation, the flow agent handles query planning inside OpenSearch. The Python service handles evidence preparation and final answer generation. The conversational-agent path adds OpenSearch agent memory and application-side conversation management.

What Is Agentic Search?

Agentic search is an AI-powered approach to information retrieval in which an agent interprets a user’s intent and determines how to formulate a search query.

In traditional search, users often need to understand the search system’s structure. They may need to know which fields to search, which filters to apply, and how to combine conditions using operators.

With agentic search, users can express their information needs in natural language. An LLM interprets the question and helps translate it into a query that the search engine can execute.

The distinction is important: the LLM plans the query, while OpenSearch remains responsible for executing the search and retrieving documents.

Agentic search does not necessarily replace the search engine’s retrieval or ranking mechanisms. Instead, it introduces an AI-driven query-planning layer that makes those capabilities easier to use.

In our implementation, OpenSearch ML Commons provides the agent framework and query-planning tool, while Amazon Bedrock hosts the LLM used to interpret the question and generate the search query.

Flow Agent Architecture

How the Flow Agent Works:

The user submits a natural-language question. The search pipeline invokes a flow agent, which uses Query Planning Tool to generate an OpenSearch DSL query. OpenSearch executes the generated query and returns ranked hits. The Python service selects useful evidence and asks Claude to compose an answer with source references.

The agentic context response processor can expose the generated DSL query for inspection. It does not extract passages or generate the final natural-language answer.

Configure the Bedrock Model in OpenSearch

Step 1. Create the Bedrock connector role

Create an IAM role that OpenSearch Service can assume when invoking Amazon Bedrock. Its trust policy should allow the OpenSearch Service principal to assume the role:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": "opensearchservice.amazonaws.com"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}

Attach a permissions policy to this connector role that grants only the Bedrock model invocation actions and model resources required by your deployment. For example, adapt the resource ARNs to the model or inference profile you use:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowBedrockInvoke",
      "Effect": "Allow",
      "Action": [
        "bedrock:InvokeModel",
        "bedrock:InvokeModelWithResponseStream"
      ],
      "Resource": [
        "arn:aws:bedrock:<REGION>::foundation-model/<MODEL_ID>",
        "arn:aws:bedrock:<REGION>:<ACCOUNT_ID>:inference-profile/<INFERENCE_PROFILE_ID>"
      ]
    }
  ]
}

Important: The identity that signs the connector-creation request is a separate identity from the connector role. That caller needs iam:PassRole on the connector role and the required OpenSearch HTTP permissions. Do not place these caller permissions in the connector role policy just because they are needed to create the connector.

Example caller policy (replace the placeholders and scope resources to your environment):

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PassBedrockConnectorRole",
      "Effect": "Allow",
      "Action": "iam:PassRole",
      "Resource": "arn:aws:iam::<ACCOUNT_ID>:role/opensearch-bedrock-connector-role"
    },
    {
      "Sid": "CreateOpenSearchConnector",
      "Effect": "Allow",
      "Action": [
        "es:ESHttpPost"
      ],
      "Resource": "arn:aws:es:<REGION>:<ACCOUNT_ID>:domain/<DOMAIN>/*"
    }
  ]
}

The exact actions and resource scope depend on which APIs you call. Use least privilege and verify the policies against your domain’s access policy and fine-grained access control settings.

Step 2. Map the caller identity in OpenSearch security

If fine-grained access control is enabled, map the IAM caller role/user that signs the connector-creation request and has iam:PassRole permission to the appropriate OpenSearch security role. AWS documentation commonly uses ml_full_access for this setup; in production, prefer a custom role with only the required ML Commons permissions where feasible. Do not assume that the connector role and the caller identity are the same role.

Example role mapping (adapt the backend role and users to your setup):

PUT /_plugins/_security/api/rolesmapping/ml_full_access{
  "backend_roles": [
    "arn:aws:iam::<ACCOUNT_ID>:role/<CONNECTOR_CREATION_CALLER_ROLE>"
  ],
  "users": [
    "<MASTER_USER>"
  ]
}

Run this request as an appropriately authorized security administrator. The exact mapping depends on how authentication and fine-grained access control are configured in your domain.

Step 3. Create the index and ingest data

Create an index (for example: enterprise-docs) and load your documents. Our documents carry title, content, full_content, source and nested chunks with chunk_text and detected_entities.

Step 4. Create the Bedrock connector

Connector creation needs a SigV4-signed request, because iam:PassRole requires an IAM identity. Dashboards Dev Tools uses basic auth and will not work here. Run it with awscurl from AWS CloudShell, or sign the request with a small Python script.

awscurl --service es --region us-east-1 -X POST "https://<DOMAIN_ENDPOINT>/_plugins/_ml/connectors/_create" -H "Content-Type: application/json" -d
{
  "name": "bedrock-query-planner",
  "version": 1,
  "protocol": "aws_sigv4",
  "parameters": {
    "region": "us-east-1",
    "service_name": "bedrock",
    "model": "<BEDROCK_MODEL_ID_OR_INFERENCE_PROFILE_ID>"
  },
  "credential": {
    "roleArn": "arn:aws:iam::<ACCOUNT_ID>:role/opensearch-bedrock-connector-role"
  },
  "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:-} }"
    }
  ]
}

The response is {“connector_id”: “…”}. Keep it for the next step.

Step 5. Register and deploy the model

Register a remote model that points at the connector, deploying it in the same call. Use the connector ID returned in Step 4:

POST /_plugins/_ml/models/_register?deploy=true{
  "name": "Configurable Query Planner Model",
  "function_name": "remote",
  "description": "Remote Bedrock model for OpenSearch query planning",
  "connector_id": "<CONNECTOR_ID>"
}

Then confirm that the model is deployed:

GET /_plugins/_ml/models/<MODEL_ID>

Check that model_state is DEPLOYED before registering the flow agent.

How the Flow-Agent Request Works

  • The flow agent is focused on query planning. It uses the Query Planning Tool to convert a natural-language question into a structured query.
  • Define a reusable search template: The implementation uses search templates to describe useful retrieval patterns. The following example illustrates a general document search over titles, content, full text, and nested chunks.
POST /_scripts/general_search{
  "script": {
    "lang": "mustache",
    "source": {
      "size": "{{size}}{{^size}}10{{/size}}",
      "query": {
        "bool": {
          "should": [
            {
              "multi_match": {
                "query": "{{query}}",
                "fields": [
                  "title^6",
                  "content^5",
                  "full_content^4"
                ],
                "operator": "or"
              }
            },
            {
              "nested": {
                "path": "chunks",
                "query": {
                  "multi_match": {
                    "query": "{{query}}",
                    "fields": [
                      "chunks.chunk_text^3",
                      "chunks.detected_entities^6"
                    ],
                    "operator": "or"
                  }
                }
              }
            }
          ],
          "minimum_should_match": 1
        }
      }
    }
  }
}

The field boosts express a relevance preference: a match in title, for example, can contribute more to scoring than a match in full_content. The nested query searches chunk-level fields within the chunks objects.

Important distinction: Registering a Mustache search template does not mean that QueryPlanningTool necessarily renders that template by substituting its variables. In template-guided mode, OpenSearch documents that the LLM uses template descriptions and query structures as guidance to generate a contextually appropriate DSL query. If no template fits, the model can attempt to generate a query independently. Verify the exact behavior for your OpenSearch version and configuration.

  • Add a source-specific search template: A source-specific template can be useful when a user explicitly wants information from a particular source.
POST /_scripts/source_search{
  "script": {
    "lang": "mustache",
    "source": {
      "size": "{{size}}{{^size}}10{{/size}}",
      "query": {
        "bool": {
          "must": [
            {
              "multi_match": {
                "query": "{{query}}",
                "fields": [
                  "title^6",
                  "content^5",
                  "full_content^4"
                ]
              }
            }
          ],
          "filter": [
            {
              "term": {
                "source": "{{source}}"
              }
            }
          ]
        }
      }
    }
  }
}

This template illustrates a source filter. It assumes source is mapped as an exact-match field, such as a keyword field. If the field is mapped as analyzed text, use the appropriate exact-match subfield or adjust the filter.

These templates are reusable query patterns, not a substitute for inspecting the actual DSL generated at runtime.

  • Register the flow agent: A flow agent can use QueryPlanningTool to generate DSL from the user’s question. The following is a simplified registration example using the response-filter format documented for Claude through the Amazon Bedrock Converse API.
POST /_plugins/_ml/agents/_register{
  "name": "Enterprise Search Flow Agent",
  "type": "flow",
  "description": "Enterprise Search Planner",
  "tools": [
    {
      "type": "QueryPlanningTool",
      "description": "Plans Enterprise Search queries",
      "parameters": {
        "model_id": "<BEDROCK_QUERY_PLANNER_MODEL_ID>",
        "generation_type": "user_templates",
        "response_filter": "$.output.message.content[0].text",
        "search_templates": [
          {
            "template_id": "general_search",
            "template_description": "Search document title, content, chunk text and detected entities."
          },
          {
            "template_id": "source_search",
            "template_description": "Filter documents by source."
          }
        ]
      }
    }
  ]
}

Replace <BEDROCK_QUERY_PLANNER_MODEL_ID> with the model ID registered in your environment. The response filter must match the actual response shape of the selected model connector.

The template IDs and descriptions must correspond to the resources and configuration used in your deployment. Confirm the accepted registration fields against your OpenSearch version before running this example.

  • Configure the agentic search pipeline: The pipeline invokes the flow agent to translate the incoming agentic query. The response processor can add the generated DSL to the response context for debugging and evaluation.
PUT /_search/pipeline/enterprise-agentic-pipeline{
  "request_processors": [
    {
      "agentic_query_translator": {
        "agent_id": "<FLOW_AGENT_ID>"
      }
    }
  ],
  "response_processors": [
    {
      "agentic_context": {
        "dsl_query": true
      }
    }
  ]
}

Replace <FLOW_AGENT_ID> with the ID returned when the agent was registered.

  • Execute an agentic search request: Once the pipeline is configured, submit a request to a specific index using the top-level agentic query. Replace enterprise-docs with the target index in your environment:
POST /enterprise-docs/_search?search_pipeline=enterprise-agentic-pipeline{
  "query": {
    "agentic": {
      "query_text": "What are the adverse reactions of azithromycin?"
    }
  }
}

The response contains the search hits. Because the pipeline includes agentic_context, its ext section can also include the generated DSL query. Use that output to inspect and debug the query-planning behavior.

From Search Hits to a Grounded Answer

OpenSearch returns ranked documents. Our FastAPI layer then turns them into an answer:

  • Normalise each hit into title, content, source, URI, version and score.
  • Keep the top 5 and trim each document to the passages most relevant to the question, up to length limit.
  • Build a prompt that tells Claude to answer only from the supplied documents, in about 150 to 200 words, and to reply with a fixed “no information” sentence when the context has no answer.
  • Call the configured answer-generation model on Amazon Bedrock and return the answer with source documents. The model is configurable; use a model ID that is enabled in your AWS account and supported by your connector.

The application should preserve the source identifier and URI for each passage used to generate the answer. Where feasible, validate that citations refer to retrieved passages and that the cited passages support the claims made. Returning a list of source documents alone does not prove that every answer claim is grounded in those documents.

What Is a Conversational Agent?

A conversational agent keeps memory, so the user can say “their dosing schedules” and the agent knows which vaccines they mean. It also decides for itself which tools to call: list indexes, inspect a mapping, plan a query. The LLM runs this loop for up to ten iterations.

The agent alone was not sufficient for the production behavior we wanted. During testing, it sometimes asked which index to search or produced answers that were not adequately grounded in enterprise evidence. Our API therefore applies an enterprise-search gate and supplies evidence to the answer-generation path. This is an application-level safeguard, not a substitute for OpenSearch authorization or document-level access control.

The Enterprise-Search Gate and Follow-Up Recommendations

The enterprise-search gate is an application-level rule that decides whether a user request should invoke enterprise retrieval. In this implementation, classify the request before calling the conversational agent: if it asks for facts, documents, policies, products, or other information expected to exist in the connected enterprise sources, route it to the search agent; if it is a greeting, small talk, a request to rephrase supplied text, or another task that does not require enterprise data, do not run a search. Return a brief non-search response or route it to the appropriate non-search handler. If classification is uncertain, ask a clarifying question rather than letting the agent guess an index. This gate is not an authorization mechanism; enforce access controls separately.

Next-question recommendations are generated after the answer by the application layer, using the current question, the grounded answer, and the retrieved document titles/topics. Ask the answer model to suggest three useful follow-ups that are answerable from the retrieved evidence, then validate or constrain them against the available context. Do not present generic suggestions as document-backed facts, and omit recommendations when retrieval returned no useful evidence.

A simple production rule is: needs_enterprise_data(question) == true → invoke the agent and retrieve evidence; otherwise → skip enterprise search and use the non-search handler. Keep the classification result and reason in logs so false positives and false negatives can be evaluated.

Retry to a temporary agent error. Occasionally the agent returns a transient error because the tool call the LLM requested and the tool result sent back are out of step in the conversation history, and Bedrock rejects the request. The API retries the call a limited number of times (three in our implementation) and, if it still fails, falls back to answering from the retrieved documents.

Conversational Agent Architecture:

Conversational agent architecture with conversation memory and enterprise search

Conversation Flow

  1. User → Conversation API
    The user submits a natural-language question.
  2. Conversation API → OpenSearch ML Agent
    The API sends the question. For an existing conversation, it also retrieves and sends the corresponding memory_id.
  3. OpenSearch ML Agent → OpenSearch
    The agent determines how to handle the question and uses the appropriate search tools to retrieve enterprise information.
  4. OpenSearch → Agent → API
    Relevant information is returned to the agent, which generates the response while maintaining the conversation context.
  5. Conversation API → UI
    The API returns the final response along with:

    • conversation_id
    • Answer
    • Citations
    • Next-question recommendations

For a new chat, the API creates a new conversation_id. For follow-up questions, the UI sends the same conversation_id, and the backend retrieves the associated OpenSearch memory_id when one is returned and used by the configured agent. Keep the application’s conversation identifier separate from OpenSearch’s memory identifier.

Default search scope. When the caller does not specify an index, the search runs across the sources that are enabled for the application, and results come only from those. Pair this with OpenSearch access controls so each user can only retrieve documents they are permitted to see.

Register and Test the Conversational Agent

The example below uses the OpenSearch conversational v1 agent with memory.type set to conversation_index. This configuration does not use a memory-container ID. The memory_containers API is for the agentic_memory memory type; do not create a memory container for this example unless you deliberately change the memory configuration and follow the corresponding documentation.

Step 1. Register the Conversational Agent

POST /_plugins/_ml/agents/_register{
  "name": "Enterprise Search Conversational Agent",
  "type": "conversational",
  "description": "Conversational agent for Enterprise Search with index discovery, mapping inspection, query planning, and conversation memory",
  "llm": {
    "model_id": "<CONVERSATIONAL_MODEL_ID>",
    "parameters": {
      "max_iteration": 10,
      "user_prompt": "${parameters.question}",
      "system_prompt": "You are an enterprise search assistant. When a user asks a question that requires information from OpenSearch data, use the available tools rather than answering from general knowledge. Use ListIndexTool to identify relevant indexes, IndexMappingTool to understand the index structure, and QueryPlanningTool to generate the appropriate OpenSearch DSL query. For search-related questions, base your response on information available through the enterprise search tools. Do not invent index names, fields, mappings, or document content."
    }
  },
  "tools": [
    {
      "type": "ListIndexTool",
      "name": "ListIndexTool",
      "description": "Use this tool to discover available OpenSearch indexes and identify the most relevant index for the user's search request.",
      "include_output_in_agent_response": false
    },
    {
      "type": "IndexMappingTool",
      "name": "IndexMappingTool",
      "description": "Use this tool to inspect the mapping and settings of a relevant OpenSearch index before generating a search query.",
      "include_output_in_agent_response": false
    },
    {
      "type": "QueryPlanningTool",
      "name": "QueryPlanningTool",
      "description": "Use this tool whenever the user asks to search or retrieve information from OpenSearch data. Generate the appropriate OpenSearch DSL query using the user's question, target index, and index mapping.",
      "parameters": {
        "model_id": "<BEDROCK_QUERY_PLANNER_MODEL_ID>"
      },
      "include_output_in_agent_response": false
    }
  ],
  "parameters": {
    "_llm_interface": "bedrock/converse/claude"
  },
  "memory": {
    "type": "conversation_index"
  },
  "app_type": "os_chat"
}

After registration succeeds, OpenSearch returns an agent_id. Store that ID securely in your deployment configuration; do not publish an environment-specific ID.

Step 2. Verify the agent

GET /_plugins/_ml/agents/<CONVERSATIONAL_AGENT_ID>

This verifies that the agent has been registered and that its LLM, tools, memory configuration, and other settings are available.

Step 3. Execute a test question

POST /_plugins/_ml/agents/<CONVERSATIONAL_AGENT_ID>/_execute{
  "parameters": {
    "question": "What are the adverse reactions of azithromycin?"
  }
}

Inspect the response and confirm that the agent uses the configured enterprise-search tools rather than relying on unsupported general knowledge. The exact response shape depends on the model connector and agent configuration.

Step 4. Test a follow-up question

For a follow-up, pass the memory_id returned by the previous execution in parameters.memory_id. For example, if the first response returned memory_id as abc123xyz, use:

POST /_plugins/_ml/agents/<CONVERSATIONAL_AGENT_ID>/_execute{  "parameters": {    "question": "What are the serious warnings associated with it?",    "memory_id": "abc123xyz"  }}

abc123xyz is an example value; replace it with the actual memory_id returned by your first execution. The UI can keep its own conversation_id, but the API must resolve it to this OpenSearch memory_id before making the follow-up call.

What the two architectures have in common

Both approaches use OpenSearch to retrieve enterprise data and an LLM to interpret the user’s intent. Their principal difference is the scope of orchestration and the handling of conversational context.

The choice is not simply between a basic and an advanced search engine. It is about choosing the orchestration model that fits the user experience, latency budget, and need for conversation continuity.

Lessons We Learned

The agent sometimes asked which index to search. A controlled index configuration and an enterprise-search gate reduced ambiguity; the application should not rely on the model to discover or infer deployment-specific index names in every request.

The agent sometimes returned answers that were not grounded in retrieved evidence. We added evidence-first answer generation, source references, a no-information response for unsupported questions, and citation validation as production safeguards.

Template guidance is not template rendering. Registered templates can describe useful patterns to the planner, but the generated DSL must be inspected at runtime; do not assume Mustache variables are substituted by QueryPlanningTool.

Example Output, Evaluation, Latency and Cost

The following snippets are representative examples to show what to inspect. Replace them with captured outputs from your own domain before describing them as measured production results.

Sample generated DSL (representative agentic_context.dsl_query output)

{
  "size": 10,
  "query": {
    "bool": {
      "should": [
        {
          "multi_match": {
            "query": "adverse reactions of azithromycin",
            "fields": [
              "title^6",
              "content^5",
              "full_content^4"
            ]
          }
        },
        {
          "nested": {
            "path": "chunks",
            "query": {
              "multi_match": {
                "query": "adverse reactions of azithromycin",
                "fields": [
                  "chunks.chunk_text^3",
                  "chunks.detected_entities^6"
                ]
              }
            }
          }
        }
      ],
      "minimum_should_match": 1
    }
  }
}

Flow agent sample response:

Request:

{
  "query": "What are the risks and benefits of Rotavirus vaccines?",
  "index_name": "enterprise-docs",
  "search_type": "agentic"
}

Response:

{
  "query": "What are the risks and benefits of Rotavirus vaccines?",
  "answer": "Rotavirus vaccines have demonstrated a favorable risk-benefit profile globally. \n\n**Benefits:**\n Rotavirus vaccines have made a demonstrable impact on reducing diarrheal morbidity and mortality worldwide. In the United States during the pre-vaccination era, rotavirus caused approximately 55,000-70,000 hospitalizations, 205,000-272,000 emergency department visits, and 410,000 provider visits annually among children under 5 years, with approximately 20-60 deaths per year. After vaccine introduction in 2006, the burden was significantly reduced, with 45,000 fewer hospitalizations, 62,000 fewer emergency department visits, and 280,000 fewer clinic visits averted. The vaccines have shown significant impact on diarrheal morbidity and mortality across diverse geographies, though effectiveness tends to be higher in higher-resource settings.\n\n**Risks:**\n Although rotavirus vaccines are generally well tolerated, they have been associated with a temporally limited increase in the risk of intussusception, a rare but serious adverse event.",
  "keywords": [
    "rotavirus",
    "vaccines",
    "risks",
    "benefits"
  ],
  "documents": [
    {}
  ]
}

Conversation Agent sample response:

Test 1: New Conversation

Request:

{
  "question": "What are Rotavirus vaccines?"
}

The API creates a new conversation_id, invokes the Conversational Agent, and returns the response along with the conversation memory, citations, and recommended next questions.

Sample Response:

{
    "conversation_id": "conv_481517c98c5c",
    "memory_id": "Y1hMVqABsiVrSMs3sCaF",
    "parent_interaction_id": "ZFhMVqABsiVrSMs3sCaN",
    "question": "What are Rotavirus vaccines?",
    "answer": "Rotavirus vaccines are vaccines designed to protect against rotavirus infection, which is a common cause of severe diarrhea in infants and young children worldwide.
  "index_name": "enterprise-docs",
    "citations": [
        {
            "title": "Rotavirus Vaccination: Current Impact and Future Developments",
            "uri": "https://docs.example.com/doc/12345",
            "source": "enterprise-docs",
            "document_id": 12345,
            "version": "1.0",
            "score": 99.59663
        },
      ],
    "next_questions": [
        "What are the available rotavirus vaccines?",
        "What are the dosing schedules for these vaccines?",
        "What are the safety considerations for rotavirus vaccines?"
    ]
}

Test 2: Follow up question

Use the conversation_id returned from the previous response:

Request:

{
  "question": "What are the available vaccines?",
  "conversation_id": "conv_481517c98c5c"
}

Response:

{
  "conversation_id": "conv_481517c98c5c",
  "memory_id": "Y1hMVqABsiVrSMs3sCaF",
  "parent_interaction_id": "ZlhPVqABsiVrSMs33iag",
  "question": "What are the available vaccines?",
  "answer": "The two main rotavirus vaccines that are currently licensed and available are:\n\n## 1. RotaTeq (RV5)\n- Type: Pentavalent vaccine (protects against 5 strains of rotavirus)\n- Manufacturer: Merck\n- Dosing: 3-dose series\n- Schedule: Given at 2, 4, and 6 months of age\n\n## 2. Rotarix (RV1)\n- Type: Monovalent vaccine (protects against 1 main strain of rotavirus)\n- Manufacturer: GlaxoSmithKline (GSK)\n- Dosing: 2-dose series\n- Schedule: Given at 2 and 4 months of age\n\n## Key Points:\n- Both vaccines are oral (liquid drops given by mouth)\n- Both are live, attenuated vaccines (contain weakened virus)\n- Both are highly effective at preventing severe rotavirus disease\n- The choice between them often depends on what's available in your country or healthcare system\n- Both have similar safety profiles and effectiveness\n\nThere are also some other rotavirus vaccines available in specific countries (such as Rotavac in India and Rotasiil), but RotaTeq and Rotarix are the most widely used globally.",
  "index_name": "enterprise-docs",
  "citations": [
    {
      "title": "Rotavirus Vaccination: Current Impact and Future Developments",
      "uri": "https://docs.example.com/doc/12345",
      "source": "enterprise-docs",
      "document_id": 12345,
      "version": "1.0",
      "score": 94.16126
    },
    {
      "title": "Rotavirus Vaccines: Global Coverage and Future Prospects",
      "uri": "https://docs.example.com/doc/34565",
      "source": "enterprise-docs",
      "document_id": 6,
      "version": "1.0",
      "score": 75.61986
    }
  ],
  "next_questions": [
    "Which documents contain more information?",
    "What are the relevant safety considerations?",
    "Which documents provide supporting evidence?"
  ]
}

How we evaluated query quality

We evaluate whether the agent generates the correct search query and retrieves relevant documents. Metrics such as Precision@k, Recall@k, and nDCG@k measure retrieval quality. We also check whether answers are supported by the retrieved documents and citations.

Indicative latency and cost

Latency and cost for both flow-agent and conversational-agent patterns depend on the use case, business requirements, selected Bedrock model, token usage, and number of agent iterations. Performance and cost should be evaluated against the specific application’s requirements and validated through testing in the target environment.

Conclusion

Agentic and conversational search provide complementary ways to make enterprise knowledge easier to access.

A flow agent is a good fit when the primary goal is to translate a single natural-language question into a structured search query and retrieve relevant results. A conversational agent is better suited to experiences that require persistent context, follow-up questions, or coordination across multiple search tools.

In the architecture presented here, Amazon OpenSearch Service handles retrieval and agent orchestration, Amazon Bedrock provides the language models, and a Python API layer prepares evidence, manages conversation sessions, and formats responses.

The most important production lesson is that query planning and answer generation should not be treated as guarantees of correctness. A dependable system must evaluate retrieved evidence, verify citations, handle uncertainty, and make its behavior observable.

References