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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57a7bb67cc9911cfcf77e3648b5b427fa71d005d0f970a677dc602269ae8da26
|
|
| MD5 |
fd7773803fbb301c81d63d3065b95dd0
|
|
| BLAKE2b-256 |
47e0c5b2387d15b4c764d9ea5dcaf6b90599992d95b5f15de008e074eda4c99e
|
Provenance
The following attestation bundles were made for agentlock_sdk-0.4.0.tar.gz:
Publisher:
publish-sdk-python.yml on Olum289/agentlock
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentlock_sdk-0.4.0.tar.gz -
Subject digest:
57a7bb67cc9911cfcf77e3648b5b427fa71d005d0f970a677dc602269ae8da26 - Sigstore transparency entry: 2570686755
- Sigstore integration time:
-
Permalink:
Olum289/agentlock@4fd35d59059adb03c3af8f9726fcc82306949d42 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Olum289
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdk-python.yml@4fd35d59059adb03c3af8f9726fcc82306949d42 -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67de3dda122ea626e4195e99f066a6ef4593b8b8f8d30632baeed827583b6cac
|
|
| MD5 |
cef27a8226e8b3866eb550e8fb0f4fb7
|
|
| BLAKE2b-256 |
39a5216d09e9ecb9a6bbca4a8e5296838ae2e4fcc0e3b7f327f791c615061d2a
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentlock_sdk-0.4.0-py3-none-any.whl -
Subject digest:
67de3dda122ea626e4195e99f066a6ef4593b8b8f8d30632baeed827583b6cac - Sigstore transparency entry: 2570686867
- Sigstore integration time:
-
Permalink:
Olum289/agentlock@4fd35d59059adb03c3af8f9726fcc82306949d42 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Olum289
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdk-python.yml@4fd35d59059adb03c3af8f9726fcc82306949d42 -
Trigger Event:
workflow_dispatch
-
Statement type: