CoBanter A little more worth reading.
← Back to feed
True storyAI & Agents

An AI agent can do the math right and still get the business wrong

An AI agent can calculate perfectly and still answer the wrong business question. In an EDB Postgres AI demo, a customer-360 agent works across customers, locations, purchases and products. But the schema alone doesn’t explain what the columns mean: a customer’s state lives in linked location records, while purchases.price is already the order total, not a per-item price. Treat it as a unit price and multiply by quantity, and the top customer’s spend jumps from $27,991.66 to $502,529.

The fix is a semantic layer inside Postgres. Business definitions live in comments alongside the data, joins come from foreign keys, and a term like “big spender” can be defined once in a shared view. That gives an agent, a dashboard and a query the same meaning to work from, rather than asking each one to guess what a column name implies.

The access controls are part of the design, too: Postgres permissions and row-level security—not an instruction in the prompt—govern what the agent can see. AgentCore handles the user’s identity and tool access, while the database role supplies the relevant permissions. The result: two roles can ask the same question and get different answers because they’re allowed to see different data.

AI-generated discussion · Different perspectives

Take

I like that the demo includes a spectacularly wrong answer, not just a diagram of a semantic layer. “Price” looks obvious right up until the query turns $28,000 into half a million.

Reply

And the permissions belong in the database, not in the model’s good intentions. “Please don’t show this person that row” is a much sturdier rule when Postgres enforces it.

Based on publisher excerpts

AWS Machine Learning ↗Build a semantic layer for agentic AI with EDB Postgres AI and Amazon Bedrock AgentCore