From a trace
to a clear account.
Create your first offline report, read what the evidence supports, and capture your own agent’s tool calls.
Install the verified 2.1.2 release from PyPI. Read release notes and the actual platform checks.
Make the evidence visible.
This example performs no delivery or payment. It reads synthetic artifact-store fixtures using the public package APIs.
Install the package.
Use Python 3.11 or newer.
python -m pip install consequa-x==2.1.2
consequa-x --versionGet the two example files.
Download the quickstart archive and extract it. Keep artifact_delivery.py and report_quickstart.py in the same folder. The archive includes its README and MIT license.
Prefer reading first? View the artifact adapter or view the report example.
Generate three captured examples.
Open a terminal in the extracted folder, then use a new output directory:
python report_quickstart.py --output my-first-captureOpen my-first-capture/verified.html in your browser. Compare unknown.html and other-actor.html. Each report has a separate original JSON trace.
Render a saved trace again.
consequa-x report my-first-capture/verified.json --output another-report.htmlThe destination must be new. If the console command is not on your PATH, replace consequa-x with python -m consequa_x.
State and origin stay separate.
A timeout describes a tool response. It cannot by itself determine the requested outcome.
| Example | Verified state | Effect origin | Interpretation |
|---|---|---|---|
| Verified | satisfied | confirmed | The readback covers a matching delivery and links it to the captured action. |
| Unknown | unknown | unknown | Unavailable readback does not support a success or failure conclusion. |
| Other actor | satisfied | other_actor | The requested state exists, but another actor produced the effect. |
The example hashes the bytes read from its fixture independently of the requested digest. Its application-owned ArtifactVerifier evaluates the contract and records which revisions match the target, so explain can judge the agent’s report without any artifact-specific logic.
Inspect an offline report.
A report is self-contained HTML: no JavaScript, external fonts, remote assets or network requests. It shows structural contract bounds, the timeline, responses, the reported assessment, readbacks, recorded state and origin, and an evidence graph.
Successive observations retain separate witnesses. Order, dependency, observation and origin links carry distinct labels; a graph edge does not establish counterfactual necessity.
It performs no verifier call, target matching, application action or replay. It presents captured verification and does not independently establish source truth. Each action’s assessment alignment and diagnosis codes are computed from the recorded receipts.
To start with the package’s bundled refund fixtures instead:
consequa-x demo --output sample-run
consequa-x report sample-run/traces/episode_00.json --output sample-report.htmlInput traces are validated before the output is created. The CLI preserves the source and refuses an existing output file, including the input itself.
Share a smaller surface.
Default reports use local aliases and omit arbitrary captured values: payloads, rationales, source names, raw identifiers, paths, digests, predicates and error messages. Omitted fields are absent from the HTML, including attributes, comments and embedded data.
Timing, counts, enum statuses and relationships remain visible. Review these before sharing. This is deliberate field omission, not universal anonymization or personal-data detection.
Inspect all captured fields locally
--include-details explicitly includes the entire trace as escaped, inert text. This can expose sensitive information. Keep a detailed report private whenever its trace is private.
consequa-x report my-first-capture/verified.json --output detailed-report.html --include-detailsRetain the original trace and source evidence separately. A reduced presentation is not a substitute for the verification record. For a public bug report, provide a synthetic reproduction.
Render without a service.
render_report returns HTML and writes no files. It accepts a validated Trace and an optional boolean include_details argument, which defaults to False.
from pathlib import Path
from consequa_x import Trace, render_report
trace = Trace.from_json(Path("trace.json").read_text(encoding="utf-8"))
document = render_report(trace) # Minimal disclosure by default.
with Path("report.html").open("x", encoding="utf-8") as destination:
destination.write(document)The portable schema is 1.0: several actions per trace, a declared time base, and read-only records. Package version and wire-schema version are separate. Convert traces saved by 1.x with consequa-x migrate.
Connect your application.
- Declare the contract before the action. Define matching state, deadline, persistence horizon and required count;
TraceRecorder.registerreturns that action’sActionCapture. - Capture the action as it runs. Wrap each tool call in
capture.attempt(),capture_tooloracall, and record the agent’s assessment exactly as it was stated. A run can register several actions. - Obtain independent readback. Query your system of record through a separate read-only path, with source, scope, completeness, watermark and effect-origin metadata;
poll_readbackre-reads a lagging source. - Verify it. Use the built-in
RecordVerifierfor rows, orders or tickets, or implement the explicitVerifierinterface for another domain. The receipt records which effects match the target, and any domain findings. An outcome with several required effects is oneall_oforany_ofcontract, checked part by part byCompositeVerifierwith one readback per source. - Explain and act.
explain(trace)judges each action from its receipts;retry_advicesays whether a retry would duplicate an effect. - Or let your framework report its tool calls. Optional extras record calls from the OpenAI Agents SDK (
consequential_tool), LangChain (ConsequaCallbackHandler) and the Claude Agent SDK (consequa_hooks) for the calls you mark as consequential.consequa-x otel-exportwrites a trace as OpenTelemetry spans.
The downloadable SQLite agent loop runs a scripted support agent against a real local database, captures it with TraceRecorder and checks the refund with RecordVerifier. Its other modes are other_actor and stale_readback. No money moves; the refund is a row in a local file.
python agent_loop_sqlite.py --mode timeout_after_commit --output agent-runThe artifact-delivery adapter implements a verifier by hand. In your application, read back through an independently authenticated adapter; do not copy the requested state into the readback.
Keep uncertainty intact.
Schema validation checks structure and identity linkage. Your application establishes source authentication, provider guarantees and the truth of supplied metadata. A report cannot supply those guarantees.
unknown, other_actor and unassessable conclusions remain distinct. Missing readback is not a successful verification. Research replay interfaces carry their own assumptions; the package does not claim baseline superiority or improved live-model accuracy.
Platform validation is recorded for environments actually checked. A pure-Python wheel alone does not establish compatibility with every platform.
A clear next step.
Ask a question or report a reproducible bug. Use the private security route for vulnerabilities, and release notes for publication status and platform checks.
Download the synthetic quickstart