Skip to main content

GARL Protocol Python SDK — cryptographic verification for AI agent actions. Signed Action Receipts (v0.1), multi-dimensional Trust Vector, capability tokens (JWT-shaped + ECDSA-secp256k1 + Biscuit-style attenuation), UETA §10(b) undo. + garl-verify CLI. Starting with code.

Project description

garl — GARL Protocol Python SDK

Cryptographic verification for AI agent actions. Submit signed receipts, query Trust Vectors, and gate risky tool calls. Starting with code.

Install

pip install garl-protocol

Quick Start

import garl

garl.init("garl_your_api_key", "your-agent-uuid",
          base_url="https://api.garl.ai/api/v1")

# Log an action (non-blocking by default)
garl.log_action("Generated REST API", "success", category="coding")

Trust Gate

Check other agents before delegating work:

result = garl.is_trusted("target-agent-uuid", min_score=60)
if result["trusted"]:
    delegate_task(...)

Or use the decorator:

@garl.require_trust(min_score=60, mode="warn")
def delegate_task(target_agent_id, task):
    ...

Modes:

  • mode="warn" (default): Logs warning but executes the function
  • mode="block": Returns None if agent is not trusted

Full Client

from garl import GarlClient

client = GarlClient("garl_key", "agent-uuid",
                     base_url="https://api.garl.ai/api/v1")

cert = client.verify(status="success", task="Fixed bug", duration_ms=3200)
trust = client.check_trust("other-agent-uuid")
should = client.should_delegate("other-agent-uuid")

Wave 2 — capability tokens, action receipts, undo (v1.3.0)

# Multi-dimensional Trust Vector (replaces single trust_score for
# cross-domain decisions; null dimensions = "not yet measured")
vector = client.trust_vector()

# Capability Gate pre-flight: gets a token if allowed
gate = client.evaluate_action(
    action_type="payment",
    side_effect_class="reversible",
    spend_limit_usd=50.0,
    merchant_allowlist=["stripe.com"],
)
if gate["decision"] == "allowed":
    cap_token = gate["token"]   # JWT-shaped, ECDSA-secp256k1
    cap_hash  = gate["token_hash"]

# Submit a generic Action Receipt v0.1 (any tool call, not just commits)
import hashlib, json
def sha(o): return hashlib.sha256(
    json.dumps(o, sort_keys=True, separators=(",", ":")).encode()
).hexdigest()

env = client.submit_action_receipt(
    action_type="api_call",
    side_effect="reversible",
    input_hash=sha({"endpoint": "/v1/refunds", "charge": "ch_123"}),
    output_hash=sha({"refund_id": "re_456", "amount": 1000}),
    capability_token_hash=cap_hash,
    attestations=["human_reviewed"],
)

# UETA §10(b) consumer-undo
undo = client.undo_receipt(env["receipt_id"])
print(undo["undo_payload"])  # the action to actually run

# Revoke a token (cascades to attenuated children)
client.revoke_capability_token(cap_hash, reason="task-complete")

Async

from garl import AsyncGarlClient

client = AsyncGarlClient("garl_key", "agent-uuid",
                          base_url="https://api.garl.ai/api/v1")

cert = await client.verify(status="success", task="Analyzed data", duration_ms=5000)

Links

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

garl_protocol-1.3.1.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

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

garl_protocol-1.3.1-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file garl_protocol-1.3.1.tar.gz.

File metadata

  • Download URL: garl_protocol-1.3.1.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for garl_protocol-1.3.1.tar.gz
Algorithm Hash digest
SHA256 0097075bbcda36dac750b9a77ef4a3813648e87c63006e6abfc912614f670bcf
MD5 6481ba24eb3ae09bfcfeed7928c7f591
BLAKE2b-256 49992f2b944083dab7086f95657df906eed76001f04e702f2bd316ba6d87141e

See more details on using hashes here.

File details

Details for the file garl_protocol-1.3.1-py3-none-any.whl.

File metadata

  • Download URL: garl_protocol-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for garl_protocol-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d0bbe3286137331597248ad101f7de10819287821637a8a0a753ea667ca51d65
MD5 572bafe25681387f0984dd496a7c51e5
BLAKE2b-256 6fb9754994970edea6639202675e5e4661ea5ec9893dcfdd84750a731e4862a5

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