Traigent Schema Library - Data contracts and validation for the Traigent AI optimization platform
Project description
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.
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
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.1.0
Package metadata is derived from traigent_schema/version.py to keep runtime and published versions aligned.
License
Open-source releases of this repository are licensed under the GNU Affero General Public License v3.0 only. See LICENSE and NOTICE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file traigent_schema-4.1.0.tar.gz.
File metadata
- Download URL: traigent_schema-4.1.0.tar.gz
- Upload date:
- Size: 79.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92858563946f0ba9cd1d20dc98fdb27a909456c876562f3b6b69274f0e835bf1
|
|
| MD5 |
d15b8b00503169147805bb56f36ff13b
|
|
| BLAKE2b-256 |
4746b8bd89f889bfd6c35e1743e8a514432384129d48f50c1d00fc3ed88fe97d
|
Provenance
The following attestation bundles were made for traigent_schema-4.1.0.tar.gz:
Publisher:
publish.yml on Traigent/TraigentSchema
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
traigent_schema-4.1.0.tar.gz -
Subject digest:
92858563946f0ba9cd1d20dc98fdb27a909456c876562f3b6b69274f0e835bf1 - Sigstore transparency entry: 1469225195
- Sigstore integration time:
-
Permalink:
Traigent/TraigentSchema@0af2a11e0485513465dd0a4f88d62ef27a7e6336 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Traigent
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0af2a11e0485513465dd0a4f88d62ef27a7e6336 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file traigent_schema-4.1.0-py3-none-any.whl.
File metadata
- Download URL: traigent_schema-4.1.0-py3-none-any.whl
- Upload date:
- Size: 153.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97558518f694091c8ea3702424aa8ab959041e348b2b7fcf444a9d66f89537a5
|
|
| MD5 |
6324e0b496ecbf660b596d4d6b0d7499
|
|
| BLAKE2b-256 |
ffa1362b658c3a8de9cfcb5303e513edfbd7e425a5468d6bef654be456236e62
|
Provenance
The following attestation bundles were made for traigent_schema-4.1.0-py3-none-any.whl:
Publisher:
publish.yml on Traigent/TraigentSchema
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
traigent_schema-4.1.0-py3-none-any.whl -
Subject digest:
97558518f694091c8ea3702424aa8ab959041e348b2b7fcf444a9d66f89537a5 - Sigstore transparency entry: 1469225279
- Sigstore integration time:
-
Permalink:
Traigent/TraigentSchema@0af2a11e0485513465dd0a4f88d62ef27a7e6336 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Traigent
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0af2a11e0485513465dd0a4f88d62ef27a7e6336 -
Trigger Event:
workflow_dispatch
-
Statement type: