Skip to main content

Overview

ActGuard exports these decorators and rule helpers:
  • @actguard.rate_limit
  • @actguard.circuit_breaker
  • @actguard.max_attempts
  • @actguard.timeout
  • @actguard.idempotent
  • @actguard.prove
  • @actguard.enforce
  • @actguard.tool(...)
  • actguard.RequireFact, actguard.Threshold, actguard.BlockRegex

Runtime requirements

  • max_attempts and idempotent require client.run(...)
  • prove and enforce require actguard.session(...)

@rate_limit

Sliding-window rate limiting for sync and async tools.

@circuit_breaker

FailureKind values:
  • TRANSPORT, TIMEOUT, OVERLOADED, THROTTLED
  • AUTH, INVALID, NOT_FOUND, CONFLICT, UNKNOWN
Preset constants:
  • FAIL_ON_DEFAULT
  • IGNORE_ON_DEFAULT
  • FAIL_ON_STRICT
  • FAIL_ON_INFRA_ONLY

@max_attempts

Caps per-tool attempts in the active run.

@timeout

Bounds tool runtime. On timeout, raises ToolTimeoutError.
Shuts down the shared timeout executor.

@idempotent

Requires an idempotency_key function argument and an active run context.

Chain-of-custody APIs

actguard.session(...)

Context manager for proof/enforcement state.

@prove

Mints verified facts from read-tool results.

@enforce

Evaluates rules before write-tool execution.

Rules

Unified decorator

Execution order: idempotent -> max_attempts -> circuit_breaker -> rate_limit -> timeout -> fn