Pattern Definition

The Agentic Query Layer (AQL).

A software design pattern for giving large language models safe, permission-aware access to structured data. Plain questions in, structured answers out, without the model ever touching the data directly.

The Concept

Where the layer sits.

The Agentic Query Layer (AQL) sits between your data and a large language model (LLM). Instead of handing the model direct access to a database, you put a controlled layer in front of it. The model asks questions through the layer; the layer queries your systems through their existing APIs and returns structured results. The model never touches the data directly.

YOUR INFRASTRUCTUREUserPlain languagequestionAI AgentInterpretsthe questionAQLAgentic QueryLayerPermission-awareAccess-controlledLMS / MoodleWeb Services APICRMREST APIHR SystemREST APITicketingREST APICustom APIAny datasetStructured resultsFormatted answerAnswerModel never touches data directlyThe Agentic Query Layer (AQL) — plain language in, structured data out, model stays outside the trust boundary
Core Principles

Five rules that define the pattern.

01

Plain language in, structured data out

A person asks a question in everyday words. The layer turns it into precise, structured queries and returns clean results with context — no SQL, no report builders.

02

Permission-aware

Access is scoped to what a user is allowed to see. The layer enforces those boundaries on every query, so nobody gets more than they should.

03

Access-controlled

The layer enforces permissions on every request. A connector can support retrieval, changes, or both when the organization's rules allow it.

04

The model never touches the data directly

Data flows one way: out of your systems, through the layer, as results. The underlying data is never exposed to the model, and the model can never modify anything.

05

Dataset-agnostic

AQL is a pattern, not a product tied to one system. Any dataset with an API can plug into it. It just needs a connector.

The Pattern

One pattern. Any dataset.

AQL is not a product tied to one system. It is a pattern — an architectural approach that works on any dataset with an API. Build a connector, plug it in, and the same permission-aware, access-controlled, plain-language doorway works the same way.

AI AgentClaude · GPT · Gemini · Local LLM — any MCP-compatible modelMCP ProtocolAgentic Query Layer (AQL)Plain language instructured data outPermission-awarescoped per userAccess-controlledread, write, or bothModel never touchesdata directlyDataset-agnosticany API plugs inMoodle LMSReference Implementationopen-source · npm · MCP RegistryCRMSalesforce · HubSpotREST APIHR · TicketingBamboo · Jira · ZendeskREST APIAny dataset with an API — build a connector, plug it inThe same pattern. Any dataset. One safe, permission-aware doorway between your AI and your data.
Reference Implementation

Moodle MCP Server — where the pattern starts.

AQL is a pattern, and the pattern only becomes useful when it has a real connector for a real dataset. Our first is Moodle MCP Server — an open-source MCP server that gives the layer permission-aware access to Moodle LMS through its Web Services API. No plugin required on the Moodle side, no direct database access.

Open source core

Install the free core on your own infrastructure and start querying Moodle data right away. It ships with a set of built-in tools:

Course catalogsEnrollmentsAssignmentsCategory navigationSite metadataUser lookupCourse searchUser–course relationships

Agent Edge

The commercial harness built on top of the open core. Turnkey and brandable — call it whatever you like — with an always-growing list of new tools and plugins so it works out of the box, or let us run it for you.

Why this matters

The same layer, built for any dataset.

Moodle is the example because it is everywhere — and because the problem it solves is common. But the pattern is not limited to learning systems. Any organization that holds valuable, structured data behind an API faces the same question: how do we let a model work with this without giving it the keys?

A CRM. A ticketing system. A registry, a ledger, a human resources platform. If the data lives in a system with an API, the Agentic Query Layer (AQL) pattern can sit in front of it — the same permission-aware, access-controlled, plain-language doorway, scoped to a specific dataset.

The result is the same shape no matter what is behind the doorway: staff stop digging through reports and spreadsheets, and start asking the data questions directly — while control stays where it belongs, with the organization that owns the data.

Build it for your data

We build the Agentic Query Layer (AQL) for any dataset.

If your data is stuck inside a system your people have to dig through, we can build the connector that gives it a safe way to answer questions directly. Tell us what you are working with.

Back to notes