Client methods
Python JQL client methods, request options, and transport behavior.
Public methods
client.query(query, *, limit=None, trace_ids=None, session_ids=None) -> JqlQueryResponse
client.present(query, *, limit=None, trace_ids=None, session_ids=None) -> JqlPresentationResponse
client.discover(kind, *, limit=None, trace_ids=None, session_ids=None, **options) -> JqlQueryResponse| Method | Accepted query | Endpoint behavior | Returns |
|---|---|---|---|
query | Source query, pipeline, or discovery query | Executes structured JQL | JqlQueryResponse |
present | A .table(...) or .chart(...) result | Executes the wrapped query and projects a renderer-neutral frame | JqlPresentationResponse |
discover | A documented discovery kind plus kind-specific options | Builds a discovery IR object, then delegates to query | JqlQueryResponse |
Request options: trace and session scope
Use trace_ids or session_ids to narrow a query to one or more traces. The options
are mutually exclusive:
from judgeval.jql import spans
result = client.query(spans().rows(), trace_ids=["trace-123"])Trace and session IDs are outer request options, not part of the canonical JQL JSON
IR. Trace IDs bind directly to a trace-scoped project. Judgment resolves session IDs
within the authenticated organization and project first. Every compiled part of the
query is narrowed to the resulting traces. Both options work with query,
present, and discover.
Each list must contain 1–1,000 non-blank IDs, each at most 512 characters. If no
session resolves to a trace, the request fails with BAD_SCOPE; it never widens to
the whole project. Organization and project remain the tenant-isolation boundary.
Request option: limit
limit is an integer from 1 through 10,000, validated by the public API. When
omitted, the SDK sends 10,000.
- The request-envelope
limitreplaces any limit inside the JQL object — it is not amin(). Because the public API always sends one, an inner.rows(... limit ...)of 100 is widened to 10,000 unless you also set the method-levellimit. - Set the method-level
limitwhenever you want a smaller result. - The envelope limit is ignored for terminals that do not produce a limitable
result, such as
countandagg. client.discoverforwards itslimitonly as the request cap. To set the IR-level discoverylimit, build the discovery object directly and pass it toclient.query.- An out-of-range
limitis rejected as a400with errorValidation failed, notBAD_QUERY.
Transport
The SDK sends:
{
"query": { "op": "query", "source": "traces", "select": { "op": "ids" } },
"limit": 100,
"trace_ids": ["trace-123"]
}to the project-scoped query endpoint. present uses a separate
/query/presentation endpoint; discover shares the query endpoint. The SDK
supplies Authorization: Bearer <api key>, the X-Organization-Id header, and
the resolved project ID as a path parameter. The public response never
includes compiled SQL — it is stripped at the API boundary.
Use Responses and errors for the exact success and failure shapes.