AgentLock Python SDK for AI agent integration
Project description
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}
Project details
Release history Release notifications | RSS feed
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.3.0.tar.gz
(18.5 kB
view details)
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.3.0.tar.gz.
File metadata
- Download URL: agentlock_sdk-0.3.0.tar.gz
- Upload date:
- Size: 18.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4757c7f012f85261b3e6dcf4fded4c5f23053ded66948a5632a8728116fa7b52
|
|
| MD5 |
eda78ee7e3377fea67b4f9ac51540326
|
|
| BLAKE2b-256 |
b35190af9a51bba85a4f1eae71e149df840242a18872067a564d346b793df61f
|
File details
Details for the file agentlock_sdk-0.3.0-py3-none-any.whl.
File metadata
- Download URL: agentlock_sdk-0.3.0-py3-none-any.whl
- Upload date:
- Size: 19.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71d8581875df7e35b17a0aaefcf30cf121d1de298780cb599093dbe69da0487e
|
|
| MD5 |
f5063a5525bc0ce0620d3daa36978e64
|
|
| BLAKE2b-256 |
ae64e3a8dbda6cb5fe00742f0fd1c27f5f86d112cc292ac821fc9a8b6a54938c
|