Skip to content

ToolBoundary v1.0.2

Choose a tag to compare

@Jaycubic Jaycubic released this 15 Oct 09:00
· 35 commits to main since this release

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 Redis SET NX with expiration.
  • Dependency injection — supply a custom rate limiter through Boundary(rate_limiter=...) and a shared token store through NetworkEnforcer(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=False option 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() and record_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 Boundary and NetworkEnforcer.
  • 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 toolboundary

Installation 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