Overview
Ai Query Builder is a PHP package for Laravel that provides a safe boundary between an AI agent and a database. It allows developers to declare what an agent may select, filter, join, group, and sort. The agent emits a query plan in JSON rather than SQL, and the package validates every part of that plan against the declaration, compiles it to an Eloquent query, adds scopes the plan cannot touch, and runs it under limits set by the developer. The package is not an AI layer itself; it sits underneath whichever AI layer is already in use. It requires PHP 8.3+ and Laravel 13.16+. Resources are defined by creating schema classes that specify columns, relations, and capabilities. Nothing is exposed until declared. The schema can be scaffolded from a model using an artisan command. Columns can be configured with capabilities such as filterable, aggregatable, groupable, sortable, and selectable. Relations are traversed by dotted path, and the compiler derives joins. Resources are registered in a configuration file and become available but not exposed to any agent until an agent's tools name them. The package provides a QueryDataTool for use with Laravel AI agents. It also includes an MCP server for external AI clients like Claude Desktop, Claude Code, and Cursor, requiring laravel/mcp. The same validation and scoping apply. Developers can inspect what an agent sees using artisan commands.
Pricing
Free
Detailed plans have not been confirmed in our catalog. Check the official website for current limits and billing terms.
Visit WebsitePrices and limits may change. Confirm the currency, billing period, seat minimum and usage caps on the official website.
Use Cases
- Teams use Ai Query Builder to create a safe boundary between an AI agent and their database.
- Teams use Ai Query Builder to declare which columns an agent can select, filter, join, group, and sort.
- Teams use Ai Query Builder to expose database resources to AI agents through Laravel AI tools.
- Teams use Ai Query Builder to connect external AI clients like Claude Desktop or Cursor via an MCP server.
- Teams use Ai Query Builder to enforce mandatory scopes on every query.
- Teams use Ai Query Builder to hide sensitive columns from users who lack permission.
Features
Connects AI agents with Laravel databases
Accepts agent-generated query plans
Validates query plans before use
Keeps SQL out of agent output
Provides a Laravel query builder layer
Reviews
No reviews yet. Be the first to share your experience!