{"slug": "get-answers-from-tables-with-tabular-search-in-amazon-bedrock-managed-knowledge", "title": "Get answers from tables with tabular search in Amazon Bedrock Managed Knowledge Base", "summary": "Amazon Web Services added tabular search to Amazon Bedrock Managed Knowledge Base, letting agents answer analytical questions by running code over entire CSV, XLSX and XLS tables rather than relying on retrieved passages. The feature runs code over the original file in an isolated sandbox and returns results through the existing AgenticRetrieveStream request, combining table calculations with facts from related documents and citing the source files. AWS positions the capability for cases where retrieval alone fails, such as long tables with thousands of rows or wide tables with hundreds of columns, where splitting tables into passages produces incomplete totals, comparisons or threshold checks.", "body_md": "## [Artificial Intelligence](https://aws.amazon.com/blogs/machine-learning/)\n\n# Get answers from tables with tabular search in Amazon Bedrock Managed Knowledge Base\n\n[Amazon Bedrock Managed Knowledge Base](https://docs.aws.amazon.com/bedrock/latest/userguide/kb-build-managed.html) now supports tabular search, so you can get answers from tables through agentic retrieval. When a question needs data from CSV, XLSX, or XLS files, tabular search looks up values and runs calculations across every relevant row in one or more tables or sheets. It then combines the results with facts from related documents to answer analytical questions that take several steps.\n\nA finance team closing the quarter needs to know “Which departments must write variance commentary?” No single file has the answer. It depends on the variance policy’s threshold, the quarter-close memo’s budget revisions, and math over every department in the profit and loss (P&L) workbook.\n\nLike this finance team, most teams keep their narratives and data in the same place. For example, a Microsoft SharePoint site holds workbooks next to policies, and an [Amazon Simple Storage Service (Amazon S3)](https://aws.amazon.com/s3/) bucket holds CSV exports next to PDFs. Tabular search answers questions across these files through the same `AgenticRetrieveStream` request you already use for documents. It runs code over the original file in an isolated sandbox, so the answer uses the whole table instead of only the rows that retrieval returns. For the finance team, one request returns the departments that must write commentary. The answer cites the policy and the memo, and the trace names the workbook the code read.\n\nIn this post, you learn how tabular search answers questions that need both table data and facts from documents, and when another tool is a better fit. You also build a knowledge base with sample finance files and use the trace to see which file the code read.\n\n## Why tables are hard for retrieval\n\nRetrieval Augmented Generation (RAG) returns a fixed number of passages that best match a question, which works well for prose. Tables lose information when they’re split into passages, in ways that depend on the table’s shape:\n\n- **Long tables –** A table with thousands of rows spans many passages, and retrieval returns only the few that best match the question. An answer built from them uses a handful of rows, so a total, a comparison, or a threshold check can be incomplete.\n- **Wide tables –** In a table with hundreds of columns, one row can hold more text than a passage or a search model takes in at once. As a result, values in later columns are harder to match. Long passages from wide tables can also match many unrelated questions and push more relevant passages out of the results.\n\nRetrieval also has to match a question to the right table. Questions use business terms, such as “controllable spend,” but tables hold cost center codes, account names, and numbers. A draft and a final workbook look almost the same to search. The rule that gives the numbers meaning is often in a separate document, such as a policy.\n\nTabular search therefore splits the work. Retrieval only has to return one passage from the right table file, and code then reads the whole table. Because retrieval still has to find that file first, naming the file in your question helps.\n\nTable 1 shows how plain retrieval and tabular search each handle the finance team’s question, “Which departments must write variance commentary?”\n\n| **Compared** | **Retrieve only** | **Agentic retrieval with tabular search** | \n| What you get back | Passages from the policy, memo, business review, and workbook, but no complete answer | An answer naming Sales, Engineering, and Operations, with each department’s variance against its revised budget | \n| Revised variance percentages | Not available. No file stores them, so no passage can contain them | Calculated from every department row in the final workbook | \n| Sources | Each passage links to its own file, but none of them contains the answer | Citations to the finance policy and the close memo. The trace names the workbook the code read | \n\n*Table 1: The same question with plain retrieval and with tabular search.*\n\n## How tabular search works in agentic retrieval\n\nIn [agentic retrieval](https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-agentic-retrieve.html), an agent uses retrieval to decide which documents matter and then writes the answer. Tabular search is part of that flow, so there’s nothing to turn on.\n\nWhen a question needs the data in a table, the request moves through these stages:\n\n1. **Retrieve –** Passages come back, including passages from a table file.\n2. **Plan –** The agent uses the question and table structure to determine whether to run code over one or more retrieved tables.\n3. **Stage –** Tabular search copies the original file into an isolated sandbox with no network access.\n4. **Compute –** Model-written code runs over the whole table or sheet.\n5. **Return –** The agent gets back only what the code prints, such as totals or matching rows.\n6. **Answer –** The agent answers from the results and the passages, with citations.\n\nTabular search starts when retrieved passages come from a CSV, XLSX, or XLS file and the question needs a calculation across rows or a lookup of specific values.\n\n### Knowledge bases, connectors, and APIs\n\nAn `AgenticRetrieveStream` request can search one knowledge base or several. The `Retrieve` API keeps returning passages and doesn’t run code.\n\nTabular search works the same way whichever [connector](https://docs.aws.amazon.com/bedrock/latest/userguide/kb-managed-create.html#kb-managed-connectors) brings the files into the knowledge base, including Amazon S3, Microsoft SharePoint, Atlassian Confluence, and others.\n\n### Scope and trade-offs\n\nTabular search is built for questions that need calculations or lookups over the table files it retrieves. Running code adds at least one more agent turn, so answers that use table data take longer than text-only answers. Governed metrics, recurring dashboards, warehouse-scale joins, and reporting controls still belong in your business intelligence (BI) tools. Tabular search works on table files stored next to your documents, and you don’t define a schema.\n\n## Solution overview\n\nIn this solution, an Amazon Bedrock Managed Knowledge Base stores your CSV and Excel files together with related documents, such as PDF and Word files. Your application sends every question through agentic retrieval. When a question needs table data, the answer combines calculations over your tables with facts from your documents. It cites the passages it used, and the trace names the table files the code read.\n\nIn Figure 1, an Amazon S3 data source syncs these files into the knowledge base, which keeps embeddings, text, metadata, and the original files. When your application sends a question with `AgenticRetrieveStream`, agentic retrieval plans the work and retrieves passages from the knowledge base. If the question needs data from a table file, it sends the files to read to an isolated sandbox with no network access. There, model-written code runs over the original file and returns printed results. The answer, with citations and trace events, streams back to your application.\n\nThe worked example uses fictitious AnyCompany Retail finance files:\n\n- **Final P&L workbook** (`anycompany-pnl-fy2026.xlsx` ). It has Notes, Actuals, Budget, and Summary sheets, with one row per month, cost center, and account in the Actuals and Budget sheets.\n- **Draft workbook.** A preliminary copy with different Q3 numbers.\n- **Finance variance policy** (PDF). Defines controllable spend and approved budget, and sets review thresholds.\n- **Q3 close memo** (Word). Lists approved and rejected budget revisions.\n- **Business review** (Markdown). Explains the main variances.\n\nThese files are in the [tabular-search folder](https://github.com/aws-samples/sample-managed-knowledge-base-patterns/tree/main/tabular-search) of the sample-managed-knowledge-base-patterns GitHub repository. The folder also has an AWS Cloud Development Kit (AWS CDK) app that deploys the resources in this post, and Python scripts that ask these questions.\n\n## Prerequisites\n\nYou need the following:\n\n- Permissions to create AWS Identity and Access Management (IAM) roles, S3 buckets, and Amazon Bedrock knowledge bases.\n- For the identity that calls `AgenticRetrieveStream` , the[permissions for agentic retrieval](https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-agentic-retrieve.html) , including`bedrock:GetDocumentContent` . The agent reads the original table file with the caller’s credentials.\n- Amazon Bedrock in an AWS Region where tabular search is available. For Region availability, see [Supported AWS Regions](https://docs.aws.amazon.com/bedrock/latest/userguide/kb-managed-regions.html) .\n- Your own CSV, XLSX, or XLS files and related documents.\n- To follow the walkthrough: Python 3.10 or later with the AWS SDK for Python (Boto3) version 1.43.123 or later. You can also ask questions from the knowledge base test window in the Amazon Bedrock console or with the AWS Command Line Interface (AWS CLI).\n\nThe calling identity needs this policy, from the agentic retrieval documentation:\n\nFor costs, see [Amazon Bedrock pricing](https://aws.amazon.com/bedrock/pricing/).\n\n## Upload your files to Amazon S3\n\nPut the table files and related documents under one prefix.\n\n1. Open the Amazon S3 console and choose **Create bucket** .\n2. Enter a globally unique bucket name (this post uses `amzn-s3-demo-bucket` ), keep**Block all public access** selected, and choose**Create bucket** .\n3. Choose the bucket, choose **Create folder** , and enter`finance` .\n4. Open the `finance` folder and choose**Upload** .\n5. Choose **Add files** , select your table files and documents, and choose**Upload** .\n\n## Create the knowledge base and data source\n\nThe knowledge base needs an IAM role that Amazon Bedrock can assume. This trust policy allows only the `bedrock.amazonaws.com` service principal, and only for knowledge bases in your account.\n\nNext, set up the remaining resources:\n\n1. Create a role named `kb-finance-role` with the trust policy.\n2. Attach an inline policy that allows `s3:ListBucket` on the bucket and`s3:GetObject` on its objects.\n3. Create a knowledge base of type `MANAGED` with the managed embedding model.\n4. Create a `MANAGED_KNOWLEDGE_BASE_CONNECTOR` data source for the bucket, limited to the`finance/` prefix.\n5. Set `maxFileSizeInMegaBytes` above your largest file.\n\nThe inline policy for step 2 allows reads on this bucket only:\n\nThis script runs steps 3 to 5 and prints the IDs:", "url": "https://wpnews.pro/news/get-answers-from-tables-with-tabular-search-in-amazon-bedrock-managed-knowledge", "canonical_source": "https://aws.amazon.com/blogs/machine-learning/get-answers-from-tables-with-tabular-search-in-amazon-bedrock-managed-knowledge-base/", "published_at": "2026-11-16 16:12:16+00:00", "updated_at": "2026-11-16 16:22:26.520148+00:00", "lang": "en", "topics": ["artificial-intelligence", "ai-agents", "ai-products", "ai-tools", "generative-ai"], "entities": ["Amazon Web Services", "Amazon Bedrock Managed Knowledge Base", "AgenticRetrieveStream", "Amazon Simple Storage Service", "Microsoft SharePoint"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/get-answers-from-tables-with-tabular-search-in-amazon-bedrock-managed-knowledge", "markdown": "https://wpnews.pro/news/get-answers-from-tables-with-tabular-search-in-amazon-bedrock-managed-knowledge.md", "text": "https://wpnews.pro/news/get-answers-from-tables-with-tabular-search-in-amazon-bedrock-managed-knowledge.txt", "jsonld": "https://wpnews.pro/news/get-answers-from-tables-with-tabular-search-in-amazon-bedrock-managed-knowledge.jsonld"}}