Python staging SDK
The SDK mints one task token for the requested tools, uses it as the MCP credential, and revokes it when the context exits. Every exchange is MCP: the agent key goes only to the task-token broker (/gw/broker/mcp) for minting, revocation and approval status, and tool calls go to the gateway (/gw/mcp) with the task token.
import os
from agentguard import AgentGuard
gateway = AgentGuard("http://localhost:8000", os.environ["AGW_AGENT_KEY"])
async with gateway.task("Read staging customer", ["crm_get_customer"], tenant_id="ten_A") as task:
customer = await task.call("crm_get_customer", {"tenant_id": "ten_A", "customer_id": "C-001"})
Install from the repository with python -m pip install ./sdk/python. Add wait_for_approval_s to a tool call to poll an approval and retry those exact arguments once after human approval. A hold without a wait budget raises Held. Rejections and expiration raise Denied. When ttl_s is omitted, the SDK requests the server's maximum so future approval waits can fit inside the task. Use an explicit shorter lifetime for tasks that finish quickly.
For a human-attributed task, pass user_id and the matching dashboard session token as user_token. The SDK forwards that token only on the broker's mint call.
A gateway behind a private CA (for example Caddy's local CA in a trial): pass the CA to the client, not through
SSL_CERT_FILE, which replaces the trust store of every HTTPS client in the process (0.2.1+):
gateway = AgentGuard("https://localhost:8443", os.environ["AGW_AGENT_KEY"], verify="caddy-root.crt")
Metadata
Release files for agentguardiam-sdk 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agentguardiam_sdk-0.2.1.tar.gz | 5.0 kB | Without provenance | Details for agentguardiam_sdk-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentguardiam_sdk-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for agentguardiam_sdk-0.2.1-py3-none-any.whl |
Total release size: 10.4 kB
Release files / agentguardiam_sdk-0.2.1.tar.gz
| Download URL | agentguardiam_sdk-0.2.1.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1085acdb65c004db65e4f6d33c968d98b26cb7f759f2da05baa2c90129badde6
|
|
BLAKE2b-256 checksum How to use checksums |
39d8dde6a7328ff2cffdb50308d8061a5f678637223dbcda1b6373e9ce33440a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.5
|
Release files / agentguardiam_sdk-0.2.1-py3-none-any.whl
| Download URL | agentguardiam_sdk-0.2.1-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
607139c6e701e8221cbfd0d29a010bac2dbfb80bcd230edd292222bdce37fff5
|
|
BLAKE2b-256 checksum How to use checksums |
c184df6fac90c0aa8093bf40a193de190bc151aa9c3d230c529c3868b2c9245a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.5
|
Security for agentguardiam-sdk 0.2.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.