> ## Documentation Index
> Fetch the complete documentation index at: https://docs.actguard.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Python SDK Overview

The ActGuard Python SDK gives you a runtime client that manages:

* Run-scoped execution context (`client.run(...)`)
* Budget reserve/settle scopes (`client.budget_guard(...)`)
* Tool guard decorators (`rate_limit`, `circuit_breaker`, `max_attempts`, `timeout`, `idempotent`, `prove`, `enforce`, `tool`)
* Optional event shipping to the ActGuard gateway

## Install

```bash theme={null}
pip install actguard
```

## Canonical runtime pattern

```python theme={null}
import actguard

client = actguard.Client.from_env()

with client.run(user_id="alice", run_id="req-123"):
    with client.budget_guard(usd_limit=0.05) as guard:
        # your agent + tool execution
        ...

print(guard.tokens_used, guard.usd_used)
```

This is the same pattern used by the framework demos in `actguard/examples`.

## Initialization options

* `actguard.Client.from_env()` reads `ACTGUARD_CONFIG` when set
* `actguard.Client.from_file("./actguard.json")` reads JSON config from disk
* `actguard.Client(...)` accepts explicit constructor args

`ACTGUARD_CONFIG` may be either:

* A base64-encoded JSON object
* A filesystem path to a JSON file

## Runtime scopes at a glance

* `client.run(...)`: required for runtime-scoped decorators like `max_attempts` and `idempotent`
* `client.budget_guard(...)`: budget tracking/enforcement scope bound to the active run
* `actguard.session(...)`: chain-of-custody scope used by `prove` and `enforce`

## Next steps

* [Getting started](/python-sdk/getting-started)
* [Core concepts](/python-sdk/concepts)
* [Tool guards](/python-sdk/tool-guards)
* [API reference](/python-sdk/api-reference)
* [OpenAI integration](/python-sdk/integrations/openai)
