feat(api): expose AgentTrustScore as stable JSON schema#2
Merged
Conversation
Add to_json() method to AgentTrustScore dataclass that returns a versioned payload (schema_version: 'trust-score/v1') with overall score, grade, per-dimension breakdown, known_dimensions count, and notes. Create schemas/trust-score.schema.json defining the output contract with flexible additionalProperties for breakdown dimensions and nullable number values. Closes #1 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
to_json()method toAgentTrustScoredataclass that returns a versioned dict withschema_version: 'trust-score/v1',overall,grade,breakdown,known_dimensions, andnotesschemas/trust-score.schema.json(JSON Schema draft-07) defining the stable output contract with flexibleadditionalPropertiesfor breakdown dimensionsDetails
The existing
to_dict()method is preserved unchanged. The newto_json()adds:schema_versionfield for downstream consumers to detect format changesknown_dimensionscount (derived from the_known_dim_countproperty)The JSON Schema uses
additionalPropertiesfor the breakdown object to accommodate both the 12 built-in dimensions and any arbitrary dimensions added viaadd_dimension().Closes #1
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com