Skip to content

v2.0: Verifiable Agents — cryptographically signed audit trails of every LLM call and tool invocation #738

Closed

Description

@AmitoVrito

Summary

Every LLM call, tool invocation, retrieval, and agent decision is captured into a tamper-evident, cryptographically signed trace. Traces are exportable as portable audit bundles consumable by compliance teams, regulators, or external verifiers.

Motivation

Regulated industries (finance, healthcare, public sector) cannot deploy LLM agents without an auditable trail. Today this is glued together per-customer. A first-class verifiable trace makes SynapseKit the only framework enterprise compliance teams will approve.

This is also the foundation for trustworthy SelfImprovingAgent (#self-evolving) — every config change is signed and reproducible.

Design Sketch

from synapsekit import VerifiableAgent, AuditSink, SigningPolicy

agent = VerifiableAgent(
    inner=my_agent,
    signer=SigningPolicy.ed25519(key_path="./signing.key"),
    sink=AuditSink.append_only("./audit.log"),  # or .s3(...), .otel(...)
    capture=["llm_calls", "tool_calls", "retrievals", "decisions", "state"],
    redact=["emails", "ssn", "credit_card"],
)

result = await agent.run("...")

# Export tamper-evident bundle
bundle = agent.export_audit_bundle(run_id=result.run_id)
# bundle.zip contains: trace.jsonl, hashes.merkle, signatures.json, manifest.json

# External verification
from synapsekit.audit import verify
verify("./bundle.zip", public_key="./signing.pub")
# -> VerificationResult(valid=True, chain_intact=True, signed_at=...)

Trace Format

  • Append-only JSON Lines
  • Each record: {step_id, parent_id, kind, payload, timestamp, prev_hash, hash}
  • Merkle tree over hash field → root signed at flush
  • Compatible with OpenTelemetry spans (export via OTLP)
  • Schema versioned

Components

  • VerifiableAgent wrapper
  • AuditSink interface — file, S3, OTEL, Kafka
  • SigningPolicy — Ed25519 default, KMS-backed option
  • Merkle hasher with deterministic serialization
  • PII redactor (pluggable, regex + ML)
  • CLI: synapsekit audit verify <bundle.zip>
  • CLI: synapsekit audit replay <bundle.zip> — re-runs trace, verifies same inputs, tool results, retrieval refs, and policy hashes (identical output is an optional deterministic-mode check only)
  • Selective disclosure: zero-knowledge style export of subsets of a trace
  • Integration with PrometheusMetrics — emits audit_records_signed_total

Use Cases

  • GDPR / HIPAA / SOC2 audit evidence
  • AI Act (EU) Article 12 logging compliance
  • Court-admissible AI decision records
  • Bug reproduction with full provenance
  • Anti-prompt-injection forensics

Risks

  • Performance — signing every record is expensive. Mitigate with batched Merkle signing.
  • Key management — bring-your-own-key, HSM/KMS support from day one
  • Privacy vs auditability — redaction must happen before hashing; document the tradeoff

Acceptance Criteria

  • External tool can verify a bundle without SynapseKit installed (spec is open)
  • Tamper detection: modify any byte in a trace → verification fails
  • Replay verifies same inputs, tool results, retrieval refs, and policy hashes — identical output is an optional check for deterministic agents only
  • OTEL exporter ships traces to Jaeger/Honeycomb
  • Compliance whitepaper drafted (HIPAA + GDPR + EU AI Act mapping)

Bundle Verifier — Required Negative Tests

  • One JSONL record removed from the middle of the chain
  • Two records reordered
  • parent_id points to a record outside the bundle
  • Payload bytes changed after signing
  • Merkle root valid but manifest schema version mismatched
  • Key rotation between flushes
  • OTEL export missing a record that exists in the signed bundle

Related

Activity

  1. added
    enhancement
    security
    v2.0
    observability
    on Jun 25, 2026
  2. added this to the v2.0.0 milestone on Jun 25, 2026
  3. HarperZ9 commented on Jun 28, 2026

    @HarperZ9

    This is a strong direction. The invariant I would make explicit early is that the audit bundle should prove both event integrity and redaction integrity.

    One trap with "redaction before hashing" is that an external verifier can prove the redacted payload was not changed, but cannot tell whether the redaction policy was applied consistently unless the bundle also records the policy/version and the redaction outcome. I would make each event carry something like:

    {
      "event_id": "evt_123",
      "parent_id": "evt_122",
      "kind": "tool_call",
      "actor": "agent|tool|user|system",
      "payload_hash": "sha256:...",
      "redaction_policy_hash": "sha256:...",
      "redaction_status": "none|redacted|withheld",
      "schema_version": "trace-event/v1",
      "prev_hash": "sha256:...",
      "hash": "sha256:..."
    }

    That lets the verifier distinguish:

    • payload was present and unchanged
    • payload was intentionally withheld
    • payload was redacted under a named policy
    • payload is missing when the schema says it should exist

    I would also be careful with "replay produces identical outputs" as an acceptance criterion. That is good for deterministic agents, but for LLM-backed agents the stronger general contract is probably: replay verifies the same admitted inputs, tool results, retrieval refs, state refs, policy hashes, and final claims. Identical output can be an optional deterministic-mode check rather than the baseline promise.

    Useful negative tests for the bundle verifier:

    • one JSONL record removed from the middle
    • two records reordered
    • parent id points to a record outside the bundle
    • payload bytes changed after signing
    • redaction policy hash changed after signing
    • Merkle root valid but manifest schema version mismatched
    • key rotation between flushes
    • OTEL export missing a record that exists in the signed bundle

    I am building Project Telos around local-first receipt loops for agent actions, and the practical lesson has been that "signed trace" is only half the product. The other half is an honest verdict surface: MATCH when the bundle supports the claim, DRIFT when it contradicts it, and UNVERIFIABLE when the evidence needed to verify the claim was not admitted.

  4. Abhay-Mmmm commented on Jul 1, 2026

    @Abhay-Mmmm
    Collaborator

    @AmitoVrito I can start working on this.

  5. AmitoVrito commented on Jul 1, 2026

    @AmitoVrito
    CollaboratorAuthor

    Hey @HarperZ9 really appreciate you taking the time to dig into this so thoroughly!
    Your point on the replay criterion is spot on and honestly something we would have gotten wrong. We're updating the acceptance criteria to verify same inputs, tool results, retrieval refs, and policy hashes rather than identical output — that's the right contract for non-deterministic LLM agents.
    The negative test cases are gold, adding them directly to the issue.
    On the redaction_policy_hash + redaction_status model -> you're absolutely right in principle, and the schema you've outlined is really well thought out. For v2.0 we're keeping the core feature focused on developer-facing audit trails (debug, replay, transparency), but we're treating your redaction consistency model as the blueprint for a compliance extension in a future release. It's exactly the right direction for regulated use cases.
    Also curious about Project Telos sounds like you're solving a closely related problem. Would love to have you involved as a contributor if you're open to it! Also i would like to shave a look how is that going (soon !!)
    Thanks again, this kind of review is exactly what makes the design better.

  6. HarperZ9 commented on Jul 2, 2026

    @HarperZ9

    Happy to stay involved. The split you described makes sense: keep v2.0 focused on developer-facing audit/replay first, but leave enough structure that the compliance extension can attach later without changing the core event model.

    The first slice I would keep very small:

    1. Event-chain JSONL schema: event_id, parent_id, kind, actor, payload_hash, schema_version, prev_hash, hash, plus optional/reserved redaction fields even if v2.0 does not enforce them yet.
    2. Verifier result surface: make the verifier return MATCH, DRIFT, or UNVERIFIABLE, not just true/false. That distinction matters when evidence is missing rather than contradictory.
    3. Negative fixtures before integrations: removed record, reordered record, bad parent, changed payload hash, changed schema version, missing OTEL-correlated record, and key rotation between flushes.
    4. Replay contract wording: baseline replay verifies admitted inputs/tool results/retrieval refs/policy refs/final claims. Identical output can be a deterministic-mode add-on.
    5. OTel bridge later: once the bundle verifier is stable, add a cross-check that exported spans contain the event IDs/hash refs expected from the signed bundle. That avoids making OTel storage the source of truth.

    I can review the initial schema/fixture PR when it exists, or pressure-test a fixture against the receipt model I am using in Project Telos. The main lesson from that work is that the product is not just "a signed log"; it is the verifier that tells a developer which claims the log can actually support.

  7. AmitoVrito commented on Jul 14, 2026

    @AmitoVrito
    CollaboratorAuthor

    Verifiable agents merged, thanks Abhay. The RFC 6962 Merkle work and the standalone verifier are the standout pieces here.

  8. added
    v2.0.1
    and removed
    v2.0
    on Jul 18, 2026
  9. modified the milestones: v2.0.0, v2.0.1 on Jul 18, 2026
  10. added
    v2.0
    on Jul 18, 2026
  11. modified the milestones: v2.0.1, v2.0.0 on Jul 18, 2026
  12. removed
    v2.0.1
    on Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementobservabilitysecurityv2.0

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions