Skip to main content

AgentShield

Untrusted data should not acquire authority merely because an AI agent processed it.

AgentShield is an alpha research prototype for provenance-aware runtime enforcement in tool-using AI agents. It tracks provenance + influence + authority + capability scope, then intercepts simulated side effects at execution time. It is not a prompt-injection keyword filter or a production security certification.

Why AgentShield?

Retrieved documents, memory, tool output, and model output can influence a proposed action, but influence is not authorization. AgentShield keeps those concepts separate and requires trusted, appropriately scoped authority for privileged capabilities.

flowchart TD
  U[User / trusted authority] --> R[Agent runtime]
  R --> D[Retrieval]
  R --> M[Memory]
  R --> T[Tools]
  D --> S[AgentShield enforcement]
  M --> S
  T --> S
  S --> P[Provenance and influence]
  S --> A[Authority and capability scope]
  P --> E{Policy decision}
  A --> E
  E -->|ALLOW| X[Simulated side effect]
  E -->|BLOCK| B[Attribution and trace]

Quick start

Requires Python 3.10 or newer.

python -m pip install agentshield-provenance
agentshield demo
agentshield benchmark deterministic

The PyPI distribution is agentshield-provenance; the Python package/import namespace and CLI remain agentshield:

from agentshield import AgentShield

For development from a repository checkout, use python -m pip install -e ..

Minimal public API example:

from agentshield import AgentShield, Capability, EventType, SecurityEvent

shield = AgentShield()
event = SecurityEvent(EventType.TOOL_REQUEST, "example", capability=Capability.EMAIL_SEND)
decision = shield.evaluate(event)
print(decision.action.value)

See the quickstart for protected-tool integration.

Five-minute demo

agentshield demo runs a controlled indirect-prompt-injection scenario. Every tool and side effect is simulated. The unprotected run executes the modeled proposal; the protected run blocks it and attributes the influence to its source.

Controlled benchmarks

In the bundled deterministic corpus, 27/27 modeled unauthorized actions execute in unprotected mode and 0/27 execute in protected mode. The benign corpus has 0/15 false positives. Exact, unambiguous source attribution succeeds for 26/27 attack variants; the remaining case is explicitly ambiguous.

These results describe the included scripted corpus and are not a claim of universal real-world attack coverage.

agentshield benchmark deterministic --format json
agentshield benchmark frameworks
agentshield benchmark persistence
agentshield benchmark all --manifest results.json
agentshield benchmark verify

Each benchmark retains its own metrics. See benchmark methodology and the reproducible baseline artifact.

Real-model adversarial experiments

Optional Stage 10 experiments measure two separate effects:

  1. whether a locally hosted LLM propagates a natural-language adversarial instruction;
  2. whether AgentShield prevents unauthorized actions that actually reach the runtime security boundary.

Model refusal or failure to propose an action is reported as model resistance, not AgentShield mitigation. Live experiments use an existing user-managed Ollama installation and never download models:

agentshield doctor
agentshield experiment real-model --model your-local-model:tag --trials 5

In controlled local-model experiments with Qwen3 4B and Llama 3.2 3B, both models propagated unauthorized tool actions in a substantial fraction of evaluable adversarial trials. AgentShield blocked every unauthorized proposal that reached its runtime enforcement boundary while preserving all evaluated authorized actions.

Metric Qwen3 4B Llama 3.2 3B
Valid protected responses 300/300 57/60
Attack propagation 145/300 (48.3%) 24/57 (42.1%)
AgentShield mitigations 145/145 24/24
Protected unauthorized executions 0/300 0/60
Authorized actions allowed 20/20 4/4
Malformed generations 0/840 6/168

These are controlled corpus results and are not a claim of universal protection against prompt injection or arbitrary real-world agent attacks. See real-model methodology and complete results.

CLI

agentshield --help
agentshield version
agentshield demo
agentshield doctor
agentshield benchmark {deterministic,frameworks,persistence,all,verify}
agentshield conformance
agentshield experiment real-model --model MODEL --trials 5
python -m agentshield --version

The CLI has no telemetry and does not contact Ollama unless a caller explicitly uses the model adapter outside doctor.

API stability

The top-level types exported from agentshield are the v0.1 public API. Selected contracts in agentshield.runtime are public but advanced. agentshield.integrations and agentshield.persistence are experimental for v0.1. Internal helpers may change without deprecation. Details are in API stability.

Integrations and persistence

LangGraph and Microsoft Agent Framework adapters share a security conformance contract; neither is required for the base install. SQLite persistence provides hash-chain integrity, optional caller-keyed HMAC, checkpoint lineage, replay resistance, and redacted content by default. See integrations and persistence.

Threat model and limitations

AgentShield enforces instrumented capability boundaries and does not guarantee LLM correctness, universal semantic attack detection, host security, or control of uninstrumented tools. Read the threat model and security guarantees before evaluation or integration.

Research and contribution

Reproduction methodology is documented in research.md. Contributions must preserve security invariants and benchmark semantics; start with CONTRIBUTING.md. Attack modules are for systems you own or are authorized to assess; see responsible use.

Roadmap

  • richer semantic signals and real-model evaluation datasets
  • durable distributed provenance and policy extensions
  • observability/SIEM export
  • additional adapters only when they pass the shared conformance suite
  • external research reproduction

No dates or compatibility commitments are implied.

License and citation

AgentShield is MIT licensed. Cite the software using CITATION.cff. This repository is a research prototype / early alpha release.

Metadata

Release files for agentshield-provenance 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 agentshield-provenance 0.1.0
File Size Uploaded Provenance
agentshield_provenance-0.1.0.tar.gz 98.0 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agentshield-provenance 0.1.0
File Interpreter ABI Platform
agentshield_provenance-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 212.1 kB

Release files / agentshield_provenance-0.1.0.tar.gz

Download URL agentshield_provenance-0.1.0.tar.gz
Size 98.0 kB
Tags Source
SHA-256 checksum
How to use checksums
16d8996ea7467490f584c4645890ccb4b415b5626d8b99efe442d3d61ce5a383
BLAKE2b-256 checksum
How to use checksums
21f4d19d5a4dc74df028934f3035e25c4289a0631d24a4406e244f96746079ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 13, 2026.

Transparency log

Release files / agentshield_provenance-0.1.0-py3-none-any.whl

Download URL agentshield_provenance-0.1.0-py3-none-any.whl
Size 114.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6893861a7669380eeaa412e65801749c6e4cedcf157b8d32a507c89f8ebafa82
BLAKE2b-256 checksum
How to use checksums
50f21e7923260ea8e66125b851d1e8e9e65a8f4c5b8d95a5a27aeb26e58179b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 13, 2026.

Transparency log

Security for agentshield-provenance 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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for agentshield_provenance-0.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 Aug 13, 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full 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