Skip to main content
compliorAgent() extends the base complior() wrapper with 5 agent-specific hooks that enforce constraints defined in an Agent Passport.

AgentConfig

AgentConfig extends MiddlewareConfig with these fields:

Passport Field Mapping

The SDK reads these fields from the passport object:

Hook Pipeline

Agent hooks are added around the standard compliance hooks:

Permission Enforcement

The permission pre-hook blocks API calls based on the passport:

Rate Limiting

Sliding 60-second window based on passport constraints:

Budget Tracking

Estimates token cost from response metadata and accumulates across the session:
If budgetLimitUsd is not set, the SDK falls back to passport.constraints.budget.max_cost_per_session_usd.

Circuit Breaker

3-state machine that suspends the agent after consecutive errors (Art.14(4)(b)):
When the circuit is open, all calls throw CircuitBreakerError until cooldown elapses. In half-open, one probe call is allowed — success resets to closed, failure re-opens.

Action Logging

Every LLM call produces an ActionLogEntry via the onAction callback:

Tool-Call Permission

The tool-call post-hook inspects LLM responses for tool/function calls and validates them against the passport:
  • passport.permissions.tools[] — allowlist (only these tools permitted)
  • passport.permissions.denied[] — denylist (these tools blocked)
  • toolCallAction'block' (remove denied calls) or 'warn' (pass through with warning)
  • onToolCallDenied — callback with details of denied tool calls
Supports OpenAI, Anthropic, and Google tool-call response formats.

Agent Passport

Create and manage Agent Passports.

Error Handling

Agent-specific errors: Permission, Budget, RateLimit, CircuitBreaker.