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
Client(...) constructor fields, commonly:
Run + budget scope
Useclient.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_guardchecks 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_langchainactguard/examples/20_langgraphactguard/examples/30_google_adkactguard/examples/40_prove_enforce
client = actguard.Client.from_env()with client.run(...)- optional
with client.budget_guard(...)
