AgentQL is a recently released .NET library that aims to simplify database interactions for AI agents. It functions by introspecting existing EF Core models to generate schema descriptions that Large Language Models (LLMs) can readily understand. The library also provides a mechanism for safe SQL query execution, including features like configurable row limits, timeouts, and read-only enforcement, all within transactions. It exposes three LLM tool functions—`GetDatabaseSchema`, `ExecuteQuery`, and `ReportFailure`—which can be called automatically by compatible chat clients. AgentQL supports various AI providers, including OpenAI, Anthropic, and Ollama, and can be configured via `AgentQLOptions` and `AgentQLChatOptions` for aspects like maximum rows, read-only mode, and API keys. Developers can also use attributes or a Fluent API to control which entities and properties are included in the schema description. The project includes a demo Blazor app to illustrate its capabilities.
Featured on AI Radar: AgentQL: .NET Library for LLM-Friendly Database Interaction via EF Core