AgentBarrier
AgentBarrier is a deterministic test harness for the control guarantees around AI-agent tool execution. It verifies that approval, rejection, cancellation, timeout, replay, delegation, ambiguous outcomes, audit receipts, and parallel execution controls prevent unintended side effects.
It does not judge model responses and does not need an API key. AgentBarrier invokes controlled sentinel tools, observes their effects outside the agent framework, and reports whether the framework or application honored the expected lifecycle boundary.
Status: early development. The public adapter contract is usable, but compatibility should be pinned until the first stable release.
Why
An agent that can send a message, issue a refund, modify a database, or deploy code needs stronger
evidence than a configuration flag named requires_approval. AgentBarrier tests the behavior at
the effect boundary:
- no effect before approval;
- no effect after rejection;
- approval is bound to the exact reviewed arguments;
- replay does not execute the same action twice;
- a lost post-commit response is reported as unknown and reconciled before retry;
- cancelled and timed-out work cannot commit later;
- a pending approval can hold sibling effects under the strict run-barrier profile;
- delegated work inherits its parent's rejection; and
- approval decisions produce action-digest-bound receipts.
Quick start
python -m pip install agentbarrier
agentbarrier self-test
The self-test runs every guarantee against AgentBarrier's safe reference adapter. Application and
framework adapters implement the small AgentAdapter / RunHandle contract.
from agentbarrier import SuiteRunner
from myapp.agentbarrier_adapter import MyApplicationAdapter
result = SuiteRunner().verify_sync(MyApplicationAdapter())
result.raise_for_failure()
Framework probes
The built-in probes use deterministic local plans. They do not call a model provider or require an API key.
python -m pip install 'agentbarrier[openai]'
agentbarrier verify agentbarrier.adapters.openai_agents:OpenAIAgentsAdapter
python -m pip install 'agentbarrier[langgraph]'
agentbarrier verify agentbarrier.adapters.langgraph:LangGraphAdapter
The core and OpenAI adapter support Python 3.10–3.13. The LangGraph adapter requires Python 3.11+ because its interrupt lifecycle relies on async runnable-context propagation.
These probes measure the framework's lifecycle behavior in a minimal configuration. For production confidence, implement an application adapter that replaces your real consequential tools with the sentinel at dependency-injection time. See the adapter guide.
The same runner is available as a pytest fixture:
def test_agent_controls(agentbarrier):
result = agentbarrier.verify_sync(MyApplicationAdapter())
result.raise_for_failure()
CLI reports
agentbarrier verify myapp.agentbarrier_adapter:create_adapter \
--json build/agentbarrier.json \
--junit build/agentbarrier.xml \
--sarif build/agentbarrier.sarif
The target may be an adapter instance, adapter class, or zero-argument factory. A non-zero exit
status is returned for failed or errored guarantees. --strict-skips also treats unsupported
guarantees as a failure.
Guarantees
| Scenario | Capability | Guarantee |
|---|---|---|
approval_hold |
approval |
No effect commits before approval; one commits afterward. |
rejection |
rejection |
Rejected actions never commit. |
argument_binding |
argument_binding |
Executed arguments exactly match approved arguments. |
replay |
replay |
Replaying a completed action does not commit it twice. |
outcome_ambiguity |
outcome_ambiguity |
A lost post-commit response becomes UNKNOWN and is not retried blindly. |
cancellation |
cancellation |
Work cancelled after it starts cannot commit later. |
timeout |
timeout |
Timed-out work cannot commit later. |
parallel_barrier |
parallel_barrier |
A pending approval holds sibling side effects. |
delegation |
delegation |
Parent rejection prevents every delegated child effect. |
audit_receipts |
audit_receipts |
Requests and decisions have complete, action-bound receipts. |
Unsupported capabilities are explicitly reported as skipped. They are never silently counted as passing.
The strict parallel_barrier profile intentionally requires a pending approval to hold all sibling
side effects in the logical run. A framework may document a narrower, per-call approval contract;
in that case AgentBarrier still reports the difference rather than silently weakening the profile.
Adapter contract
An adapter starts one or more ActionRequest objects using the supplied EffectProbe and returns
a RunHandle. The handle exposes pending actions and lifecycle decisions. See
agentbarrier.adapters.reference.ReferenceAdapter for the complete, safe implementation and
docs/adapters.md for implementation rules.
Current framework results are recorded in the compatibility matrix. The security boundary and limitations are defined in the threat model.
Safety
Sentinel tools write only to a temporary SQLite journal owned by the test run. They do not call a real API or modify production data. Do not replace a sentinel with a production tool when writing an adapter.
Research context
AgentBarrier is motivated by research showing that approval, cancellation, timeout, and replay controls can leak side effects across agent frameworks. The initial scenario vocabulary follows the failure classes in Stop Means Stop: Measuring and Repairing the Enforcement Gap in Agent-Framework Control Primitives (2026): https://arxiv.org/abs/2607.14166.
Development
uv sync --extra test --extra all
uv run ruff check .
uv run ruff format --check .
uv run mypy src
uv run pytest --cov=agentbarrier --cov-report=term-missing
uv build
uv run twine check dist/*
License
Apache-2.0
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentbarrier-0.1.0.tar.gz.
File metadata
- Download URL: agentbarrier-0.1.0.tar.gz
- Upload date:
- Size: 243.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cbd216e21b7d6574e883161c898b64c47140fdcb6b0b01a0b46442741c506ff
|
|
| MD5 |
7a7a9c1c5452c72e6d1d271777f724b9
|
|
| BLAKE2b-256 |
f680f5bbbc6fb0cf64624641798766fc6bb60c8e7daa731af190de40b8e72878
|
File details
Details for the file agentbarrier-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agentbarrier-0.1.0-py3-none-any.whl
- Upload date:
- Size: 38.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b418688885c149c561c835c6ac620a928ed9baaefdad8b36d715b6ad62fbef3
|
|
| MD5 |
2caa0f60273ea2fc283ac96b259e8beb
|
|
| BLAKE2b-256 |
ff1a7084116e9e76a07c3454b373d144446ee04b336fb3b5035c0e697fcb36d2
|