Overview
TheTrustBoundary enforces zero-trust isolation between agents. By default, all communication is denied unless explicitly allowed.
Deny-all by default
Controls
Global blocklist
Global blocklist
Block an agent from all communication:Blocking automatically removes the agent from the trusted list.
Global allowlist
Global allowlist
Trust an agent for all pairs:Trusting automatically removes the agent from the blocked list.
Pair-level blocking
Pair-level blocking
Block a specific directional pair:
Token-bucket rate limiting
Rate limiting uses a token-bucket algorithm (not fixed-window), providing smooth, fair enforcement:| Property | Value | Description |
|---|---|---|
| Capacity | max_requests_per_minute | Maximum burst size |
| Refill rate | capacity / 60.0 tokens/sec | Smooth refill over time |
| Initial tokens | Full capacity | First request never rate-limited |
Configuration
Automatic eviction
Cold pairs (no requests for 5 minutes) are automatically evicted from the rate-limit map to prevent unbounded memory growth. Eviction runs once per minute.Evaluation order
The trust boundary evaluates requests in this exact order:| Step | Check | On Failure |
|---|---|---|
| 1 | Sender on global blocklist? | BLOCKED |
| 2 | Receiver on global blocklist? | BLOCKED |
| 3 | Pair explicitly blocked? | BLOCKED |
| 4 | (Strict mode) Both agents in allowlist? | BLOCKED |
| 5 | Token bucket has tokens? | RATE LIMITED |
| ✅ | All passed | ALLOWED |
Steps 1–4 are stateless (no side effects). Rate-limit state is only allocated at step 5, after all policy checks pass.
Usage with the interceptor
The interceptor creates aTrustBoundary with default_allow=True by default, since it handles verification itself. For zero-trust deployments, inject your own: