Course overview/Bring in the agent3 of 4
Interrogate the logic
Interrogate the logic
Push back on an agent's query with four moves, and reconcile every answer against anchors.
Four questions that expose a query
Auditing tells you whether a query is right. Interrogating tells you why it is built the way it is, and where it would fail. Four moves do most of the work.
- Why this and not that. "Why an INNER JOIN here rather than a LEFT JOIN? What would change in the result?" The answer names an assumption you can then check.
- What if. "What happens to this number if a customer has no orders? If an order has no items?" Edge cases are where silent failures hide.
- Show me a second way. Ask for an alternative implementation, then ask which is correct and why. When two of the agent's own answers disagree, that is a signal, not noise.
- What would break this. "What assumption is this query making that could stop being true?" A query that is right today can be wrong after the data changes.
Ask these in the agent's own conversation, one at a time. The goal is not to catch the agent out. It is to surface the decisions the query is quietly making so you can agree or disagree with each one.
Keep a short list of anchors
The cheapest fraud detection available is a handful of numbers you have verified by hand. Check every new answer against them. Almost no course teaches this, and it catches more wrong numbers than any single technique.
Build a five-line queries/anchors.md with numbers you trust. The template ships a starting file with a few pre-filled. Good anchors for this dataset:
Total orders: 1,200
Total order value (SUM order_total): 604,065.00
Orders in 2023: 360
Orders in 2024: 480
Correct 2024 line revenue (quantity * net_price): 338,209.56
When an agent hands you "2024 line revenue is 412,000", you already know it is wrong, because your anchor says 338,209.56. Order volume rose from 360 in 2023 to 480 in 2024, so a growth story should show more activity in 2024, not less. If a revenue figure moves the other way, interrogate it before you trust it.
Ask your coding agent
Give me a second, structurally different query that answers the same question. Then compare the two: do they return the same numbers? If they differ, find out why and tell me which one is correct. If they agree, tell me what could still be wrong with both of them.
Checkpoint
Using your anchors and the four moves, answer these:
- Did order volume grow or fall from 2023 to 2024, and by how much? (It rose from 360 to 480 orders.)
- Name one assumption in the agent's query that could stop being true after the data changes.
- Your second query agrees with the first. What is the one thing that agreement does, and does not, prove?