Docs Navigation

JSON Schema

Normative JSON Schema for ABS v0.1 document validation.

Every ABS version has a normative JSON Schema. Implementations use it to validate documents before parsing. The full schema is 314 lines and covers all v0.1 constructs: sessions, behaviors, fragments, includes, evaluations, selectors, and dataset declarations.

Schema locations

https://github.com/fvinciarelli/abslang/blob/main/schema/abs.schema.json   (source of truth)

The schema's $id is https://github.com/fvinciarelli/abslang/blob/main/schema/abs.schema.json. A versioned URI pattern (abs-lang.org/schema/v0.1/abs.schema.json) is planned for v0.2+.

Top-level structure

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://github.com/fvinciarelli/abslang/blob/main/schema/abs.schema.json",
  "type": "object",
  "required": ["session", "behaviors"],
  "properties": {
    "session": { "type": "string" },
    "description": { "type": "string" },
    "abs_version": { "type": "string", "pattern": "^0\\.1$" },
    "dataset": {
      "type": "object",
      "required": ["id", "path"],
      "properties": {
        "id": { "type": "string" },
        "path": { "type": "string" }
      }
    },
    "behaviors": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/definitions/behaviorOrInclude" }
    },
    "fragments": {
      "type": "object",
      "additionalProperties": { "$ref": "#/definitions/behaviorList" }
    },
    "evaluations": {
      "type": "array",
      "items": { "$ref": "#/definitions/evaluation" }
    }
  },
  "additionalProperties": false
}

Behavior

{
  "behavior": {
    "type": "object",
    "required": ["actor", "action"],
    "properties": {
      "id": { "type": "string" },
      "actor": { "type": "string" },
      "action": { "type": "string" },
      "target": { "type": "string" },
      "content": {},
      "capture": { "type": "object", "minProperties": 1 },
      "with": { "type": "object", "minProperties": 1 },
      "with_only": { "type": "object", "minProperties": 1 },
      "evaluations": {
        "type": "array",
        "items": { "$ref": "#/definitions/evaluation" }
      }
    },
    "additionalProperties": false,
    "allOf": [
      { "not": { "required": ["with", "with_only"] } }
    ]
  }
}

Key constraint: with and with_only are mutually exclusive — a Behavior cannot declare both.

Fragment includes

{
  "include": {
    "type": "object",
    "required": ["include"],
    "properties": {
      "include": { "type": "string" }
    },
    "additionalProperties": false
  },
  "behaviorOrInclude": {
    "oneOf": [
      { "$ref": "#/definitions/behavior" },
      { "$ref": "#/definitions/include" }
    ]
  }
}

Evaluations

The schema defines 22 evaluator types and their parameters:

  • Step-level: exact_match, contains, regex, schema, tool_call, llm_judge, custom, Groundedness, Relevance, Coherence, Fluency
  • Chain: sequence, eventually, never, count, within, variable_consistency
  • Composition: all_of, any_of, none_of

Common fields: blocking (boolean), threshold (0–1), adapter (string), dataset, prompt.

Chain evaluator fields: match (selector), order (array of selectors), variable (string), min/max (integers), after (selector), max_steps (integer).

Selector

{
  "selector": {
    "type": "object",
    "properties": {
      "actor": { "type": "string" },
      "action": { "type": "string" },
      "target": { "type": "string" }
    },
    "minProperties": 1,
    "additionalProperties": false
  }
}

A field that's present must match exactly; a field omitted is a wildcard.

Using the schema

In your ABS document (VSCode / YAML LSP)

# yaml-language-server: $schema=https://raw.githubusercontent.com/fvinciarelli/abslang/main/schema/abs.schema.json
session: My session
behaviors:
  - actor: user
    action: says
    content: "Hello"

Programmatic validation

The TypeScript and Python CLI both validate against the schema in the parse pipeline using Ajv and a Python equivalent. The schema is functionally normative: a document that passes is syntactically valid ABS v0.1. Semantic rules (variable resolution, ordering, target interpretation) are defined in the Specification and are not enforced by the schema.

See also