canonry

Search answer services

A search answer service is a hosted service that searches the web and returns a grounded answer with sources (for example an answer endpoint from a search company). Canonry treats every such service through one shared layer in packages/provider-answer-services/. A vendor is a thin adapter: a descriptor, a request builder, a response parser, documentation-derived test fixtures and its own docs page. This page describes the shared behavior every vendor inherits; each registered vendor’s page covers only what is specific to it.

Registered services

The registered services come from ANSWER_SERVICES in packages/provider-answer-services/src/services/index.ts, and every surface reads them from there: cnry settings (and GET /api/v1/settings, the canonry_settings_get MCP tool and the dashboard) lists each service with its key variable, its profile routes and the workflows each profile allows. Each service’s own page lives in answer-services/ and is linked from its descriptor (docsPath); this page never lists them, so adding a service does not edit it.

Connections and profiles

Each service is one connection with one API key, stored in ~/.canonry/config.yaml under providers.<service>.apiKey. The connection alone runs nothing. Projects, runs and research pick a profile route, <service>:<profile>, for example <service>:standard. A profile freezes the request knobs the vendor offers (a tier, an effort or a search depth) and is part of the stored identity, so two profiles never share history.

cnry settings provider <service> --api-key <key>
cnry settings                       # lists each service's profiles and the workflows they allow
cnry project update my-site --provider gemini --provider <service>:<profile>
cnry research run my-site --provider <service>:<profile> --query "best roofer in springfield"

The endpoint is fixed by the descriptor: a base URL or a connection model is refused, so a key can never be sent elsewhere. A key is checked with a metadata request when the vendor documents a free one; otherwise it is saved and marked “not verified” until the first real request.

Never selected implicitly

Connecting a service never changes what existing projects measure:

Each profile lists the workflows it may run (research, snapshot, visibility-sweep). A profile can join visibility sweeps only when its sources are tied to the answer (cited in the text or documented as used for the answer) and it answers synchronously. Job-based products (deep research that runs in the background) are declared but not run in this release; a pending upstream job is never stored as an answer.

Evidence

Every answer stores vendor-neutral evidence alongside the usual columns (evidence on research queries, run snapshots and prospect snapshot results):

Field Meaning
sources[].relationship explicit-citation (referenced from the answer), answer-support (documented as used for the answer), search-result (returned by a search, not tied to the answer), page-read (a page the service opened)
completion.status complete, partial, failed or pending, with the upstream finish reason, request id and job id
identity service, product, profile, frozen settings, the requested service model, and the disclosed model with its kind (foundation-model, service-tier, unknown)
usage token, search and page-read counts with their basis (reported, approximate, derived-from-evidence, unknown) and cost with its basis (reported, estimated, unknown)
location what was requested, what was sent, and whether it was applied, partial or ignored
retrievalStatus, citationBasis, citationMeasurable, rawTruncated see below

Rules the shared layer enforces for every vendor:

Requests, retries and limits

The shared HTTP layer uses the descriptor’s authentication and the profile’s deadline. It rejects responses over 8 MiB. For an accepted response over 1 MiB, Canonry stores a marker in place of the raw payload and sets rawTruncated.

Profiles on the same connection share its execution gate and daily quota. Canonry retries only the HTTP statuses in the vendor descriptor and honors Retry-After. It stops retrying once the response body starts or the connection drops. A stream that ends before the vendor’s final event is partial.

Adding a vendor

  1. Create packages/provider-answer-services/src/services/<vendor>/ with descriptor.ts (an AnswerServiceDescriptor), request.ts (a pure buildRequest that returns the request and the location it actually carries) and parse.ts (a pure parseResponse, or parseEvents plus isTerminalEvent for streams), exported as one AnswerServiceDefinition.
  2. Add it to ANSWER_SERVICES in src/services/index.ts.
  3. Add documentation-derived fixtures under test/services/<vendor>/ and one entry in test/services/index.ts. Each fixture follows the vendor’s documented response shape exactly, including fields the parser ignores, and says which documentation page it comes from. Cover every case in the shared matrix or declare it not applicable with the documented reason.
  4. Write docs/providers/answer-services/<vendor>.md and point the descriptor’s docsPath at it.

Nothing else changes: settings, routes, eligibility, the dashboard pickers, the CLI and MCP, this page and the agent skill reference all read the descriptor or point at it. The shared conformance test runs the descriptor rules and the case matrix over every registered vendor and over a test-only fake service.