Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Sql Agent Laravel Package

knobik/sql-agent

Self-learning text-to-SQL agent for Laravel that turns natural language into accurate, safe SQL. Uses schema introspection, a curated knowledge base, query patterns, and conversation memory; recovers from errors and saves learnings. Includes built-in chat UI.

View on GitHub
Deep Wiki
Context7

title: SQL Agent for Laravel description: A self-learning text-to-SQL agent that converts natural language questions into SQL queries using LLMs. template: splash hero: tagline: A self-learning text-to-SQL agent that converts natural language questions into SQL queries using LLMs. image: file: ../../assets/logo.svg actions: - text: Get Started link: /sql-agent/getting-started/introduction/ icon: right-arrow - text: View on GitHub link: https://github.com/knobik/sql-agent icon: external variant: minimal

import { Card, CardGrid } from '@astrojs/starlight/components';

Why This Package?

Raw LLMs writing SQL hit a wall fast — schemas lack meaning, types are misleading, tribal knowledge is missing, and the same errors repeat endlessly. The root cause is missing context and missing memory.

How It Works

  1. Assemble context — The agent retrieves relevant table metadata, business rules, query patterns, and past learnings based on the question
  2. Enter tool loop — The LLM iteratively introspects schema, searches for additional knowledge, executes SQL, and refines results
  3. Learn and improve — Errors become learnings, successful queries become reusable patterns — both feed back into future context assembly

See the Introduction for a detailed architecture overview.

Quick Start

composer require knobik/sql-agent
php artisan sql-agent:install

Then configure your LLM provider in .env and start asking questions:

use Knobik\SqlAgent\Facades\SqlAgent;

$response = SqlAgent::run('How many users signed up this month?');
echo $response->answer;

See the Installation guide for full setup instructions.

Features

  • Multi-Database Support — MySQL, PostgreSQL, SQLite, and SQL Server
  • Multiple Search Drivers — Database full-text search or pgvector semantic search
  • Agentic Loop — Tool calling to introspect schema, run queries, and refine results
  • Livewire Chat UI — Ready-to-use chat interface with conversation history
  • Evaluation Framework — Test your agent's accuracy with automated evaluations
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours