Traigent Schema Library
The official contract package for the Traigent AI optimization platform. This repository is the shared source of truth for JSON Schema definitions, endpoint mappings, and validation utilities used across the backend, SDK, and frontend.
Before you push: run
make install-hooksonce per clone, thenmake local-gatebefore every push. The local gate mirrors the cloud CI gates (ruff check,mypy, thepytest/parity structural gates, the spine-trail reminder, and — for main-bound branches — SonarQube) so avoidable reds are caught in seconds instead of after a push. See docs/LOCAL_CI_GATE.md.
Installation
For published package consumers:
pip install traigent-schema
For coordinated workspace development or release validation from GitHub (requires repository access):
pip install git+https://github.com/Traigent/TraigentSchema.git
For development:
pip install -e ".[dev]"
Quick Start
from traigent_schema import SchemaValidator, load_schema
# Validate current backend requests
backend_validator = SchemaValidator()
errors = backend_validator.validate_request('/api/v1/agents', 'POST', request_data)
# Validate SDK direct-tuning requests
tuning_validator = SchemaValidator(contract="sdk_tuning")
errors = tuning_validator.validate_request('/api/v1/sessions', 'POST', session_request)
# Validate planned project-scoped beta routes
planned_validator = SchemaValidator(contract="planned_projects")
errors = planned_validator.validate_request(
'/api/v1beta/projects/proj_123/analytics/summary',
'GET',
{},
)
if errors:
print(f"Validation errors: {errors}")
else:
print("Request is valid!")
# Load a specific schema
agent_schema = load_schema('agent_schema')
Available Schemas
The library includes schemas organized by domain:
Agents (schemas/agents/)
agent_schema.json- Core agent configurationagent_types_schema.json- Agent type definitionsagent_deployment_schema.json- Deployment configurationsagent_response_schema.json- Response format specsmodel_schema.json- Model definitionsmodel_parameters_schema.json- Model parameter specsretriever_schema.json- Retrieval configurations
Datasets (schemas/datasets/)
dataset_schema.json- Canonical public dataset resourceevaluation_set_schema.json- Legacy-compatible evaluation dataset schemaexample_set_schema.json- Example set definitionsgenerator_config_schema.json- Data generator configsevaluator_config_schema.json- Evaluator configurations
Evaluation (schemas/evaluation/)
experiment_schema.json- Experiment definitionsexperiment_run_schema.json- Experiment run recordsconfiguration_run_schema.json- Configuration run dataevaluation_schema.json- Evaluation specificationsevaluation_request_schema.json- Evaluation requestsevaluation_results_schema.json- Evaluation results
Execution (schemas/execution/)
execution_mode_schema.json- Execution mode settingshybrid_session_schema.json- Hybrid session configssaas_execution_schema.json- SaaS execution specsdataset_storage_schema.json- Dataset storage configsmetric_submission_schema.json- Metric submission format
Measures (schemas/measures/)
measure_schema.json- Measure definitionsscore_schema.json- Score specifications
Results (schemas/results/)
report_schema.json- Report definitionsreport_request_schema.json- Report request formatcomparison_schema.json- Comparison specsvisualization_schema.json- Visualization configsvisualization_request_schema.json- Visualization requests
API Reference
Contract Catalogs
traigent-schema now ships three endpoint catalogs:
backend: currentTraigentBackendtruth, loaded by default throughSchemaValidator()sdk_tuning: direct-tuning session and hybrid routes used by SDK clientsplanned_projects: planned and beta project-scoped/api/v1beta/projects/...routes
Use get_openapi_path() when you want the canonical backend contract root, or
get_contract_path(...) when you need one of the non-default catalogs.
Contract Stability
The backend and sdk_tuning catalogs are the supported contract roots for
released Traigent surfaces. The planned_projects catalog documents planned
and beta project-scoped routes for coordinated development. It is not a stable
public API contract, may change without a major-version bump, and may break
between minor releases until those routes graduate. Pin a specific
traigent-schema version if you build directly against this pre-release
surface.
Schema Governance
TraigentSchema is the canonical source of truth for Traigent data contracts across the Python SDK, backend, frontend, and JavaScript SDK parity checks. When changing schemas, update the JSON Schema first, then update downstream DTOs, backend models, generated frontend types, tests, and the changelog as needed.
The shared MeasuresDict contract is enforced across projects:
- max 50 keys
- keys match the Python identifier pattern
^[a-zA-Z_][a-zA-Z0-9_]*$ - values are numeric or null
Field-level privacy classification (x-privacy-classification)
Schemas may tag fields (or object groupings) with a machine-readable privacy class so redaction, retention, and export tooling can reason by contract instead of hard-coding field names. Allowed values:
| Value | Meaning |
|---|---|
user_content |
Raw user-supplied content / model output (prompts, inputs, outputs). The hybrid-path content fields use this — paired with x-content: true so a consumer can enumerate content-bearing leaves directly from the contract. |
aggregate_safe |
Aggregated / derived values safe to surface broadly. |
auth_sensitive |
Authentication and authorization payloads such as device-flow tokens, API keys, and SSO auth responses. |
billing_sensitive |
Billing / pricing data (e.g. wallet, checkout). |
tenant_admin_safe |
Visible to tenant admins only. |
manifest_safe |
Safe to include in exported manifests. |
Content-bearing fields on the hybrid DTOs carry x-content: true +
x-privacy-classification: user_content: trace/observation
input_data/output_data, Example.input/output,
EvaluationSetExample.input_text/expected_output, and the metric-submission
ConfigurationParameters. Adding these x- keywords is additive and ignored by
standard JSON-Schema validators.
Canonical x-* extension list and descriptions:
traigent_schema/schemas/x_extensions_meta_schema.json.
SchemaValidator
from traigent_schema import SchemaValidator
validator = SchemaValidator()
sdk_validator = SchemaValidator(contract="sdk_tuning")
planned_validator = SchemaValidator(contract="planned_projects")
# Validate by endpoint
errors = validator.validate_request(endpoint, method, data)
# Validate by schema name
errors = validator.validate_json(data, 'agent_schema')
# List available schemas
print(validator.available_schemas)
Utility Functions
from traigent_schema import (
get_schemas_dir, # Get path to schemas directory
get_schema_path, # Get path to specific schema
get_all_schema_files, # List all schema files
get_openapi_path, # Get path to canonical backend contract root
get_contract_path, # Get path to backend/sdk_tuning/planned_projects root
load_schema, # Load and parse a schema
)
Development
# Install with dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run linting
ruff check .
# Type checking
mypy traigent_schema
Version
Current release line: 4.8.0 (from traigent_schema/version.py; release notes in CHANGELOG.md).
Package metadata is derived from traigent_schema/version.py to keep runtime and published versions aligned.
License
traigent-schema is dual-licensed: AGPL-3.0-only (see LICENSE) OR a
Traigent commercial license for use without AGPL copyleft (see
COMMERCIAL-LICENSE.md).
SPDX: AGPL-3.0-only OR LicenseRef-Traigent-Commercial.
Use it free under AGPL-3.0, or contact legal@traigent.ai for a commercial license. See LICENSING.md for a short FAQ, NOTICE for third-party attributions, and CONTRIBUTING.md (contributions require a CLA).
Metadata
Release files for traigent-schema 4.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| traigent_schema-4.8.0.tar.gz | 221.7 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| traigent_schema-4.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 642.1 kB
Release files / traigent_schema-4.8.0.tar.gz
| Download URL | traigent_schema-4.8.0.tar.gz |
|---|---|
| Size | 221.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12c8950c54f03baa9467c99db2d07ea7509772f5ac88f44a158837f588b6d8ea
|
|
BLAKE2b-256 checksum How to use checksums |
29794bccd5dfdd726c16d873050ef1c9f9482ffdd248ea10ebf0cd2e95383032
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 12, 2026.
Transparency logRelease files / traigent_schema-4.8.0-py3-none-any.whl
| Download URL | traigent_schema-4.8.0-py3-none-any.whl |
|---|---|
| Size | 420.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
60fa0df0e927edcef0686bb064e3eb266b4a9b78d49232ba7296f01395b3e83d
|
|
BLAKE2b-256 checksum How to use checksums |
5ad715c237c6185cd4c07a6a199d075a0dcb69b9b49b6f468e605d547af79bbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 12, 2026.
Transparency logSecurity for traigent-schema 4.8.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for traigent_schema-4.8.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 12, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.