For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
99
Sponsor

Chat with Database

Introspects a database schema, converts questions to SQL, and runs read-only queries.

Live preview

Flue

Output will stream here when you run the agent.

Summary

The Chat with Database Agent answers questions about your data in plain English. It introspects the schema, writes the SQL, runs it read-only, and explains the results. Reach for it to give non-SQL users a safe way to query a database, or to prototype analytics without hand-writing queries.

Install

$ pnpm dlx shadcn@latest add @agentcn/flue/text-to-sql

Composition

agents/
└── text-to-sql.ts            # Agent with the two database tools
tools/
├── introspect-schema.ts      # Lists tables and columns
└── run-query.ts              # Runs a read-only SELECT
lib/
└── db.ts                     # Database client (SQLite by default)

Customization

  • Swap the database. Replace the client in lib/db.ts with Postgres or MySQL.
  • Allow writes (carefully). run-query.ts blocks non-SELECT SQL by default.
  • Add a workflow. Wrap introspect + query in a workflow with a typed result.
  • Swap the model. Change the model field on the agent.