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}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentlock_sdk-0.4.0.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

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

agentlock_sdk-0.4.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file agentlock_sdk-0.4.0.tar.gz.

File metadata

  • Download URL: agentlock_sdk-0.4.0.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for agentlock_sdk-0.4.0.tar.gz
Algorithm Hash digest
SHA256 57a7bb67cc9911cfcf77e3648b5b427fa71d005d0f970a677dc602269ae8da26
MD5 fd7773803fbb301c81d63d3065b95dd0
BLAKE2b-256 47e0c5b2387d15b4c764d9ea5dcaf6b90599992d95b5f15de008e074eda4c99e

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentlock_sdk-0.4.0.tar.gz:

Publisher: publish-sdk-python.yml on Olum289/agentlock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentlock_sdk-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: agentlock_sdk-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for agentlock_sdk-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 67de3dda122ea626e4195e99f066a6ef4593b8b8f8d30632baeed827583b6cac
MD5 cef27a8226e8b3866eb550e8fb0f4fb7
BLAKE2b-256 39a5216d09e9ecb9a6bbca4a8e5296838ae2e4fcc0e3b7f327f791c615061d2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentlock_sdk-0.4.0-py3-none-any.whl:

Publisher: publish-sdk-python.yml on Olum289/agentlock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 files

0.3.0

2 files

0.2.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page