AISchemaGate and DataContractGate
v0.4.3AISchemaGate validates and repairs structured LLM output against a contract, plus DataContractGate.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
infer_contract Infer a contract from sample events
Generate draft DataContractGate YAML from real JSON sample events via POST /contracts/infer. Does not persist. Review and write the YAML to contracts/<name>.yaml before deploying.
| Parameter | Type | Description |
|---|---|---|
name * | string | Contract name, snake_case, e.g. user_events |
samples * | array | 1–20 real event objects. Do not invent them. |
description | string | Optional contract description |
validate_events Validate events against a contract
Validate events. Pass contract_id to hit POST /v1/ingest/{id} (dry_run defaults true — no audit, quarantine, or usage). Pass yaml_content to hit POST /playground/validate per event (never persists). Exactly one of contract_id or yaml_content. 207/422 responses are returned as data so you can apply each violation's suggestion.
| Parameter | Type | Description |
|---|---|---|
events * | array | Event objects to validate |
contract_id | string | Deployed contract UUID from deploy_contract |
dry_run | boolean | Ingest only. Default true. Set false only after a successful dry run. |
on_fail | string | Ingest only. Default quarantine. drop counts a failure and stores neither a quarantine row nor an audit row. |
yaml_content | string | In-flight contract YAML; uses the playground, never persists |
deploy_contract Deploy a contract to stable
POST /contracts/deploy — find-or-create by name, insert YAML as stable, deprecate prior stable. 409 if that (name, version) exists: bump version in the YAML. Refused while quarantine is pending. Save the returned contract_id.
| Parameter | Type | Description |
|---|---|---|
name * | string | Contract name matching the YAML name: field |
yaml_content * | string | Full contract YAML |
deployed_by | string | Actor recorded on the version row |
source | string | Logical feed name, e.g. app-backend |
get_quarantine List quarantined events
GET /quarantine — rejected events for the caller's org, newest first, with violation details.
| Parameter | Type | Description |
|---|---|---|
contract_id | string | Restrict to one contract |
limit | integer | Default 100, max 500 |
offset | integer |
list_contracts List contracts
GET /contracts — identities the API key can see.
egress_validate Validate an outbound payload
AISchemaGate structured-output check. POST /egress/{contract_id}. dry_run defaults true — no audit row or quarantine. Returns 200/207/422 so you can read min, max, pattern, enum, and compliance_mode violations and run a bounded auto-repair. Forward response.payload only — never the original body after a block or fail.
| Parameter | Type | Description |
|---|---|---|
contract_id * | string | Deployed contract UUID |
events * | array | Outbound payload objects to validate |
disposition | string | Default block. block = drop failing records from payload; fail = reject entire batch; tag = pass through with flags. |
dry_run | boolean | Default true. Set false only after a successful dry run — live calls write audit and quarantine rows unless on_fail is drop. |
on_fail | string | Default quarantine. drop counts a failure and stores neither a quarantine row nor an audit row. Ignored when the contract locks on_fail. |
version | string | Pin a specific contract version. Default: latest stable. |
get_drop_counts List dropped-record counts
GET /contracts/{id}/drop-counts. Minute buckets of dropped failures by reason, kept 30 days. Counts and failure metadata only — never record contents.
| Parameter | Type | Description |
|---|---|---|
contract_id * | string | Deployed contract UUID |
hours | integer | Lookback in hours. Default 24. |