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 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.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 llm-agent-forensics 0.1.0
File Size Uploaded Provenance Actions
llm_agent_forensics-0.1.0.tar.gz 11.4 kB Without provenance Details for llm_agent_forensics-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 24.8 kB

Release files / llm_agent_forensics-0.1.0.tar.gz

Download URL llm_agent_forensics-0.1.0.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cbd4a4932056a5198efe3ef0fc6a920af30562eb2e36761d3304936bb27b5ac5
BLAKE2b-256 checksum
How to use checksums
e66f180f563f853c85c5d5ac3c4cc8227321afc2beb672d1ced632cf69354d4c
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.1.0-py3-none-any.whl

Download URL llm_agent_forensics-0.1.0-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
74412ba8066cea291942bdfde1a830c71c9c791395c7c623b4b3c4fbf424795d
BLAKE2b-256 checksum
How to use checksums
7d1f508b42f5a99aaa77384851d3dbc25193ffb1d0681af4c8b06f7624346400
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.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.

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.1.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