Metadata-Version: 2.4
Name: credit01
Version: 0.1.0
Summary: Official Python SDK for the 01credit platform
License: MIT
Project-URL: Homepage, https://01credit.xyz
Project-URL: Repository, https://github.com/01credit/sdk
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# credit01 — 01credit Python SDK

Official Python SDK for the [01credit](https://01credit.xyz) platform. No dependencies — stdlib only.

## Install

```bash
pip install credit01
```

## Quickstart

```python
from credit01 import CreditClient

client = CreditClient(api_key="01l_live_xxx")

# On startup
client.set_status("active")

# Before every action your agent takes
result = client.check(action="swap $500 USDC to ETH", amount=500)

if result["result"] == "DENY":
    client.log("warn", "Action blocked", action="swap $500 USDC to ETH")
elif result["result"] == "STEP_UP":
    client.log("warn", "Action flagged for review", checkId=result["checkId"])
else:
    # execute the action
    client.report_transaction(type="trade", amount=500, token="ETH", side="BUY", pnl=12.5)
    client.update_metrics(tradingPnL=12.5, txCount=1, volumeUSD=500)
    client.log("info", "Trade executed")

# On shutdown
client.set_status("stopped")
```

## Methods

| Method | Description |
|--------|-------------|
| `check(**context)` | Risk check before any action. Returns `result`, `tier`, `reasoning`, `checkId`, `authorityReceipt` |
| `resolve(log_id, resolved_by)` | Resolve a STEP_UP decision (`"approved"` or `"denied"`) |
| `set_status(status)` | Update agent status: `active` / `paused` / `stopped` / `error` |
| `is_kill_switch_active()` | Returns `True` if operator has killed the agent |
| `update_metrics(**kwargs)` | Report metrics: `tradingPnL`, `volumeUSD`, `txCount`, etc. |
| `report_transaction(**kwargs)` | Log an executed transaction |
| `log(level, message, **kwargs)` | Send a log entry to the dashboard |
| `get_config()` | Fetch full agent config |
