SSyncropel Docs

infer.query.v1 Schema

Canonical field reference for the infer.query.v1 body shape — mirrors the JSON Schema shipped in @syncropel/config@0.3.x.

Overview

This page is the canonical field-level reference for the infer.query.v1 body shape. It mirrors the JSON Schema published in @syncropel/config@0.3.0 at src/schemas/infer-query.schema.json.

  • Schema id: https://syncropel.com/schemas/config/infer-query.v1.schema.json
  • JSON Schema draft: 2020-12
  • TypeScript types: import { InferQueryV1 } from "@syncropel/config"
  • Validator: import { validateInferQuery } from "@syncropel/config"

For the conceptual walkthrough with worked examples, see the Query Anatomy guide.

Top level

{
  "kind": "infer.query.v1",
  "input": { "inline": "..." },
  "answer_shape": { "kind": "core.text.v1" },
  "responders": [{ "kind": "llm", "model": "~sonnet" }],
  "fold": { "function": "consensus" },
  "dial": 0.5,
  "orchestration": { "pattern": "single_shot" },
  "side_effects": { "reversible": true, "max_cost_usd": 0.40 },
  "relevance": { "model": "current", "threshold": 0.5, "top_k": 3 },
  "metadata": { "trace_id": "trace_abc123" }
}
FieldTypeRequiredDefault
kindconst "infer.query.v1"yes
inputInput — oneOf three shapesyes
answer_shapeAnswerShapeyes
respondersResponderPredicate[] (minItems 1)yes
foldFoldyes
dialnumber OR AdaptiveDialno0.5
orchestrationOrchestrationno{ pattern: "single_shot" }
side_effectsSideEffectsnonamespace defaults
relevanceRelevanceno{ model: "current", threshold: 0.5, top_k: 3 }
metadatamap of string to stringno{}

Input

Exactly one of:

{ "inline": <any JSON>, "inline_kind": "core.text.v1" }
{ "record_id": "3fa8...e2c1" }
{ "ref": { "kind": "@music.track", "id": "spotify:track:4iV5W9uYEdYUVa79Axb7Rh" } }
FieldTypeNotes
inlineanyPayload hashed into the query record id
inline_kindstringOptional body.kind
record_idstring64-char hex SHA-256 record id
refobjectCanonical ref per the 11 Ref.* constructors

AnswerShape

Validates the folded output (not per-response bodies).

{
  "kind": "core.translation.v1",
  "required_fields": ["body.text", "body.target_language"],
  "schema_ref": "https://example.com/translation.schema.json"
}
FieldTypeRequired
kindstring (body.kind)yes
required_fieldsstring[] (dot-paths)no
schema_refstring (URI)no

ResponderPredicate

An OR-of-classes predicate. Each entry adds AND constraints within its class.

{
  "kind": "llm",
  "model": "~sonnet",
  "did": "did:sync:agent:translate-bot",
  "domain": "translation",
  "capability": "en-es",
  "trust_gte": 0.6,
  "trust_lt": 0.99,
  "budget_usd": 0.05,
  "latency_secs": 30,
  "match_level_gte": "L2",
  "age_days_lt": 7,
  "available": true,
  "expression": "candidate.last_seen_at > now() - 86400"
}
FieldTypeNotes
kindenumactor | llm | pattern | system | any
modelstringLLM model selector (e.g., ~sonnet, sonnet-4-6)
didstring (DID)Specific responder DID
domainstringCapability domain
capabilitystringCapability tag
trust_gtenumberMinimum trust score
trust_ltnumberMaximum trust score
budget_usdnumberPer-call cost ceiling
latency_secsintegerPer-call latency ceiling
match_level_gteenumL0 | L1 | L2 | L3
age_days_ltintegerRecord age bound
availablebooleanAvailability requirement
expressionstring (CEL)Arbitrary predicate over candidate metadata

Fold

{
  "function": "consensus",
  "weight_expression": "response.trust * response.recency",
  "tie_break": "highest_trust",
  "min_quorum": 2,
  "expression": "..."
}
FieldTypeDefaultNotes
functionenum— (required)consensus | best_of | waterfall_first | ensemble_weighted | expression
weight_expressionCEL string"trust * recency * pattern_confidence"Applies to consensus and ensemble_weighted
tie_breakenum"highest_trust"highest_trust | highest_confidence | most_recent | lexicographic
min_quoruminteger ≥ 11Minimum non-error responses before fold runs
expressionCEL stringRequired when function == "expression"

Orchestration

{
  "pattern": "verify",
  "primary": [{ "kind": "llm", "model": "~sonnet" }],
  "verifier": { "kind": "llm", "model": "~gpt-4" },
  "tiebreaker": { "kind": "actor", "did": "did:example:alice" },
  "agreement_threshold": 0.85
}
FieldTypeNotes
patternenumsingle_shot | verify | waterfall | retry_on_low_confidence | escalate | ensemble_with_audit

Per-pattern fields:

verify

FieldType
primaryResponderPredicate[]
verifierResponderPredicate
tiebreakerResponderPredicate
agreement_thresholdnumber or CEL

waterfall

FieldType
stages[]{ responders: ResponderPredicate[] }
accept_expressionCEL string

retry_on_low_confidence

FieldType
threshold_expressionCEL string
max_attemptsinteger
retry_dialnumber 0..1

escalate

FieldType
tiers[]{ responders: ResponderPredicate[] }
escalation_expressionCEL string

ensemble_with_audit

FieldType
primary_respondersResponderPredicate[]
auditorResponderPredicate
audit_expressionCEL string

SideEffects

{
  "reversible": true,
  "idempotent": true,
  "max_cost_usd": 0.40,
  "max_latency_secs": 1800,
  "obligation_resolution": "last_writer_wins"
}
FieldTypeDefault
reversiblebooleantrue
idempotentbooleantrue
max_cost_usdnumbernamespace cap
max_latency_secsinteger300
obligation_resolutionenumlast_writer_wins — also fulfills_wins, validation_error

Relevance

{
  "model": "current",
  "threshold": 0.5,
  "top_k": 3
}
FieldTypeDefault
modelstring"current" — also "heuristic" to force the additive-with-floor scorer
thresholdnumber 0..10.5
top_kinteger3

Dial

Scalar form:

{ "dial": 0.3 }

AdaptiveDial form:

{
  "dial": {
    "replay_if": "pattern_match >= 'L1' && trust >= 0.92",
    "create_if": "pattern_match == null",
    "else": 0.4
  }
}
FieldType
replay_ifCEL string — if matches, dial = 0.1
create_ifCEL string — if matches, dial = 0.9
elsenumber 0..1

Metadata

{ "metadata": { "trace_id": "trace_abc123", "customer_id": "cust_42" } }

Opaque string-to-string map. Carried through into the KNOW record unchanged.

Shipped in @syncropel/config@0.3.0 alongside infer-query.schema.json:

  • infer.call.v1 — CALL record emitted per dispatched responder (executor step 4).
  • infer.error.v1 — KNOW with an error code instead of an answer. 10 canonical codes: invalid_query, no_candidates, no_relevant_candidates, cost_budget_exceeded, latency_timeout, responder_unavailable, quorum_not_met, fold_failed, answer_shape_mismatch, obligation_conflict.

See also

On this page