Skip to main content

Requirements

  • Python 3.9+
  • At least one supported provider SDK (OpenAI, Anthropic, or Google GenAI)

Install

Configure the runtime client

Client.from_env() reads ACTGUARD_CONFIG when present.
ACTGUARD_CONFIG accepts either:
  • Base64 JSON payload
  • Path to a JSON file
The JSON shape maps directly to Client(...) constructor fields, commonly:

Run + budget scope

Use client.run(...) as the runtime root, then client.budget_guard(...) for budget enforcement.
client.budget_guard(...) works locally, but reserve/settle-backed enforcement requires gateway_url + api_key on the client. Start here first, then layer tool decorators.

budget_guard vs decorators

  • budget_guard checks and enforces budget constraints before and during model execution.
  • Tool decorators (rate_limit, circuit_breaker, max_attempts, timeout, idempotent, prove, enforce, tool) guard tool invocation behavior and emit runtime events.

Runtime-scoped decorators

max_attempts and idempotent require an active client.run(...) context.

Chain-of-custody decorators

prove and enforce require actguard.session(...).

Examples from the repository

Reference implementations:
  • actguard/examples/10_langchain
  • actguard/examples/20_langgraph
  • actguard/examples/30_google_adk
  • actguard/examples/40_prove_enforce
All four use:
  • client = actguard.Client.from_env()
  • with client.run(...)
  • optional with client.budget_guard(...)