Skip to main content

Dash — Self-Learning Database Agent

Dash is a self-learning PostgreSQL tool that turns your agent into a data analyst. It generates SQL from natural language, learns from every interaction, auto-corrects mistakes, and gets smarter over time. Inspired by OpenAI’s in-house data agent and built on the Agno Dash architecture.

How It Works

Every successful query becomes Knowledge — a proven pattern for future use. Every corrected error becomes a Learning — a mistake the system won’t repeat.

The 6 Layers of Context

When Dash assembles context for SQL generation, it draws from six distinct sources: The more your agent uses Dash, the richer layers 3 and 5 become.

Setup

From the Dashboard

  1. Go to your agent’s Tools section.
  2. Click Add Tool and select Dash (Self-Learning DB).
  3. Fill in the connection details:
    • Host — Your PostgreSQL server address
    • Database Name — The database to connect to
    • Username / Password — Database credentials
    • Schema — Default schema (usually public)
  4. Optionally configure business annotations (see below).
  5. Save the agent.

Via the API

Configuration

Business Annotations

Annotations are the secret to accurate SQL generation. They encode tribal knowledge that exists nowhere in the database schema:

Available Functions

Dash registers these functions that the agent can call:

Dual Memory System

Dash maintains two types of persistent memory:

Knowledge (Proven Patterns)

When a query succeeds, Dash stores it as Knowledge — a validated pattern that future queries can reference. Over time, this builds a library of working SQL for your specific database.

Learnings (Error Corrections)

When a query fails and is corrected, Dash stores the before/after pair as a Learning. The next time a similar question comes up, the agent sees the correction and avoids the same mistake.

Persistence

Knowledge and learnings are stored in a JSON file keyed by your database connection. They persist across agent restarts and sessions. The store is capped at 500 knowledge patterns and 200 corrections to prevent unbounded growth.

Auto-Retry on Errors

When a query fails, Dash doesn’t just return an error. It builds diagnostic context:
  1. Error classification — Identifies the error type (missing column, syntax error, type mismatch, timeout, etc.)
  2. Relevant past corrections — Searches learnings for similar failures that were previously fixed
  3. Fix suggestions — Recommends using discover_schema() or get_table_stats() to verify assumptions
The agent then rewrites the SQL and retries automatically, up to max_retries attempts. If the retry succeeds, the correction is stored as a Learning.

Security

Read-Only Mode (Default)

By default, Dash blocks all data-modifying statements:
  • INSERT, UPDATE, DELETE
  • DROP, TRUNCATE, ALTER, CREATE
  • GRANT, REVOKE, COPY
  • Piggyback attacks like SELECT ...; DROP TABLE ...

Query Timeout

All queries have a 30-second timeout to prevent runaway operations.

Best Practices

  • Always use a read-only database user — Even with read-only mode enabled, defense-in-depth is important.
  • Use a replica — Point Dash at a read replica, not your primary database.
  • Limit schema access — Only expose the schemas and tables the agent needs.

Example Conversations

Simple Question

Question with Learning

Auto-Correction

Integration with Agent Learning

Dash’s self-learning operates independently but complements the platform’s Agent Learning system:
  • Dash learnings are SQL-specific — query patterns and corrections stored locally per database
  • Agent learnings are conversation-level — feedback and corrections stored in the platform database
Both systems make your agent smarter over time, at different levels.

Next Steps