Metadata-Version: 2.4
Name: agentguardiam-sdk
Version: 0.2.1
Summary: Task-scoped MCP client for AgentGuardIAM staging
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: fastmcp==4.2.0

# 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.

```python
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+):

```python
gateway = AgentGuard("https://localhost:8443", os.environ["AGW_AGENT_KEY"], verify="caddy-root.crt")
```
