Metadata-Version: 2.4
Name: tryratify
Version: 0.1.0
Summary: Local authority enforcement client for Ratify
Author: Ratify contributors
License-Expression: Apache-2.0
Project-URL: Homepage, https://tryratify.com
Project-URL: Documentation, https://github.com/ratify-ai/ratify/tree/main/docs
Project-URL: Source, https://github.com/ratify-ai/ratify
Project-URL: Issues, https://github.com/ratify-ai/ratify/issues
Keywords: ai-agents,authority,approval,audit,policy
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests<3,>=2.32
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Dynamic: license-file

# Ratify

Ratify is an authority control plane for AI agents. You define which tool calls
an agent may execute autonomously, which require another principal's approval,
and which remain reserved.

Ratify Cloud owns Authority Grants, approvals, client identity, and uploaded
audit records. Ratify Client runs beside the agent, synchronizes versioned rules,
evaluates tool calls locally, and uploads audit batches asynchronously. Normal
tool evaluation does not require a per-call Cloud round trip.

See [Ratify v1 architecture](docs/architecture.md) for the lifecycle and stale
rules behavior.

Authority decisions use three terms:

- **Delegated**: the agent may execute the action.
- **Requires Approval**: execution waits for a Cloud reviewer.
- **Reserved**: the agent may not execute the action.

## Install

The Python distribution is `tryratify`; it installs the `ratify` command:

```bash
python -m pip install tryratify
ratify --help
```

Until the first PyPI release, install it from a source checkout:

```bash
git clone https://github.com/ratify-ai/ratify.git
cd ratify
python -m pip install .
go build -o ratify-sidecar ./cmd/sidecar
export RATIFY_CLIENT_BINARY="$PWD/ratify-sidecar"
```

The Python package contains the SDK and CLI. `ratify client start` also requires
the separately built or installed `ratify-sidecar` binary.

## Create an API key

Sign up at [tryratify.com/signup](https://tryratify.com/signup). Signup creates
an account, a default agent, and an API key. Copy the key when it appears; its
secret is shown only once.

For local development, start Ratify Cloud and use its signup page:

```bash
go run ./cmd/cloud -addr :8090 -data .ratify/cloud.json
```

Open [http://127.0.0.1:8090/signup](http://127.0.0.1:8090/signup). Additional
keys can be created or revoked from **API Keys**.

## Start Ratify Client

Use the Cloud URL, API key, and agent ID shown during onboarding:

```bash
ratify client start \
  --cloud-url https://tryratify.com \
  --api-key '<copied-key>' \
  --agent-id '<agent-id>' \
  --client-id client-local
```

For local Cloud, replace the Cloud URL with `http://127.0.0.1:8090`. The client
listens at `http://127.0.0.1:8088` by default. The Cloud **Clients** page shows
its heartbeat, current ruleset version, latest published version, account state,
and quota state.

## Publish an authority rule

Open **Authority Grants**, publish YAML using the exact fully qualified tool
names used by your agent, and wait for the client version to match the published
version:

```yaml
agent: <agent-id>

rules:
- name: Read public data
  tool: custom.read_data
  condition: true
  action: delegated

- name: Publish changes with review
  tool: custom.publish_changes
  condition: true
  action: requires_approval

- name: Keep destructive operations reserved
  tool: custom.destroy_system
  condition: true
  action: reserved
```

Rule actions are exactly `delegated`, `requires_approval`, and `reserved`.

## Run the first governed action

Wrap actual tool entrypoints with `Guard`. Use stable `namespace.action` names;
the same name must appear in the tool call and Authority Grants.

```python
from ratify_sdk import Guard


def read_data(item: str) -> dict[str, str]:
    return {"item": item, "value": "public"}


guard = Guard(
    agent_id="<agent-id>",
    sidecar_url="http://127.0.0.1:8088",
)
tools = guard.wrap({"custom.read_data": read_data})

result = tools.dispatch({
    "id": "call-1",
    "name": "custom.read_data",
    "input": {"item": "launch-status"},
})
```

A Delegated call executes locally. A Requires Approval call appears in Cloud
and resumes after review. A Reserved call is not executed. Each decision is
queued locally and uploaded to Cloud Audit.

## Development

```bash
go build ./...
go test ./...
python -m pip install -e '.[dev]'
python -m pytest sdk/python/tests
python -m build
```

The optional customer-support demonstration is isolated under
[`examples/demo`](examples/demo/README.md) and is not part of the Ratify product
runtime or Python distribution.

Ratify is licensed under the [Apache License 2.0](LICENSE).
