Skip to main content
This page documents the JSON schema definitions, versioning strategies, and envelope formats used for structured data exchange across the Palyra ecosystem. While Protobuf is the primary transport for gRPC services, JSON schemas define the contracts for webhooks, configuration persistence, and the Agent-to-User Interface (A2UI) system.

Schema Versioning and the v Field

Palyra employs a strict versioning convention for all JSON-based envelopes. Every top-level object MUST include a v field (unsigned integer) representing the schema version schemas/generated/rust/protocol_stubs.rs#5-5.

Versioning Rules

  1. Mandatory Field: The v field is required for all envelopes (e.g., ApprovalRecord, Canvas).
  2. Major Versioning: The PROTOCOL_MAJOR_VERSION is currently set to 1 schemas/generated/rust/protocol_stubs.rs#5-5.
  3. Forward Compatibility: Parsers are designed to accept higher version numbers if the structure remains compatible, but they must reject payloads missing the version field.

Envelope Formats

1. Message and Approval Envelopes

Used for auditing and security decisions. The ApprovalRecord is the primary structure for documenting policy evaluations and operator decisions.
FieldTypeDescription
vuint32Schema version (1)
approval_idCanonicalIdUnique ULID for the approval request
subject_typeEnumType of action (Tool, Secret, Browser, etc.)
decisionEnumAllow, Deny, Timeout, or Error
policy_snapshotObjectHash and ID of the policy evaluated
Sources: schemas/proto/palyra/v1/gateway.proto#85-106

2. A2UI and Canvas Envelopes

The Agent-to-User Interface (A2UI) uses a JSON-based state representation for rendering sandboxed web components. The Canvas object encapsulates the state and the bundle required to render it. Canvas State Flow Sources: schemas/proto/palyra/v1/gateway.proto#255-266, schemas/proto/palyra/v1/gateway.proto#44-51

3. Process Runner Input

The palyra.process.run tool uses a specialized JSON schema to define execution parameters. This format enforces additionalProperties: false via Rust’s #[serde(deny_unknown_fields)] attribute to prevent injection of unsupported execution flags. Sources: crates/palyra-common/src/process_runner_input.rs#5-17

Implementation and Validation

Strict Property Enforcement

To ensure security and prevent “schema creeping,” Palyra enforces strict field validation. In the Rust implementation, the ProcessRunnerToolInput struct uses deny_unknown_fields to reject any JSON payload containing keys not explicitly defined in the schema crates/palyra-common/src/process_runner_input.rs#6-6.

Payload Size Caps

To prevent Denial of Service (DoS) attacks via oversized JSON payloads, the system enforces hard limits during parsing:

Data Flow: Webhook to Gateway

Webhooks arrive as signed JSON payloads and are converted into internal message formats. Webhook Validation Pipeline Sources: schemas/proto/palyra/v1/gateway.proto#16-16, fuzz/Cargo.toml#33-34

Generated Stubs

JSON schemas are synchronized with Protobuf definitions. Stubs are automatically generated for multiple languages to ensure cross-platform consistency: Sources: schemas/generated/rust/protocol_stubs.rs#1-7, schemas/generated/kotlin/ProtocolStubs.kt#1-4, schemas/generated/swift/ProtocolStubs.swift#1-3