Skip to main content

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 is agentctl. (Do not pip 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) -> Run with .record() / .record_action() (auto lineage)
  • hash_principal(user_id) -> str

Apache-2.0.

Metadata

Release files for agentctl-sdk 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentctl-sdk 0.1.1
File Size Uploaded Provenance Actions
agentctl_sdk-0.1.1.tar.gz 3.8 kB Without provenance Details for agentctl_sdk-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agentctl-sdk 0.1.1
File Interpreter ABI Platform Actions
agentctl_sdk-0.1.1-py3-none-any.whl Python 3 none any Details for agentctl_sdk-0.1.1-py3-none-any.whl

Total release size: 7.9 kB

Release files / agentctl_sdk-0.1.1.tar.gz

Download URL agentctl_sdk-0.1.1.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
07d435ba65488621059d3991daaeba5258c78e16919d6e25c13887a6a3f753a0
BLAKE2b-256 checksum
How to use checksums
28f8cc51ef5d15cbedc5ccd51543640d5db145b32b81ace66054e31303c18fb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / agentctl_sdk-0.1.1-py3-none-any.whl

Download URL agentctl_sdk-0.1.1-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c7fdb94a3039cbdda05f2f1bc2ea41d47ef7522a343be214c7d2898b877d7996
BLAKE2b-256 checksum
How to use checksums
5bc3c0c62cbbad62b07c0c2c9e8608444c5ca3e5146225f8e35f5bdf6e29505d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Security for agentctl-sdk 0.1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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