Official Python validator for the JSON Agents (Portable Agent Manifest) specification.
- ✅ JSON Schema Validation — Validates manifests against the official JSON Agents schema
- 🔗 URI Validation — Ensures
ajson://URIs conform to RFC 3986 - 📜 Policy Expression Parsing — Validates policy
whereclauses - 🎨 Rich Error Messages — Clear, actionable validation feedback
- 🛠️ CLI & Python API — Use from command line or in your code
- 📦 Zero Config — Works out of the box
pip install jsonagentsFor development:
pip install jsonagents[dev]Validate a manifest file:
jsonagents validate manifest.jsonValidate with verbose output:
jsonagents validate manifest.json --verboseValidate multiple files:
jsonagents validate examples/*.jsonfrom jsonagents import validate_manifest
# Validate a manifest
result = validate_manifest("manifest.json")
if result.is_valid:
print("✅ Manifest is valid!")
else:
print("❌ Validation errors:")
for error in result.errors:
print(f" - {error}")Advanced usage:
from jsonagents import Validator
# Create validator instance
validator = Validator()
# Validate from dict
manifest = {
"manifest_version": "1.0",
"agent": {
"id": "ajson://example.com/agents/hello",
"name": "Hello Agent"
}
}
result = validator.validate(manifest)
print(f"Valid: {result.is_valid}")
print(f"Errors: {result.errors}")
print(f"Warnings: {result.warnings}")Validates against the official JSON Agents schema:
- Required fields (manifest_version, profiles, etc.)
- Profile-specific requirements (core, exec, gov, graph)
- Data types and constraints
- Extension namespaces
Checks ajson:// URIs for:
- RFC 3986 syntax compliance
- Valid authority (domain/host)
- Proper path structure
- Fragment identifiers
Parses and validates policy where clauses:
- Grammar compliance (Appendix B)
- Operator usage (==, !=, ~, in, etc.)
- Variable references (tool., message., etc.)
- Logical expressions (&&, ||, not)
# Basic validation
jsonagents validate manifest.json
# Verbose output
jsonagents validate manifest.json -v
# Validate directory
jsonagents validate examples/
# Output as JSON
jsonagents validate manifest.json --json
# Strict mode (warnings as errors)
jsonagents validate manifest.json --strict
# Check specific profile
jsonagents validate manifest.json --profile exec{
"manifest_version": "1.0",
"agent": {
"id": "ajson://example.com/agents/hello",
"name": "Hello Agent",
"version": "1.0.0"
}
}Missing required field:
❌ ValidationError: Missing required field 'manifest_version'
→ Add "manifest_version": "1.0" at the top level
Invalid URI:
❌ URIError: Invalid ajson:// URI syntax
→ Expected: ajson://authority/path
→ Got: ajson:example.com/agent
Invalid policy expression:
❌ PolicyError: Invalid operator in where clause
→ Line 1: tool.type === 'http'
→ Use '==' instead of '==='
git clone https://github.com/JSON-AGENTS/Validators.git
cd Validators/python
pip install -e ".[dev]"pytestpytest --cov=jsonagents --cov-report=htmlblack jsonagents tests
ruff check jsonagents tests
mypy jsonagentsValidate a manifest from file path or dictionary.
Parameters:
path_or_dict(str | dict): Path to manifest file or manifest dictionarystrict(bool): Treat warnings as errors
Returns: ValidationResult
Main validator class.
Methods:
validate(manifest: dict) -> ValidationResultvalidate_uri(uri: str) -> URIValidationResultvalidate_policy(expression: str) -> PolicyValidationResult
Result object from validation.
Attributes:
is_valid(bool): Whether validation passederrors(list[str]): Validation errorswarnings(list[str]): Non-critical issuesmanifest(dict): The validated manifest
Contributions welcome! Please see CONTRIBUTING.md.
Apache 2.0 — See LICENSE for details.
See CHANGELOG.md for version history.