Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

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

Metadata

Release files for garl-protocol 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for garl-protocol 1.4.0
File Size Uploaded
garl_protocol-1.4.0.tar.gz 20.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for garl-protocol 1.4.0
File Interpreter ABI Platform
garl_protocol-1.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 40.8 kB

Release files / garl_protocol-1.4.0.tar.gz

Download URL garl_protocol-1.4.0.tar.gz
Size 20.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5dec1a14a4ad74c78b899e8b73986bc4f034d570e4078b38dd4f93a47928cc89
BLAKE2b-256 checksum
How to use checksums
78faed8d26a96eb212c5307fc2f51e217ce42f25652268a71fc1ce89ef8b6f45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.2

Release files / garl_protocol-1.4.0-py3-none-any.whl

Download URL garl_protocol-1.4.0-py3-none-any.whl
Size 20.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd4e0633e6113358d993b385d7d96c819e8d796811abc09bc9f932cb18f45e6c
BLAKE2b-256 checksum
How to use checksums
fc24f37e8a897df49c239c6221f6f9dc66f7e0d33f3b868603f87762a13c2c95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.2
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page