This example shows how to build a text-to-SQL system that:
We’ll use the F1 dataset as an example, but you can easily extend it to other datasets.
The complete code is available in the Agno repository.
Clone the repository
Create virtual environment
Install dependencies
Run PgVector
Load F1 data
Load knowledge base
The knowledge base contains table metadata, rules and sample queries that help the Agent generate better responses.
Pro tips for enhancing the knowledge base:
table_rules
and column_rules
to guide the Agent on query formatscookbook/examples/apps/sql_agent/knowledge_base/sample_queries.sql
Set up API keys
We recommend using gpt-4o for optimal performance.
Launch the app
Open localhost:8501 to start using the SQL Agent.
Need help? Join our Discourse community for support!
This example shows how to build a text-to-SQL system that:
We’ll use the F1 dataset as an example, but you can easily extend it to other datasets.
The complete code is available in the Agno repository.
Clone the repository
Create virtual environment
Install dependencies
Run PgVector
Load F1 data
Load knowledge base
The knowledge base contains table metadata, rules and sample queries that help the Agent generate better responses.
Pro tips for enhancing the knowledge base:
table_rules
and column_rules
to guide the Agent on query formatscookbook/examples/apps/sql_agent/knowledge_base/sample_queries.sql
Set up API keys
We recommend using gpt-4o for optimal performance.
Launch the app
Open localhost:8501 to start using the SQL Agent.
Need help? Join our Discourse community for support!