Official Python SDK for agentctl — sign, hash-chain, and govern every agent action. Zero dependencies.
Project description
agentctl (Python SDK)
Official Python SDK for agentctl — sign, hash-chain, and govern every action your AI agents take. The event format is the open AGP spec, so what you emit is portable and independently verifiable. Standard library only, no dependencies.
Install
pip install agentctl-sdk
The PyPI package is
agentctl-sdk; the import name isagentctl. (Do notpip install agentctl— that is an unrelated package.)
Quickstart
import os
from agentctl import Agentctl
ac = Agentctl("https://app.agentctl.io", os.environ["AGENTCTL_TOKEN"], default_vendor="openai")
ac.record_action(
agent_id="billing-bot",
tool="stripe.refund",
target="cus_9021",
decision="allowed",
)
Every call returns the signed, hash-chained record:
r = ac.record_action(agent_id="billing-bot", tool="email.send", target="x@acme.com")
# r["event_id"], r["prev_hash"], r["this_hash"], r["scf_controls"], r.get("duplicate")
Runs (lineage)
Group an agent's steps into one trace — events chain parent → child automatically:
run = ac.run() # or ac.run("trc_my_id")
run.record_action(agent_id="research-agent", type="session_open")
run.record_action(agent_id="research-agent", tool="web.search", target="market sizing")
run.record_action(agent_id="research-agent", tool="snowflake.query", target="prod.orders")
run.record_action(agent_id="research-agent", type="session_close")
Full event
from agentctl import hash_principal
ac.record({
"actor": {"agent_id": "claude-code", "vendor": "anthropic", "model": "claude-opus-4-8",
"framework": "claude-code", "human_principal": hash_principal("user@acme.com")},
"action": {"type": "tool_call", "tool_name": "bash", "target_resource": "cat .env"},
"policy": {"decision": "blocked", "rule_id": "rule_secret_file"},
})
hash_principal() SHA-256s a user id so you never store it in plaintext.
API
Agentctl(base_url, token, *, default_vendor="custom", timeout=10.0).record(event) -> dict.record_action(agent_id, *, tool=, target=, decision=, type=, vendor=, model=, framework=, principal=) -> dict.run(trace_id=None) -> Runwith.record()/.record_action()(auto lineage)hash_principal(user_id) -> str
Apache-2.0.
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
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 agentctl_sdk-0.1.1.tar.gz.
File metadata
- Download URL: agentctl_sdk-0.1.1.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07d435ba65488621059d3991daaeba5258c78e16919d6e25c13887a6a3f753a0
|
|
| MD5 |
5a1345a0b2d1db56a8e85fef5a1fff09
|
|
| BLAKE2b-256 |
28f8cc51ef5d15cbedc5ccd51543640d5db145b32b81ace66054e31303c18fb0
|
File details
Details for the file agentctl_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: agentctl_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7fdb94a3039cbdda05f2f1bc2ea41d47ef7522a343be214c7d2898b877d7996
|
|
| MD5 |
49f98ccc9ef5a5eee090c180c924c69b
|
|
| BLAKE2b-256 |
5bc3c0c62cbbad62b07c0c2c9e8608444c5ca3e5146225f8e35f5bdf6e29505d
|