Skip to main content

Local authority enforcement client for Ratify

Project description

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 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:

python -m pip install tryratify
ratify --help

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

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. 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:

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

Open 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:

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:

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.

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

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 and is not part of the Ratify product runtime or Python distribution.

Ratify is licensed under the Apache License 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tryratify-0.1.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tryratify-0.1.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file tryratify-0.1.0.tar.gz.

File metadata

  • Download URL: tryratify-0.1.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for tryratify-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6a310efd90e70acac23887381730f121187c977b30ef67eb59aaa4ba0c692976
MD5 05bd3b15bcdd6a2cfc535b205aaab73e
BLAKE2b-256 5be3eba3307fcb1149a3ed861303a1307c9df71f165eb75b3b195e14654852f9

See more details on using hashes here.

File details

Details for the file tryratify-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tryratify-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for tryratify-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b21419600d78aee51d12b100f2b2d890cd8deacf540fa6dd0d146de6f0c3460
MD5 6fc1ae178c8b9ce748eedbc617dc7760
BLAKE2b-256 d6f733de98c6c96dbe8c45135af4fe9e86350436cf886191e5d2db24b0ac561e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page