Skip to main content

Mnestiq

A flight recorder for AI agents. Tamper-evident, signed evidence of what an agent saw, decided and did, built for incident response.

Mnestiq records the model calls, tool calls, approvals and outbound connections it is set up to capture, and tags each piece of model input with its origin: the user, a web page, tool output or another agent. Records are hash-chained and sealed with signed checkpoints. When an incident occurs, investigators can identify the run and the step, see which untrusted input came before it, and, for records under a signed checkpoint, demonstrate that the record has not been altered since.

Version 1.1: the evidence format and the documented Python API are stable. A change that would break existing evidence, older verifiers or code using the documented API needs a 2.0.

Try it

pip install mnestiq
mnestiq demo

A scripted support agent reads a poisoned web page and emails customer data out. The demo records it, traces a firewall connection back to the agent step, catches a tampered copy, verifies a redacted copy and opens the local dashboard. No API key, and nothing leaves your machine.

Install

pip install "mnestiq[anthropic]"     # or mnestiq[openai], or plain mnestiq

Optional extras:

Extra Adds
azure Signing with keys held in Azure Key Vault or Managed HSM
timestamps RFC 3161 timestamps from public timestamp authorities, and their verification

Quick start

import anthropic
from mnestiq import FileSink, Recorder
from mnestiq.egress import instrument_egress
from mnestiq.integrations.anthropic import instrument_anthropic
from mnestiq.keys import load_private_key

recorder = Recorder(FileSink("evidence.jsonl"), agent_id="support-bot",
                    signing_key=load_private_key("keys/signing.key"))
client = instrument_anthropic(anthropic.Anthropic(), recorder)
instrument_egress()

with recorder.run():
    ...  # your agent, unchanged

recorder.close()
mnestiq keygen --out keys
mnestiq verify evidence.jsonl --trusted-key keys/signing.pub
mnestiq dashboard . --trusted-key keys/signing.pub

Record an agent without code changes

mnestiq proxy sits between an agent and its model API and records every call sent through it, whatever language or framework the agent is written in. Point the agent's base URL at it:

mnestiq proxy evidence.jsonl --agent my-agent --key keys/signing.key
export ANTHROPIC_BASE_URL=http://127.0.0.1:8787/anthropic    # or OPENAI_BASE_URL=.../openai/v1

OpenAI, Anthropic, Azure OpenAI and OpenAI-compatible servers (Ollama, vLLM, LiteLLM) are supported. See the proxy guide.

Production signing

A key file readable by the agent is suitable for evaluation only. In production, keep the signing key out of the agent's reach, so that a compromised agent cannot copy it. The signing service also refuses to sign earlier evidence again:

from mnestiq import AzureKeyVaultSigner, FileSink, Recorder, SignerClient, Timestamper

# Azure Key Vault: the key is held by Key Vault, and only a SHA-256 digest is sent.
signer = AzureKeyVaultSigner("https://<vault>.vault.azure.net/keys/<name>/<version>")

# Or a local signing service running under a separate account (`mnestiq signer serve`).
signer = SignerClient.from_env()

recorder = Recorder(FileSink("evidence.jsonl"), agent_id="support-bot", signer=signer,
                    timestamper=Timestamper(),       # independent RFC 3161 timestamps
                    checkpoint_interval=300)         # signed heartbeat when idle

Keys are rotated with a signed hand-over (recorder.rotate_signer(new_signer)), which the verifier follows. The signing service signs a hand-over only if it was started with --allow-handover. See the signing guide.

Security model

Evidence is tamper-evident after it is written: with a pinned key, edits, insertions, reordering and re-signing of records under a checkpoint are detected. Redacted values keep a salted digest, so they can't be recovered by guessing. The exception is system_prompt_hash, a plain digest that redaction leaves in place, so a guessed system prompt can be confirmed from it. Records cut back past a head kept elsewhere (a HeadFile or the Evidence Vault) are detected, and backdating is detected against RFC 3161 timestamps. It cannot prove that a compromised agent told the truth at the time of writing. The threat model lists each attack considered, how it is detected, and the automated test that demonstrates it. What it says about the Evidence Vault, a separate service, has no test in this repository. Independent reviewers are invited to try the break-it challenge.

Citing

If you use the recorder or refer to it in your work, please cite it, with the DOI 10.5281/zenodo.23800724. "Cite this repository" on https://github.com/mnestiq/mnestiq gives APA and BibTeX entries.

Licensed under Apache-2.0.

Metadata

Release files for mnestiq 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mnestiq 1.1.0
File Size Uploaded Provenance Actions
mnestiq-1.1.0.tar.gz 479.3 kB With provenance Details for mnestiq-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mnestiq 1.1.0
File Interpreter ABI Platform Actions
mnestiq-1.1.0-py3-none-any.whl Python 3 none any Details for mnestiq-1.1.0-py3-none-any.whl

Total release size: 690.4 kB

Release files / mnestiq-1.1.0.tar.gz

Download URL mnestiq-1.1.0.tar.gz
Size 479.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e81b18b168341b5252e462774424661a83bc281df6190205fe7a029476c332dc
BLAKE2b-256 checksum
How to use checksums
9df3b125b358296b707647d40bc6ae4214e0a8448b1cea5b4ede928e76190a45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / mnestiq-1.1.0-py3-none-any.whl

Download URL mnestiq-1.1.0-py3-none-any.whl
Size 211.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1cc0216095a84f43f4e5a085cec817858340512e9412497b80f1139f21b5d2a2
BLAKE2b-256 checksum
How to use checksums
f37b856ef7e19006031a048565ee8a329f94e856e21d2a87452c60c78a254c10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Security for mnestiq 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mnestiq-1.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page