Metadata-Version: 2.4
Name: tracelock
Version: 0.1.0
Summary: Python SDK and tlock CLI for TraceLock deterministic tool-call replay
Project-URL: Homepage, https://tracelock-pied.vercel.app
Project-URL: Documentation, https://tracelock-pied.vercel.app/docs
Keywords: idempotency,ai-agents,tool-calls,replay,audit,llmops
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: httpx<1,>=0.27
Requires-Dist: cryptography<51,>=42

# TraceLock SDK

Guard side-effecting tool calls before they happen, then replay production traces offline.

```bash
pip install tracelock
export TRACELOCK_API_KEY="tlk_..."
```

For a local checkout, install with `pip install ./TraceLock/sdk`.

## One-line wrapper

```python
from tracelock import TraceLockClient, guard_call

client = TraceLockClient()

result = guard_call(
    client,
    "refund_user",
    {"user_id": "u_123", "amount": 50},
    lambda args: stripe.Refund.create(**args),
    idempotency_fields=["user_id", "amount"],
)
```

If TraceLock returns `replay`, `in_progress`, `awaiting_approval`, or `denied`, the
side effect is not executed. If it returns `execute`, the wrapper runs the call and
records the result/latency automatically.

## CLI

```bash
tlock --api-key "$TRACELOCK_API_KEY" guard \
  --tool refund_user \
  --args '{"user_id":"u_123","amount":50,"reason":"retry"}' \
  --fields user_id,amount

tlock result --guard-id g_... --result '{"refund_id":"rf_1"}'
tlock export --trace-id tr_... --out trace.json
tlock replay --file trace.json
tlock statement
```

`replay` is fully offline: it verifies the Ed25519 signature using the public key
embedded in the bundle (or `--public-key`) and never contacts a live API.

## Notes

- API key env: `TRACELOCK_API_KEY`
- Base URL env: `TRACELOCK_BASE_URL` (default `https://tracelock-pied.vercel.app`)
- `tlock verify` stores the API key in `.tlock_key`; add that file to `.gitignore`.
