Skip to main content

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

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.

Project details


Download files

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

Source Distribution

agentctl_sdk-0.1.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

agentctl_sdk-0.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file agentctl_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: agentctl_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for agentctl_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 44bb9b2ee828b0ff15b15131e2c96384292ceaecedf2cb2673be812215487f08
MD5 6f615bc21a96403dd7d40da6c2444776
BLAKE2b-256 5dd4bc772b6c9d6bc3ed5379404010a854b1cc644c629c87d62836c6885bd2b9

See more details on using hashes here.

File details

Details for the file agentctl_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: agentctl_sdk-0.1.0-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

Hashes for agentctl_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57c051ff9aee2367e831126b74394bf2c8a2f1ae7e4f640353054b76f15129e7
MD5 abfe01a607d6a52b50d8f96b8731bf8d
BLAKE2b-256 26cc4e6b76878a6d4983beba02810db4dbef68f54f2dece96ae3afe4e288d017

See more details on using hashes here.

Supported by

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