Metadata-Version: 2.4
Name: tide-runtime
Version: 0.2.9
Summary: Tide runtime policy, approvals, and earned-use ledger for AI agent tools.
Project-URL: Repository, https://github.com/rippletideco/rippletide-package
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# Tide Runtime SDK

Python SDK for wrapping production agent tools with Tide policy, approvals, and
earned-use logging.

```bash
pip install tide-runtime
tide run
```

`tide run` scans the repo, lets you pick a starter pack, shows each risky tool, and writes
the wrappers plus `.tide/ledger/policy.json` in one terminal flow. For a non-interactive
install, use `tide run --pack support-refunds --yes`.

`tide init --dry-run --pack <name>` prints the policy before writing it.
Built-in packs: `baseline`, `support-refunds`, `sql-analyst`, `mcp-baseline`.

To have Tide suggest wrappers for an existing Python agent:

```bash
tide scan --path . --pack support-refunds
$EDITOR .tide/tide-plan.json
tide apply --interactive --write-policy
```

`--interactive` shows each proposed tool wrapper with its file, function, inferred tool name,
risk class, captured fields, and runtime decision. Press enter to accept the suggested
decision, or type `allow`, `log`, `escalate`, or `deny` (`block`) to write an explicit
per-tool policy override. Use `tide apply --yes --write-policy` to accept the reviewed plan
non-interactively.

```python
from tide import configure, controlled_tool, record_outcome

configure(agent_id="crm-agent", workflow_id="lead-sync", environment="prod")

@controlled_tool(name="crm.update_lead", risk_class="internal_write", capture=["lead_id"])
def update_lead(lead_id, status):
    return {"lead_id": lead_id, "status": status}

try:
    update_lead("L-1", "qualified")
    record_outcome("success")
except Exception:
    record_outcome("failure")
    raise
```

Default files live in `.tide/ledger/`. Override with `TIDE_LEDGER_DIR` or
`configure(project="...")`.

```bash
tide approvals
tide approve <id>
tide deny <id> --reason "not in scope"
tide report
```
