Skip to main content
When an agent gets a query wrong, the fix shouldn’t live in your head. Agno’s LearningMachine diagnoses the error, saves the correction as a learning, and pulls it back into context the next time a similar question comes in.
Passing knowledge to the LearningMachine enables the Learned Knowledge store, where corrections live. decision_log=True records the reasoning behind each change. The agent accumulates corrections across runs and pulls the relevant ones into context on future questions.

The loop

  1. The agent writes SQL and runs it.
  2. It errors, or returns a number a human flags as wrong.
  3. The agent diagnoses the cause (wrong column, stale table, a join that double-counts).
  4. The fix is saved as a learning.
  5. The next similar question retrieves that learning before generating SQL.
Each diagnosed error is written down and pulled back before the next similar query, so recurring errors stop recurring: the agent accumulates what your warehouse’s sharp edges are.

Choose how learning happens

Each store takes a mode. For a data agent, you usually want errors captured automatically and schema changes proposed for review.

Audit what it learned

A data agent’s learnings change the numbers it reports, so they need to be inspectable. Read the Learned Knowledge store to see the corrections it captured, and the Decision Log for the reasoning behind a changed query shape.

Next steps

Developer Resources