Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions schemas/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,22 @@
"open-agent-audit"
],
"summary": "Trust Passport \u2014 signed, expiring, verifiable trust-state artifact for AI agents."
},
{
"id": "canonical-event",
"title": "CanonicalEvent",
"path": "schemas/v0.1/canonical-event.schema.json",
"canonical_id": "https://wasmagent.dev/schemas/v0.1/canonical-event.schema.json",
"version": "open-agent-audit/v0.1",
"stability": "evolving",
"owners": [
"wasmagent-protocol"
],
"consumers": [
"open-agent-audit",
"wasmagent-js"
],
"summary": "A single observable event in an AI agent's runtime trace \u2014 canonical audit-event shape emitted by open-agent-audit and mapped onto aep-record."
}
]
}
89 changes: 89 additions & 0 deletions schemas/v0.1/canonical-event.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://wasmagent.dev/schemas/v0.1/canonical-event.schema.json",
"title": "CanonicalEvent",
"description": "A single observable event in an AI agent's runtime trace — the canonical audit-event shape emitted by open-agent-audit and other producers. Cross-repository contract: downstream repos consume this via @wasmagent/protocol and map it onto aep-record (see open-agent-audit adapter). The schema_version field identifies the event format and is independent of aep-record's schema_version.",
"type": "object",
"required": ["schema_version", "run_id", "event_id", "timestamp", "type", "actor", "agent_id", "model_id"],
"additionalProperties": false,
"properties": {
"schema_version": { "const": "open-agent-audit/v0.1" },
"run_id": { "type": "string", "minLength": 1 },
"session_id": { "type": "string" },
"agent_id": { "type": "string", "minLength": 1 },
"model_id": { "type": "string", "minLength": 1 },
"event_id": { "type": "string", "minLength": 1 },
"timestamp": { "type": "string", "format": "date-time", "description": "RFC 3339 timestamp with timezone offset" },
"type": {
"type": "string",
"enum": ["tool_call", "policy_decision", "human_approval", "observation", "model_output", "final_answer", "error"]
},
"actor": { "type": "string", "enum": ["agent", "user", "system", "tool", "human_reviewer"] },
"tool": {
"type": "object", "additionalProperties": false, "required": ["name"],
"properties": {
"name": { "type": "string", "minLength": 1 },
"capability": { "type": "string" },
"args_hash": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" },
"result_hash": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" },
"risk_tags": { "type": "array", "items": { "type": "string" }, "uniqueItems": true }
}
},
"policy": {
"type": "object", "additionalProperties": false, "required": ["decision", "reason"],
"properties": {
"decision": { "type": "string", "enum": ["allow", "deny", "ask_user"] },
"reason": { "type": "string" },
"rule_id": { "type": "string" }
}
},
"human": {
"type": "object", "additionalProperties": false, "required": ["reviewer_id", "decision"],
"properties": {
"reviewer_id": { "type": "string" },
"decision": { "type": "string", "enum": ["approve", "deny", "escalate"] },
"justification": { "type": "string" }
}
},
"error": {
"type": "object", "additionalProperties": false, "required": ["kind", "message"],
"properties": { "kind": { "type": "string" }, "message": { "type": "string" } }
},
"model_output": {
"type": "object", "additionalProperties": false,
"properties": {
"content_hash": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" },
"token_count": { "type": "integer", "minimum": 0 },
"finish_reason": { "type": "string" }
}
},
"observation": {
"type": "object", "additionalProperties": false,
"properties": {
"source": { "type": "string" },
"content_hash": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" },
"byte_size": { "type": "integer", "minimum": 0 }
}
},
"evidence": {
"type": "object", "additionalProperties": false,
"properties": {
"evidence_id": { "type": "string" },
"hash": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" },
"prev_hash": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" },
"signature": { "type": "string" },
"signature_algorithm": { "type": "string", "enum": ["ed25519", "ecdsa-p256"] },
"signer_key_id": { "type": "string" }
}
}
},
"allOf": [
{ "if": { "properties": { "type": { "const": "tool_call" } }, "required": ["type"] }, "then": { "required": ["tool"] } },
{ "if": { "properties": { "type": { "const": "policy_decision" } }, "required": ["type"] }, "then": { "required": ["policy"] } },
{ "if": { "properties": { "type": { "const": "human_approval" } }, "required": ["type"] }, "then": { "required": ["human"] } },
{ "if": { "properties": { "type": { "const": "observation" } }, "required": ["type"] }, "then": { "required": ["observation"] } },
{ "if": { "properties": { "type": { "const": "model_output" } }, "required": ["type"] }, "then": { "required": ["model_output"] } },
{ "if": { "properties": { "type": { "const": "final_answer" } }, "required": ["type"] }, "then": { "required": [] } },
{ "if": { "properties": { "type": { "const": "error" } }, "required": ["type"] }, "then": { "required": ["error"] } }
]
}
10 changes: 10 additions & 0 deletions tests/fixtures/invalid/canonical-event/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"schema_version": "open-agent-audit/v0.1",
"run_id": "run-abc123",
"agent_id": "agent-researcher-1",
"model_id": "claude-opus-4-8",
"event_id": "evt-0002",
"timestamp": "2026-07-28T14:03:23Z",
"type": "tool_call",
"actor": "agent"
}
28 changes: 28 additions & 0 deletions tests/fixtures/valid/canonical-event/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"schema_version": "open-agent-audit/v0.1",
"run_id": "run-abc123",
"session_id": "session-001",
"agent_id": "agent-researcher-1",
"model_id": "claude-opus-4-8",
"event_id": "evt-0001",
"timestamp": "2026-07-28T14:03:22Z",
"type": "tool_call",
"actor": "agent",
"tool": {
"name": "write_file",
"capability": "filesystem.write",
"args_hash": "9e6ce95e6a1e4d0f4b8b0e8b0a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d",
"result_hash": "f0e1d2c3b4a5968778695a4b3c2d1e0f1234567890abcdef1234567890abcdef",
"risk_tags": [
"shell",
"filesystem"
]
},
"evidence": {
"evidence_id": "ev-0001",
"hash": "1f2e3d4c5b6a79887766554433221100ffeeddccbbaa99887766554433221100",
"signature": "base64sig==",
"signature_algorithm": "ed25519",
"signer_key_id": "k1"
}
}
Loading