The pathUnit 1 · FoundationsLesson 2 of 12

How agentic analytics works

An agentic analytics system answers a question by working in a loop. It turns the question into a plan, writes SQL, runs it on your warehouse, checks the result, and fixes its own mistakes before it replies. Here is what happens inside that loop and what has to sit behind it for the answers to be trustworthy.

The loop, step by step

Most agents follow the same basic path.

  1. Read the question and work out what is really being asked
  2. Plan the steps needed to answer it
  3. Write the SQL
  4. Run the query on the warehouse
  5. Read the result and check it makes sense
  6. Fix the query and try again, or return the answer

Steps five and six are the difference between an agent and a one-shot tool. A plain text to SQL feature stops at step four. An agent can catch a join that blew up the row count, or a filter it forgot, and correct it on its own.

What sits behind the agent

The loop only works if the agent has the right ground to stand on. A few parts do the heavy lifting.

  • A warehouse connection. The agent queries the real data, so it needs read access to BigQuery, Snowflake, Postgres, or whatever you run.
  • A semantic layer. This is where metrics get their one true definition, so revenue means the same thing every time.
  • Business context. Docs, rules, and notes that tell the agent how your company actually works.
  • Tools. Functions the agent can call, like running a query, looking up a definition, or pulling a past answer.
  • Tests. A way to check the agent against known questions before you trust it in front of people.
  • Governance. Limits on what tables and rows the agent can see.

Together these make up the context the agent reasons over. The model supplies the language skill. The context supplies the truth.

Why the loop matters for reliability

A single SQL query from a model is a guess. It might be right. You cannot tell without checking. The loop turns a guess into a checked answer. The agent runs the query, looks at the shape of the result, compares it against what it expected, and only then decides the answer is ready. This is the part that lets a team rely on the output instead of double-checking every number by hand.

What can still go wrong

Even a good loop fails when the context is thin. If the semantic layer is missing, the agent invents a definition of revenue. If the docs are stale, it answers from old rules. The failure is rarely the SQL. It is almost always the context behind it, which is why context engineering is the work that decides whether any of this is usable.

To step back and see the whole picture, read what is agentic analytics.