Trace JSON Schema
Stratix Trace JSON Schema — formal specification of the trace payload.
Last updated
Was this helpful?
Stratix Trace JSON Schema — formal specification of the trace payload.
The trace payload Stratix accepts on POST /api/v1/traces (and via the SDK and CLI) is formally specified by a JSON Schema document.
assets/schemas/trace.schema.json — JSON Schema draft 2020-12.
id
string
Stable identifier (UUID recommended)
name
string
Human-readable name
Everything else (inputs, outputs, spans, tags, started_at, duration_ms, etc.) is optional but strongly recommended.
llm, tool, retrieval, chain, other. Spans are recursive — a chain span can contain other spans.
Any JSON Schema validator works. Examples:
Download trace.schema.json (linked above) and load it locally:
Python (jsonschema):
import json, jsonschema
with open("trace.schema.json") as f:
schema = json.load(f)
jsonschema.validate(instance=my_trace, schema=schema)Node (ajv):
Breaking schema changes ship as a new version of trace.schema.json in the documentation. Stratix accepts traces validating against any current-or-prior schema version for one major release.
Last updated
Was this helpful?
Was this helpful?
import Ajv from "ajv";
import schema from "./trace.schema.json" assert { type: "json" };
const ajv = new Ajv();
const validate = ajv.compile(schema);
if (!validate(myTrace)) console.error(validate.errors);