Skip to main content

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

Development

Clone alongside openagp/spec (tests load fixtures and test vectors from a sibling checkout — CI clones both repos automatically):

git clone https://github.com/openagp/spec
git clone https://github.com/openagp/sdk-python
cd sdk-python
pip install -e ".[dev]"

Then:

pytest                  # run all tests, including the cross-language vectors
ruff check openagp tests  # lint
scripts/sync-schemas.sh   # pull canonical schemas from ../spec/schemas/

Bundled schemas under openagp/_schemas/ must stay in sync with ../spec/schemas/ — CI fails if they drift. Run scripts/sync-schemas.sh after pulling spec changes.

For cross-language sanity, also run the conformance suite locally:

cd ../cts && make vectors    # builds agp-cts + runs embedded test vectors

See CONTRIBUTING.md at the org level for DCO sign-off and PR conventions, and SUPPORT.md for where to ask questions or file bugs.

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.

Metadata

Release files for openagp 0.0.2

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

Source distribution (sdist)

Source distribution for openagp 0.0.2
File Size Uploaded
openagp-0.0.2.tar.gz 24.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openagp 0.0.2
File Interpreter ABI Platform
openagp-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 49.1 kB

Release files / openagp-0.0.2.tar.gz

Download URL openagp-0.0.2.tar.gz
Size 24.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f9a2b2e36874a5a55a82cfa7271118f19657d40d565616bf38831a9f2693dedb
BLAKE2b-256 checksum
How to use checksums
29e7550973885e1556871a4f293a2c693730674928995d601bbea9e31c8e308e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / openagp-0.0.2-py3-none-any.whl

Download URL openagp-0.0.2-py3-none-any.whl
Size 24.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
51451e6c20ae8747421bf4faf11c17adeb93308ecd04e91d728b493c81fa33d1
BLAKE2b-256 checksum
How to use checksums
985daed4bd4837a537179f5465dba972787fa0e65093a44acdfe4088b18cb2bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

0.0.0

2 release files

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