Repository navigation
Releases
ToolBoundary v1.1.1
A hardening release. Every user should upgrade.
Changed
- A value or record count given as a string must now be a plain ASCII decimal, such as
"25"or"-25.50". Strings with whitespace, underscores, exponents, a leading+or zero, or non-ASCII digits are denied withINVALID_VALUE, because a tool's parser might read them as a different number. - A tool with a
max_valuebut nomin_valuenow raises aFutureWarning, because negative values pass such a limit. Behaviour is unchanged until ToolBoundary 2.0, which will imply a floor of 0.
Added
- Add
Boundary(deny_negative_values=True). Amax_valuewithout amin_valuethen gets a floor of 0, and negative values are denied withMIN_VALUE_VIOLATED. An explicitmin_valuealways wins. - Add Overview, Safety approach, Supporting evidence and Limitations sections to the README.
- Add CI checks for ruff formatting and mypy, and test on Python 3.13, Windows and macOS.
- Add a Security workflow (CodeQL,
pip-audit, ruff bandit rules, dependency review), OpenSSF Scorecard and Dependabot. - Add performance benchmarks in
benchmarks/, and a workflow that fails a pull request if any decision path gets more than 25% slower than the base branch. - Check that a release tag matches the package version, and publish signed build attestations to PyPI.
Fixed
- Give the gateway's ambiguous-body tests short ids, so the suite runs on Windows.
Upgrade notes
- If a tool with a
max_valuetakes negative values, set a negativemin_value. Otherwise setmin_value=0or passdeny_negative_values=Trueto silence the new warning. - If you pass numbers as strings with spaces or other formatting, convert them to numbers or plain decimal strings first.
Full changelog: v1.1.0...v1.1.1
ToolBoundary v1.1.0
ToolBoundary v1.1.0
Release type: Security feature
This release adds a policy gateway that protects your tools from a compromised agent by running policy outside the agent's process.
Policy gateway
In-process checks stop mistakes and misbehaving model output, but code running in the agent's process can get around them. toolboundary.gateway moves policy out of that process.
- Agents can't approve themselves: the policy runs in the gateway, and the agent holds only an identity key.
- Deny by default: a request must match a
GatewayRuleyou wrote. - Limits come from the real request: value and record count are read from the bytes being forwarded, not from what the agent claims.
- Credentials stay out of the agent: the gateway adds them when it forwards a request.
- Ambiguous requests are refused: this covers duplicate JSON keys, encoded path tricks, method-override headers and unlisted query parameters.
Run it in its own process:
python -m toolboundary.gateway --app policy_app:buildDeployment requirements
The gateway only protects you when all of these are true:
- It runs as a different OS user or in a different container from the agent.
- The agent has no direct network route to the tools.
- The agent doesn't hold the tools' credentials.
See the gateway guide for setup.
Other changes
- Guarding a tool without
access_modenow raisesFutureWarning. It still falls back toREAD_ONLY, andaccess_modewill be required in 2.0. strict_limits=Truenow also requires a value when a tool has only amin_value.- The docs now say plainly that token request binding stops a request being changed after approval, but doesn't stop a compromised caller declaring a false value.
Known limitations
- A prompt-injected agent can still do anything its rules allow, so keep rules narrow and limits low.
- A
requires_approvalcall through the gateway is denied, and there's no built-in way to resume it after a person approves. - The gateway covers HTTP tools only, and it doesn't inspect responses.
Closes #25. #26 stays open until access_mode becomes required.
Install
pip install --upgrade toolboundaryFull details are in the changelog.
ToolBoundary v1.0.5
ToolBoundary v1.0.5
Release type: Security
This release closes several ways a denied or limited action could get through, and makes emergency stops, proxy tokens and evidence behave as documented. All users should upgrade.
Security fixes
- Kill switch for running agents: new
kill_switch_fileis checked on every call, so creating the file halts a running agent. A running process's environment can't be changed from outside, sokill_switch_envonly works if set before the agent starts. Earlier documentation was wrong about this. - AgentKey fails closed:
AgentKeyProviderno longer allows every call when no client is configured. Demo mode now requiressimulate=True. - Proxy tokens are narrower: tokens carry the call's access mode, so read-only tokens can't use write methods. Tokens can also be bound to one exact method, path and body with
request_method,request_pathandrequest_body, and routes can require this withrequire_request_binding=True. - Limits apply to every argument style:
max_valueandmax_recordsnow cover positional LangChain input and**kwargsfunctions. - No redirects off-route: the proxy returns upstream redirects to the client instead of following them with the client's credentials.
- Block-lists are harder to evade: blocked operations match regardless of case, surrounding spaces or character width.
- Better secret handling: nested secrets and more credential names are redacted from audit metadata, and providers no longer receive secret-named arguments.
- Dependencies and release pipeline: the
langchainextra now requires alangchain-corerelease patched for CVE-2025-68664, GitHub Actions are pinned to commit SHAs, and packages are built outside the publishing job.
Fixes
- Async
@guarded_toolfunctions now record their real outcome. - Positional LangChain arguments are bound into the call digest.
- Enforced provider denials and outages are audited as
DENY. - Malformed token signatures now get a 403 and call
on_denied. InMemoryTokenStoreis thread-safe.- Proxy response size and idle connections are limited.
guard_toolworks with LangChain@toolfunctions.
Upgrade notes
AgentKeyProvider()without a client now raisesConfigurationError. Pass your client, orsimulate=Truefor demos only.- Proxy
POST,PUT,PATCHandDELETErequests need a token withWRITEaccess or higher, so pass the realaccess_modetocheck_and_authorize(). - If you relied on the proxy following upstream redirects, your client must now follow them.
- Use
kill_switch_filefor emergency stops.
Known limitations
- Code in a process holding the
TokenIssuercan still mint tokens. To defend against a compromised agent, run theBoundary, issuer and proxy in a separate process. Tracked in #25. - Tools guarded without an explicit access mode are treated as
READ_ONLY, so set the real mode on every tool that writes or executes. Tracked in #26.
Install
pip install --upgrade toolboundaryFull details are in the changelog.
ToolBoundary v1.0.4
ToolBoundary v1.0.4
Release type: Framework integration
ToolBoundary v1.0.4 introduces an optional CrewAI integration, bringing runtime authorization and policy enforcement directly into CrewAI tool execution.
What's new
CrewAI integration
- "guard_tool" — wrap an individual CrewAI "BaseTool" with ToolBoundary authorization.
- "guard_tools" — wrap multiple CrewAI tools and configure per-tool policy overrides.
- Synchronous and asynchronous execution protection — authorization runs inside the wrapped tool's "_run" and "_arun" execution paths.
- Structured-tool protection — the authorization check remains in the execution path when CrewAI invokes a structured tool.
- Positional argument handling — arguments are normalized against the original tool signature before configured value and record-count limits are evaluated.
- Provider-aware authorization and evidence — when an external provider is configured, the adapter uses ToolBoundary's existing authorization and execution-evidence lifecycle.
Optional dependency
CrewAI remains optional. The core ToolBoundary package does not require CrewAI or add a mandatory framework dependency.
Install the core package:
pip install toolboundary
Install the CrewAI integration:
pip install 'toolboundary[crewai]'
Existing optional integrations remain available:
pip install 'toolboundary[langchain]'
pip install 'toolboundary[redis]'
Compatibility and security model
The CrewAI adapter uses ToolBoundary's existing local policy engine rather than introducing a separate authorization system. Local policy remains authoritative, and an external provider cannot override a local denial.
As with other integrations, tools should be invoked through their guarded wrappers. ToolBoundary is an application-layer enforcement library, not a substitute for credential scoping or network-level egress controls.
Validation
The merged CrewAI integration passed the GitHub Actions build and test checks on Python 3.9, 3.10, 3.11, and 3.12.
Contributors
Thanks to Charles Omeneki for contributing the CrewAI integration and working through review feedback and CI fixes.
ToolBoundary v1.0.3 Release Notes
Release type: Security and correctness
ToolBoundary v1.0.3 tightens network-proxy request validation, makes several policy checks more explicit, and improves the safety and accuracy of execution audit evidence.
Security improvements
Network proxy request validation
- Prevented client-controlled request paths from changing the configured upstream authority.
- Rejected path traversal and malformed paths before forwarding a request.
- Added a configurable request-body size limit. The default maximum is 10 MiB.
- Rejected invalid or negative
Content-Lengthvalues and unsupported transfer-encoding requests.
Safer audit metadata
- Common secret-like argument names are redacted in audit metadata generated by
@guarded_tool. - Added
sensitive_argsfor application-specific names that must be redacted. - Added
log_arg_values=Falseto record argument types rather than argument values.
Correctness fixes
- Explicit operation allow-lists: when a
ToolPermissiondefinesallowed_operations, a call must supply an operation that is present in that allow-list. Missing operations are denied. - Numeric policy limits: values used in configured numeric-limit checks are validated; malformed and non-finite values are denied.
min_valueis supported alongsidemax_value. - Strict limit enforcement:
Boundary(strict_limits=True)requires a value whenmax_valueis configured and a record count whenmax_recordsis configured. - Decorator operation fallback: a wrapped function's
operation=Noneno longer overrides an operation configured on@guarded_tool. - Execution evidence for
Noneresults: a tool that returnsNonewithout raising an exception is recorded as a successful execution, rather than an unknown outcome.
Compatibility and installation
The core package remains dependency-free. Framework and shared-state integrations remain optional extras:
pip install toolboundary
pip install 'toolboundary[langchain]' # optional LangChain integration
pip install 'toolboundary[redis]' # optional shared Redis backendsThe provider-neutral EvidenceProvider contract, AgentKey reference integration, and optional Redis-backed rate limiter/token store introduced in v1.0.2 remain available in v1.0.3.
Deployment note
NetworkEnforcer only mediates requests routed through the proxy. To prevent an agent from reaching an upstream endpoint directly, configure network egress restrictions (for example, firewall, container, or service-mesh policy) so the upstream is reachable only through the approved path. See the API reference for configuration details.
ToolBoundary v1.0.2
ToolBoundary v1.0.2 brings shared Redis-backed rate limiting and token storage to multi-process deployments, building on the provider-neutral authorization and evidence architecture introduced in v1.0.0 and the AgentKey reference integration included in v1.0.1.
ToolBoundary remains a local runtime enforcement library: external providers can add authorization checks and execution evidence, but they cannot override a local denial.
What's New
1. Shared Redis Backends
This release introduces optional Redis-backed implementations for deployments running multiple processes or replicas.
RedisSlidingWindowRateLimiter— shares rate-limit counters across processes using Redis sorted sets and an atomic Lua script.RedisTokenStore— tracks single-use token consumption across processes using RedisSET NXwith expiration.- Dependency injection — supply a custom rate limiter through
Boundary(rate_limiter=...)and a shared token store throughNetworkEnforcer(token_store=...). - Fail-closed by default — Redis failures deny rate-limited operations or token consumption when shared state cannot be verified. An explicit
fail_closed=Falseoption is available for deployments that deliberately choose fail-open behavior.
Redis is an optional dependency. The default in-memory implementations remain available, and installing the core package does not require Redis.
Install the Redis extra:
pip install "toolboundary[redis]"2. AgentKey Reference Integration
The release includes the ToolBoundary-side reference integration for AgentKey, built against the provider-neutral EvidenceProvider interface.
The integration demonstrates:
- External authorization before tool execution.
- Post-execution evidence recording.
- Observe and enforce modes.
- Authorization consumption and replay prevention.
- Preservation of exact tool arguments across authorization and execution.
- Local-deny-is-final behavior.
AgentKey remains optional. ToolBoundary continues to enforce local policy independently of external provider availability.
3. Provider-Aware Authorization and Evidence
ToolBoundary provides a provider-neutral architecture for integrating external authorization and evidence systems.
ProviderMode.OBSERVE— records provider decisions without blocking locally permitted actions.ProviderMode.ENFORCE— requires external authorization and fails closed on provider denial or unavailability.authorize_call()andrecord_execution()— support the provider-aware execution lifecycle.- Structured decisions and audit metadata — retain authorization results, call digests, execution evidence, and related correlation information.
Local policy remains authoritative. A provider cannot turn a locally denied action into an allowed action.
4. Tests and Documentation
This release adds Redis backend tests covering:
- Sliding-window allow and deny behavior.
- Shared state across Redis client instances.
- Token consumption, expiration, and replay prevention.
- Integration with
BoundaryandNetworkEnforcer. - Fail-closed and explicitly configured fail-open behavior.
- Missing optional dependency handling.
The Redis tests use fakeredis with Lua support, so the test suite does not require a live Redis server.
Documentation has also been updated with Redis installation instructions, multi-process deployment examples, backend injection points, and the AgentKey reference integration.
Installation and Upgrade
Standard installation:
pip install --upgrade toolboundaryInstallation with Redis support:
pip install --upgrade "toolboundary[redis]"Redis backend example:
from toolboundary import Boundary
from toolboundary.redis_backend import (
RedisSlidingWindowRateLimiter,
RedisTokenStore,
)
limiter = RedisSlidingWindowRateLimiter(
redis_url="redis://localhost:6379/0"
)
store = RedisTokenStore(
redis_url="redis://localhost:6379/0"
)
boundary = Boundary(
# Keep your existing Boundary configuration here.
agent_name="support-agent",
rate_limiter=limiter,
)
# For network-layer enforcement, inject the shared token store:
# enforcer = NetworkEnforcer(
# issuer,
# routes,
# token_store=store,
# )Configure the Redis connection for your environment before using the shared backends in production.
Compatibility
- Existing in-memory rate limiting and token storage remain supported.
- Redis is not required for standard ToolBoundary usage.
- Redis functionality is opt-in through
toolboundary[redis]. - External authorization remains optional.
- Local enforcement remains authoritative regardless of provider mode.
Evidence and Canonicalization Note
The current Python call-binding implementation uses deterministic JSON key ordering to calculate SHA-256 digests. This is not, by itself, a cross-language canonicalization standard. RFC 8785 (JSON Canonicalization Scheme, JCS) remains the target for separately specified cross-language canonical evidence.
Release Summary
ToolBoundary v1.0.2 combines the AgentKey reference integration and provider-aware authorization architecture with optional Redis-backed shared rate limiting and token storage, while preserving the dependency-free, in-memory default.
Full documentation: GitHub Repository
API Reference: docs/API.md
PyPI: toolboundary
ToolBoundary v1.0.1
ToolBoundary v1.0.1 extends the local runtime security boundary with a provider-neutral authorization and evidence workflow, plus the first ToolBoundary-side AgentKey integration example and end-to-end coverage.
The core principle remains unchanged:
ToolBoundary remains the local enforcement authority.
External providers can add authorization and evidence, but they cannot override a local deny.
Highlights
Provider-aware authorization and evidence
- Provider-neutral
EvidenceProviderprotocol. ProviderMode.OBSERVEfor non-blocking provider evaluation.ProviderMode.ENFORCEfor fail-closed external authorization.- Structured
LocalDecisionandAuthorizationContext. - Centralized
authorize_call()/record_execution()lifecycle. - Exact tool-call freezing before provider authorization.
- SHA-256 call and result digests for the current ToolBoundary binding model.
- Single-use authorization consumption and replay prevention.
- Post-dispatch provider failure isolation so local execution evidence is preserved.
AgentKey reference integration
ToolBoundary now includes the ToolBoundary-side reference integration for AgentKey:
toolboundary.integrations.agentkey.AgentKeyProvider- Runnable example:
examples/agentkey_integration.py - End-to-end integration suite:
tests/test_agentkey_integration.py
The integration demonstrates:
- Local allow followed by external provider allow.
- Provider denial blocking execution in enforce mode.
- Consumed-grant replay prevention.
- Post-dispatch execution reporting.
- Local-deny-is-final behavior.
- Exact argument preservation between authorization and evidence.
- Session and authorization correlation.
- Observe versus enforce behavior.
AgentKey remains optional. The core ToolBoundary package does not require an external service.
Documentation
Updated documentation covers:
- External authorization providers.
- Provider configuration and execution flow.
- AgentKey interoperability.
- Provider-aware audit metadata.
- Current evidence and call-binding behavior.
See:
README.mddocs/API.mdexamples/agentkey_integration.pytests/test_agentkey_integration.py
Important Evidence Note
The current v1.0.x Python implementation uses deterministic JSON key ordering for its local SHA-256 call binding.
This should not be interpreted as a cross-language canonicalization standard.
Cross-language native signed evidence is being designed separately around RFC 8785 (JCS) so that independently implemented verifiers can reproduce the same canonical representation.
Existing v1.0.x call-digest behavior is intentionally not changed in this patch release.
Compatibility
Local-only ToolBoundary usage remains supported without any external provider:
boundary.check(...)Existing policy enforcement remains local and provider-free by default.
External providers are opt-in.
Test Coverage
The release includes dedicated provider and AgentKey integration coverage for:
- authorization success and denial;
- observe/enforce semantics;
- replay prevention;
- execution success and failure reporting;
- provider recording failures;
- local deny isolation;
- exact-call binding;
- field mapping;
- session correlation;
- approval-required responses;
- provider receipt semantics.
What's Next
Follow-up work is tracked in GitHub issues, including:
- RFC 8785/JCS canonical evidence;
- native tamper-evident evidence records;
- offline evidence verification and optional Ed25519 signatures;
- additional framework integrations;
- OpenTelemetry observability;
- stronger property/fuzz testing for evidence formats.
Contributors
Thanks to the contributors and reviewers helping extend ToolBoundary, including the ongoing Redis shared-rate-limit work in PR #9 and the AgentKey technical collaboration.
Links
- GitHub: https://github.com/Jaycubic/toolboundary
- PyPI: https://pypi.org/project/toolboundary/
- AgentKey: https://agentkey.us/
v1.0.0 — Provider-Neutral Authorization & Evidence Layer
v1.0.0 — Provider-Neutral Authorization & Evidence Layer
ToolBoundary v1.0.0 introduces a provider-neutral authorization and evidence layer for AI-agent tool execution.
The core security boundary remains local:
ToolBoundary remains the local enforcement authority.
External providers can add stricter authorization and verifiable evidence, but they can never override a local deny.
What's New
- Provider-neutral
EvidenceProviderprotocol ProviderMode.OBSERVEandProviderMode.ENFORCE- Structured
LocalDecision authorize_call()andrecord_execution()lifecycle- Deterministic canonicalization of tool-call data
- SHA-256 exact-call binding
- Single-use authorization and replay prevention
- Execution-result binding
- Provider-aware
@guarded_tool - Provider-aware LangChain integration
- Post-dispatch evidence resilience
- Expanded provider contract tests
AgentKey Interoperability
ToolBoundary is designed to work with optional external authorization and evidence providers.
AgentKey is one example of this model, providing external authorization and verifiable evidence for AI-agent actions.
ToolBoundary does not require AgentKey.
TOOLBOUNDARY
|
┌───────────┴───────────┐
│ │
Local Authority Optional Provider
│ │
│ AgentKey
│ │
└───────────┬───────────┘
▼
Tool Execution
ToolBoundary v0.1.0
Initial public release of ToolBoundary.
ToolBoundary provides runtime boundary enforcement for AI agents, including permission controls, boundary enforcement, auditing, rate limiting, token controls, network enforcement, and LangChain integration.