Skip to main content

Reference Python SDK for the Agent Governance Protocol (AGP)

Project description

openagp/sdk-python

Reference Python SDK for AGP — vendor-side and plane-side.

PyPI License Spec

Install

pip install openagp

Python 3.10+. Runtime depends on cryptography, rfc8785, jsonschema, referencing.

Quick start

from openagp import generate_keypair, sign, verify, InvalidSignature

# vendor side
keys = generate_keypair()

event = {
    "agp_version": "0.1",
    "schema_version": "1.0",
    "event_id": "evt_01JFXY8B5Z9RHQXM3WTNPK4VG2",
    "occurred_at": "2026-08-12T14:23:11.412Z",
    "actor": {
        "vendor": "yourcompany.com",
        "agent_id": "agt_42",
    },
    "action": {
        "type": "tool_call",
        "tool_name": "browser.navigate",
    },
}

signed = sign(event, private_key_b64=keys.private_key_b64, key_id="yourcompany-2026-q2")

# plane side
verify(signed, public_key_b64=keys.public_key_b64)   # raises InvalidSignature on tamper

What the SDK does (and doesn't)

Implements — per ADR 0001:

  • RFC 8785 JCS canonicalization
  • Ed25519 sign / verify
  • JSON Schema validation against bundled v0.1 schemas (Draft 2020-12)
  • Tamper detection via signature
  • Algorithm-substitution rejection (only Ed25519 is accepted)

Does NOT implement yet (Phase 1+):

  • HTTP client / server scaffolds (FastAPI vendor + plane apps)
  • Policy DSL evaluation
  • Real-time decision callback (Flow C)
  • Registry resolution and key rotation
  • Replay-cache / event_id deduplication

Schemas

The SDK ships a bundled copy of every AGP JSON Schema under openagp/_schemas/. These are kept in lockstep with the canonical schemas in openagp/spec — CI fails if they drift. To sync after pulling the latest spec:

scripts/sync-schemas.sh

Tests

pip install -e ".[dev]"
pytest

Tests load fixtures from a sibling checkout of openagp/spec. CI clones both repos automatically.

CLI

A small validator CLI ships with the SDK:

python -m openagp.tools.validate --kind event --instance path/to/event.json
python -m openagp.tools.validate --schema schemas/event.json --instance fixtures/events/01-tool-call-allowed.json

Status

Scaffold + Phase 0 sign/verify roundtrip. The full Phase 1 SDK is in progress (see §4.2 Phase 1 of the spec).

License

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

openagp-0.0.1.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

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

openagp-0.0.1-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file openagp-0.0.1.tar.gz.

File metadata

  • Download URL: openagp-0.0.1.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for openagp-0.0.1.tar.gz
Algorithm Hash digest
SHA256 bf33b5fce5e8a05818bf3ddf41748ad58f12b329d422bcf80d97f68f52f102df
MD5 a8da63ba3c8054d521da1821ce267cf9
BLAKE2b-256 b79f67952adb0a606c02a3c029a9f394c5cd5ba2a892beb53f0cd4c98365564d

See more details on using hashes here.

File details

Details for the file openagp-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: openagp-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 23.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for openagp-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f489118e42adff2e8d93fb831f2c37169290e11400051e8c5c74b35bad2983a5
MD5 caca041724eab1c15588b326ae8d07ed
BLAKE2b-256 d2bdd8a51833094c40299b73b09111f3e9c5f749948e7bc9c305bc907f7b6c6c

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