Skip to main content
You usually don’t write DQL by hand anymore. The Docent plugin produces DQL steps inside an Analysis Plan; this page is the language reference if you want to inspect or edit what your coding agent generated.
Docent Query Language (DQL) is a read-only SQL subset for ad-hoc queries over a Docent collection. Queries can only run over a single collection by design (if you need multi-collection support, please reach out to us!) Your coding agent (using the Docent plugin) is the easiest way to get DQL written for your collection. To write DQL by hand, see the DQL schema reference for the column schema of each table and the execute_dql reference for Python SDK methods, operators, and common patterns. For filtering agent runs (select_agent_run_ids), see Query Agent Runs.

When to use DQL

DQL is great for structured queries like getting the average reward by model, or identifying tasks where one model regressed compared to another. Ask the agent:

A few illustrative queries

A simple SELECT

Aggregating with CTEs

Per-environment success rates, normalized via a CTE.

Joining runs with judge results

Pulls the most recent rubric result per run, then joins to surface the model responsible for each score.

What DQL does and doesn’t do

  • Read-only. Only SELECT-style queries are permitted.
  • Single statement. Batches and multiple statements are rejected.
  • Explicit projection. Wildcard * is disallowed; list columns explicitly so downstream tooling stays predictable.
  • Single-collection scope. A query runs against one collection at a time.
  • 10,000 row cap. Every query is capped by the server. Use LIMIT/OFFSET for pagination, or export offline for larger sets.
  • JSON performance. Metadata is stored as JSON; heavy traversal across large collections is slower than filtering on indexed scalar columns.
  • Type awareness. JSON paths expose a generic json type. Cast explicitly (e.g., CAST(metadata_json->>'duration_ms' AS BIGINT)) when precision matters.

Writing DQL by hand

See the full schema reference for the column schema of each table.