Skip to main content

Marchward — Python SDK

Runtime authority for AI agents. Gate every tool call through a cost cap, approval gates on irreversible actions, and a tamper-evident audit log.

Python is the primary Marchward SDK — the wedge persona builds on LangGraph / LangChain (both Python). Zero runtime dependencies (stdlib only).

Install

pip install tenet-python

Quickstart

from tenet import TenetClient

tenet = TenetClient(api_key="tnt_...")   # or set TENET_API_KEY

decision = tenet.execute(
    service="github",
    tool_name="github.repos.delete",
    arguments={"owner": "acme", "repo": "old-experiment"},
    context={"env": "production"},
)

if decision.allowed:
    do_the_delete()
elif decision.escalated:
    print(f"Paused for approval — review {decision.review_id}")
elif decision.blocked:
    print(f"Blocked: {decision.reason_codes}")

With LangGraph (the persona's stack)

from langchain_core.tools import tool
from tenet import TenetClient

tenet = TenetClient()

@tool
def delete_repo(owner: str, repo: str) -> str:
    """Delete a GitHub repository."""
    d = tenet.execute(service="github", tool_name="github.repos.delete",
                      arguments={"owner": owner, "repo": repo})
    if not d.allowed:
        return f"Refused by Marchward ({d.outcome.value})."
    # ... real delete here ...
    return "deleted"

How it works (Model B)

You send a logical tool call — service + tool_name + arguments. Marchward resolves the real downstream HTTP request from its tool catalog, governs it, injects your stored credential server-side, and executes it. Your agent holds only TENET_API_KEY; it never touches downstream credentials. Connect those once in the dashboard (Settings → Connected services).

API

  • TenetClient(api_key=None, *, api_url=None, default_agent_id="python-sdk", timeout=30.0, poll_timeout=120.0, poll_interval=0.75)
  • .execute(*, service, tool_name, arguments=None, context=None, agent_id=None, request_id=None, wait=True) -> Decision
  • .get_job(job_id) -> dict — poll one async job manually (for wait=False).
  • Decision: .allowed / .escalated / .blocked / .executed, plus .outcome, .decision_id, .review_id, .reason_codes, .http_status, .raw, .job_id, .execution, .execution_error.

Contract

HTTP Outcome Meaning
200/202 + jobId ALLOW authorized; downstream runs async — the SDK polls the job and fills .execution (set wait=False to poll yourself)
202 + reviewId ESCALATE held for human approval; auto-executes on approve
403 BLOCK refused by policy
401 TenetAuthError (bad/missing/revoked key)

.executed is True only when an ALLOW actually ran its downstream — an ALLOW with no connected credential, a failed downstream, or a still-pending job is allowed-but-not-executed.

Risk classification

Risk is classified by the resolved HTTP method, not the tool name — any DELETE (or a flagged destructive POST like stripe.charges.create) is treated as irreversible and gated, regardless of what the tool is named. So a custom-named destructive tool can't slip past the approval gate.

Tests

cd packages/sdk-python && python -m unittest discover -s tests

Download files

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

Source Distribution

marchward-0.1.3.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

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

marchward-0.1.3-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file marchward-0.1.3.tar.gz.

File metadata

  • Download URL: marchward-0.1.3.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for marchward-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b2ebbef4ec5438ca5a16ec6b0a25af63fce839b931d0f5bd70c9ab3e870b842b
MD5 c6fd59d337ccac4507b3302ed1e8ef3a
BLAKE2b-256 a4a3b87e2186e8d6e02072ae97c0ffbe17219b3722348a075111d3e26b2a1fa5

See more details on using hashes here.

File details

Details for the file marchward-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: marchward-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for marchward-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 86425234a3ec63073485fecb67318c400b3cb1222247e5c0d18b2db5d53e1b93
MD5 5a275a16678000bea725d1533af7a4f2
BLAKE2b-256 f58f02d5134ab402f81dc18b437ab04f9efbbb78131a6bbdcded18a2972c4a4d

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.4

2 files

This release

0.1.3 This release

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

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