An answer audit log records one completed answer. The original shell stays append-only, while changes are recorded as correction_appended, voided, or redacted events. Later review can see the original answer and the correction history together. Reference audio/video evidence is registered first in the private workspace media vault, and the answer audit log cites that asset through source_ref. Lookup returns sanitized metadata; runtime media retrieval returns a short-lived stream URL after recording a purpose, and the resulting access event id is bound into the answer audit log. Manual auditor downloads remain separate purpose-bound URLs. Unicode filenames are returned with an ASCII fallback plus an RFC 5987 filename* value so S3 downloads remain safe. rawctx does not claim to transcribe or understand the media by itself.
Each log can carry an application_key, optional idempotency key, external trace/conversation/message ids, actor or session hashes, question and answer text or hashes, semantic references, source references, policy flags, and metadata. Part A's inference_commitment binds the model ref, runtime ids, input/output hashes, and config hash to the same answer_hash. The SDK canonicalizes it as rawctx.inference.commitment.v1. Part B's inference_proof is a prod-off, tenant-policy gated, pluggable layer. In Platform Admin, open the tenant detail page and enable Inference proof enabled; optionally enable EZKL zkML backend and set daily/monthly budgets, per-job cost caps, queued/concurrent limits, artifact size, and retry limits. After budget and backend policy are enabled, a proof can be queued as an async job. Production ezkl_v1 verification is not run inside the API request path; it is handled by the worker path. Small hash-only external proof envelopes can still be submitted with a pre-created job_id to bind back to the Part A commitment and answer hash, but EZKL verification follows the worker policy. It can also carry OTel trace bundles and evidence asset references without forcing rawctx to own the agent runtime. The trust proof binds the Merkle leaf, KMS-signed STH, OpenTimestamps anchor, and Rekor witness receipt into an explicit ANCHORED, BITCOIN_OBSERVED_PENDING_CONFIRMATION, PENDING, or LOCAL_ONLY state.
from pathlib import Path
import rawctx
media = rawctx.register_media_evidence_asset(
filename="support-call.wav",
mime_type="audio/wav",
asset_type="audio",
content=Path("support-call.wav").read_bytes(),
metadata={"case_id": "case-123"},
registry="https://api.rawctx.dev",
)
retrieval = rawctx.retrieve_media_evidence(
media["evidence_asset_id"],
purpose="answer_generation",
external_trace_id="req_123",
external_message_id="msg_456",
registry="https://api.rawctx.dev",
)
# Stream retrieval["stream_url"] into the agent before it expires.
answer_hash = "sha256:..."
inference_commitment = rawctx.build_inference_commitment(
model_ref={
"provider": "openai",
"model_name": "gpt-4o",
"model_version": "2026-05-31",
"weights_digest": None,
"tokenizer_digest": None,
"dtype": None,
"quantization": "none",
},
input_hash="sha256:...",
output_hash=answer_hash,
config_hash=rawctx.hash_inference_config({"temperature": 0, "top_p": 1}),
attestation_level="provider_attested",
runtime={"library_versions": {}, "runtime_ids": {}, "seed": None},
)
log = rawctx.log_answer(
application_key="analytics_bot",
environment="production",
idempotency_key="analytics_bot:req_123:msg_456",
external_trace_id="req_123",
external_message_id="msg_456",
question_text="AOV 1위 채널은?",
answer_hash=answer_hash,
inference_commitment=inference_commitment,
semantic_refs=[
{
"package_ref": "@acme/shopify-orders",
"package_version": "1.2.0",
"context_hash": "sha256:...",
"latest_at_answer_time": True,
"metrics": ["aov"],
"rules": ["completed_orders_only"],
}
],
source_refs=[retrieval["source_ref"]],
evidence_access_event_ids=[retrieval["access_event_id"]],
policy_flags={
"approved_definition_only": True,
"pii_redacted": True,
},
registry="https://api.rawctx.dev",
)
assets = rawctx.list_media_evidence_assets(asset_type="audio", registry="https://api.rawctx.dev")
download = rawctx.request_media_evidence_asset_download(
media["evidence_asset_id"],
purpose="auditor_media_review",
registry="https://api.rawctx.dev",
)
# Manual auditor download remains separate from runtime stream retrieval.
supplemental = rawctx.list_answer_evidence_assets(log["id"], registry="https://api.rawctx.dev")
segments = rawctx.list_answer_segments(log["id"], registry="https://api.rawctx.dev")
text_gate = rawctx.retrieve_text_gate_alpha(
"AOV retail definition evidence",
application_key="analytics_bot",
include_hash_only=True,
registry="https://api.rawctx.dev",
)
otel = rawctx.ingest_otel_trace_bundle(
application_key="analytics_bot",
external_trace_id="req_123",
trace_bundle={"resourceSpans": []},
semantic_refs=[{"package_ref": "@acme/shopify-orders", "package_version": "1.2.0"}],
registry="https://api.rawctx.dev",
)
with rawctx.RawctxClient(registry="https://api.rawctx.dev") as client:
proof = client.proof_answer(log["id"])
online_verification = client.verify_proof_bundle_online(proof)
client.append_answer_log_event(
log["id"],
event_type="correction_appended",
reason="Answer used an outdated package version.",
payload={"corrected_answer": "wholesale입니다."},
)
exported = client.export_answer_logs(format="jsonl", application_key="analytics_bot")