Agent Query Language
The canonical query surface of the Open Agent Protocol. Agents express what they want as a signed Intent with constraints, a projection, a budget, and a quality floor. Resolvers evaluate the Intent against their indexed Manifests and return ranked candidates with per candidate Decision Records.
Try it
The playground runs the reference evaluator and projection in your browser. No server roundtrip, no signature, no policy stack. For the full reference implementation see reference/aql in the spec repository.
Intent shape
An Intent is a JSON document conforming to oap-intent.schema.json. The required blocks are listed below. The full normative description lives in RFC 0020.
- intent_idURN minted by the issuer.
- issuer_didDecentralized identifier of the signing Principal.
- categorycommercial, knowledge, action, delegation, discovery, subscription.
- constraintsConstraint tree built from leaves and the boolean combinators all_of, any_of, not.
- projectionInclude and exclude pointer sets that bound what data crosses the boundary.
- budgetCost ceiling, currency, and allocation policy across candidates.
- quality_floorMinimum acceptable performance, conformance, latency, reputation.
- validityWindow during which the Intent is open for response.
- resolution_policysingle_best, ranked_set, or full_set.
- signatureEdDSA, ES256, or ES384 signature over the canonicalized body.
Operator set
The closed operator set defined by RFC 0020 section 3.2. Operators outside this set are introduced through additive minor versions of the RFC.
Categories
Six normative Intent categories. Additional categories are introduced through additive minor versions of the RFC.
- commercialProcurement Intent of RFC 0013, generalized with the AQL constraint, projection, budget, and quality semantics.
- knowledgeRequest for Knowledge Nodes that satisfy the constraints, with metering and Citation Attribution.
- actionInvocation of an Action class on any conformant Provider, gated by the four layer Policy Stack.
- delegationDelegation of a sub task under the cost attribution model of RFC 0004.
- discoveryEnumeration of Providers whose Manifests satisfy the constraints.
- subscriptionSubscription to a feed of Manifest changes that satisfy the constraints, with backpressure.
Reference implementation
The reference implementation is open source under Apache 2.0 and published in the spec repository at reference/aql. It includes a parser, an evaluator, a projection engine, a resolution helper, a CLI tool, and a unit test suite covering the full operator set. Implementers MAY vendor or fork the package without restriction.
# Install and run
git clone https://github.com/openagentprotocol-OAP/oap-spec
cd oap-spec/reference/aql && npm install
node bin/oap-aql.js validate ../../examples/aql/discovery-intent.json
node bin/oap-aql.js resolve ../../examples/aql/discovery-intent.json \
../../examples/aql/candidates.jsonSee also
- RFC 0020 Agent Query Language, normative specification.
- RFC 0021 Verifiable Indexes, Match Broker conformance and Inclusion Proofs.
- RFC 0022 Manifest Subscription Protocol, push delivery for AQL subscription Intents.
- RFC 0023 Agent Native Storage Substrate, the data layer queried through AQL.
- Databases for the Agent Economy, the database surface AQL targets.
- From Storefront to Manifest, what the commercial web becomes when buyers are agents.