Skip to main content

AgentSleuth

Deterministic, LLM-free forensic reconstruction for AI agents.

When an AI agent is hijacked by a prompt-injection attack, an investigator needs to know which untrusted input caused which dangerous action. AgentSleuth reconstructs that chain from an agent's run log using string provenance (taint tracking) — with no LLM in the loop, so the investigator itself cannot be prompt-injected.

  • Deterministic & auditable — every alert cites a concrete flow of untrusted (tool-sourced) data into a sensitive tool call. No model calls, no network, no randomness.
  • Framework-agnostic — one core engine over a normalized run schema; add a new framework with a small adapter.
  • Zero dependencies — the core uses only the Python standard library.

Install

pip install llm-agent-forensics   # import name stays: agentsleuth

Quickstart (library)

import json
from agentsleuth import TaintTracer
from agentsleuth.adapters import get_adapter

raw = json.load(open("run.json"))
run = get_adapter("agentdojo")(raw)

findings = TaintTracer(rules="v4").trace(run)
if findings.alerted():
    for a in findings.alerts:
        print(a)   # e.g. [step 4] send_email: target from a source the user never named ...

Quickstart (CLI)

agentsleuth trace run.json --adapter agentdojo --rules v4
# exit code 1 if any alert is raised (usable in triage / CI)

Detector rule sets

rules what it adds
v2 taint only — any untrusted atom reaching a sink
v3 + authorisation (the action must be user-requested or delegated) and target provenance
v4 + provenance locality (same-record clearance) and destructive short-id checks (default)

v4 is the recommended default: it keeps high recall while flagging only genuine untrusted-to-sink flows.

Adapters

An adapter converts one framework's raw log into the normalized Run schema. Ships with an AgentDojo adapter; add your own framework in a single file:

from agentsleuth import Run, Step, ToolCall
from agentsleuth.adapters import register_adapter

def to_run(raw) -> Run:
    ...  # map your log to Steps
register_adapter("myframework", to_run)

Reproducing the research results

examples/reproduce_paper.py runs the tracer over AgentDojo logs and prints the precision/recall tables for v2/v3/v4:

python examples/reproduce_paper.py /path/to/<model>/workspace

Paper

AgentSleuth implements the detector from Forensic Readiness of AI Agents: Reconstructing Prompt-Injection Attacks Without Trusting the LLM (Ahad Nawaz). The full write-up and citation will be linked here on release.

License

MIT — see LICENSE.

Metadata

Release files for llm-agent-forensics 0.2.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 llm-agent-forensics 0.2.0
File Size Uploaded Provenance Actions
llm_agent_forensics-0.2.0.tar.gz 26.7 kB Without provenance Details for llm_agent_forensics-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llm-agent-forensics 0.2.0
File Interpreter ABI Platform Actions
llm_agent_forensics-0.2.0-py3-none-any.whl Python 3 none any Details for llm_agent_forensics-0.2.0-py3-none-any.whl

Total release size: 41.7 kB

Release files / llm_agent_forensics-0.2.0.tar.gz

Download URL llm_agent_forensics-0.2.0.tar.gz
Size 26.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4d6fdef7f10139c2faf78d3210a67b65633b6938a88c9775acfc93dec6113e53
BLAKE2b-256 checksum
How to use checksums
b53fd974b0de6bd640c08ba33f6b5584743ef9a5bba66547c5bb220d77b035e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / llm_agent_forensics-0.2.0-py3-none-any.whl

Download URL llm_agent_forensics-0.2.0-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8a802a4ee30138b3c6d536a6a583b23f9bf31089d91fd851f380180a99f9652
BLAKE2b-256 checksum
How to use checksums
52907bf48e08b19edb61fba4c62f46683eedb4b997e9cef4946faf1010f5979d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for llm-agent-forensics 0.2.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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