Skip to main content

agentlock-sdk (Python)

Python SDK for integrating AI agents with AgentLock.

Installation

# The [nacl] extra installs the Ed25519 signing backend — without it,
# generate_keypair() and every signed request raise ImportError.
pip install "agentlock-sdk[nacl]"
# or with poetry:
poetry add agentlock-sdk -E nacl

Quick Start

from agentlock import AgentLockClient, generate_keypair

# Generate once
keypair = generate_keypair()
print("Public key (register in dashboard):", keypair.public_key)

# Create client
client = AgentLockClient(
    base_url="https://your-agentlock.vercel.app",
    agent_id="your-agent-id",
    private_key=keypair.private_key,  # or load from env
)

# Request an action
result = client.request_action(
    action_type="write",
    tool="http",
    payload={
        "url": "https://httpbin.org/post",
        "method": "POST",
        "body": {"message": "Hello from Python!"},
    },
)

print(result.decision)  # ALLOW | REQUIRE_APPROVAL | BLOCK

if result.status == "PENDING":
    final = client.await_result(result.request_id)
    print(final)

SDK Implementation

See src/agentlock/client.py for the full implementation. Uses pynacl for Ed25519 signing.

SSH sessions

with client.ssh.open(credential_id="cred-1") as session:
    print(session.run("uname -a").stdout)
    print(session.run("uptime").stdout)
# auto-closes

Re-attach to an existing session:

sessions = client.ssh.list()
ops = next((s for s in sessions if s.host == "ops-prod-01"), None)
if ops:
    print(ops.run("tail -n 50 /var/log/nginx/access.log").stdout)

Browser snapshot

snap = client.browser_snapshot(session_id)
# {"html": ..., "url": ..., "title": ..., "screenshot": ... (optional)}

HTTP requests

res = client.http_request(
    method="POST",
    url="https://api.example.com/items",
    body={"name": "x"},
    credential_id="cred-api",
)
# {"status": 201, "headers": {...}, "body": {...}, "duration_ms": 42}

Release files for agentlock-sdk 0.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 agentlock-sdk 0.4.0
File Size Uploaded
agentlock_sdk-0.4.0.tar.gz 18.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentlock-sdk 0.4.0
File Interpreter ABI Platform
agentlock_sdk-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.3 kB

Release files / agentlock_sdk-0.4.0.tar.gz

Download URL agentlock_sdk-0.4.0.tar.gz
Size 18.9 kB
Tags Source
SHA-256 checksum
How to use checksums
57a7bb67cc9911cfcf77e3648b5b427fa71d005d0f970a677dc602269ae8da26
BLAKE2b-256 checksum
How to use checksums
47e0c5b2387d15b4c764d9ea5dcaf6b90599992d95b5f15de008e074eda4c99e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.

Transparency log

Release files / agentlock_sdk-0.4.0-py3-none-any.whl

Download URL agentlock_sdk-0.4.0-py3-none-any.whl
Size 19.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
67de3dda122ea626e4195e99f066a6ef4593b8b8f8d30632baeed827583b6cac
BLAKE2b-256 checksum
How to use checksums
39a5216d09e9ecb9a6bbca4a8e5296838ae2e4fcc0e3b7f327f791c615061d2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

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