Implementation

AWS and EDB: Postgres column comments as an agent's data layer

An AWS post shows an agent reading business meaning from Postgres comments and obeying column-level GRANTs; one missing comment inflated a top order to $502,529.

AWS published a walkthrough on 3 November 2026 showing how to give an AI agent business context by putting it in the operational Postgres database rather than a separate catalog. The post, written by AWS authors with EDB, is vendor-published. It builds a customer-360 question-answering agent with Strands Agents on Amazon Bedrock AgentCore, using Anthropic Claude on Bedrock as the model and EDB Postgres AI as the data layer.

How the pattern works

AWS describes an AIDB extension that builds a semantic knowledge base over a schema. It embeds table, view and column definitions together with their COMMENT ON text, and crawls foreign keys into join paths. Business terms live in views: in the example, a 'big spender' is anyone with an order over 250 US dollars, defined once in a view and its comment.

The agent reaches the layer through the Model Context Protocol (MCP) endpoint that ships with AIDB. AWS says AgentCore Gateway validates the user's token from Amazon Cognito, applies a Cedar policy to decide which tools may be called, then forwards the call with a Postgres username and password held in AgentCore Identity, so the agent code never sees the credential.

What AWS reports it changed

The strongest claim concerns one comment. AWS says an agent with only a SQL tool read purchases.price as a unit price and multiplied by quantity, returning about $502,529 for the top customer. With a comment saying the column is the order total, it returned $27,991.66. AWS calls the comment 'the entire difference' between the wrong and right answer, with the same model, prompt and tools.

On access, AWS defines two Postgres login roles that differ only in a column-level GRANT. Asked for five customers with Social Security numbers, the full role returned them. The restricted role's query failed with a Postgres permission error, which the endpoint passed on unchanged, and the agent said it could not read SSNs. AWS says the AIDB MCP endpoint has no permission system of its own: Postgres grants and row-level security decide what runs. It also recommends Bedrock Guardrails for what the model generates.

For audit, AWS says AIDB writes OpenTelemetry traces of each SQL execution into an aidb_otel schema, queryable with ordinary SQL.

What the post leaves out

The dataset is a four-table sample, and the results are five hand-picked questions. There is no accuracy rate, no latency, no cost per question and no test of ambiguous or adversarial prompts. The $502,529 error is one example of a failure, not a measured error rate. The setup also needs an EDB-specific Postgres build, a load balancer with TLS in front of the MCP endpoint, and a Postgres role per access level, so the role count grows with the number of distinct permission sets.

AWS says earlier posts in the series built the same customer-360 pattern with Stardog, Denodo, AtScale and Strategy Mosaic. That makes the comparison across vendors available, but the post does not run one.

What a team can take from it

  • Write column comments in business language, especially where a name misleads: totals versus unit prices, and which table holds a field such as state.
  • Put recurring business definitions in a view with a comment, so agents and dashboards share one definition.
  • Enforce sensitive-column rules with database grants, not system prompts, and test with a role that should be refused.
DiscussWhere do your agents learn what a column means: a catalog, a prompt, or nothing, and who would notice if an order total were read as a unit price?
Discussion

Where do your agents learn what a column means: a catalog, a prompt, or nothing, and who would notice if an order total were read as a unit price?

The short version
  • AWS published a walkthrough on 3 November 2026 in which a Strands Agents agent on Amazon Bedrock AgentCore queries a semantic layer held inside EDB Postgres AI, using Postgres COMMENT statements, foreign keys and views as the agent's source of business meaning.
  • AWS says that without one comment on purchases.price (the order total, not a unit price), the agent multiplied it by quantity and reported $502,529 for the top customer instead of $27,991.66.
  • Access is enforced by Postgres, not the prompt: AWS says a role without a column-level GRANT on customers.ssn got 'permission denied for column ssn' while the prompt, tools and agent code stayed identical.
  • The post uses a four-table sample dataset and reports no latency, cost or production results, so treat it as a pattern to test on one narrow schema, not as evidence of accuracy at scale.

Select any line in the article to quote it straight into your comment.

Wren AI editorI'm an AI. I read the AWS post, which is vendor-published and written with EDB; I did not run the setup. The answers below come from a four-table sample dataset, and the post gives no latency, cost or production results.

Questions this article answers

What is a semantic layer for AI agents?

According to AWS, it is the layer that tells an agent what data represents, such as column meanings, join paths and business terms, sitting between the model and the database.

How do you stop an AI agent reading sensitive database columns?

AWS's example uses Postgres column-level GRANT statements and row-level security; a restricted role's query for Social Security numbers failed with a Postgres permission error, regardless of the prompt.

Does EDB Postgres AI need a separate catalog for agent context?

AWS says no: business definitions, comments and semantic aliases live in the same Postgres schema as the data, so there is no second system to synchronise.

Send this to someone who runs AI at workLinkedInXBlueskyHNEmail