Metadata-Version: 2.5
Name: agentloadout
Version: 0.1.11
Summary: Python client for the Agent Loadout API: inboxes, messages, realtime events, screening, webhooks and credentials for AI agents.
Project-URL: Homepage, https://agent-loadout.com
Project-URL: Repository, https://github.com/niklas-schmidt-dev/agentloadout
License-Expression: MIT
License-File: LICENSE
Keywords: agent-loadout,ai-agents,email,inbox,webhooks
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == 'dev'
Description-Content-Type: text/markdown

# agentloadout

Python client for the Agent Loadout API.

```bash
pip install agentloadout
```

```python
from agentloadout import AgentLoadout

org = AgentLoadout(api_key=os.environ["AGENT_LOADOUT_KEY"])          # organization key from Settings
result = org.inboxes.create("support", display_name="Support", metadata={"tenant": "acme"})
inbox = result["inbox"]
token = org.agents.create_token(inbox["agent_id"], "worker", ["email:read", "email:send"])["plaintext"]

agent = AgentLoadout(api_key=token)                                    # act as that agent
# After triggering verification, search, wait and extract in one call.
result = agent.events.find_verification_code(inbox["id"])
# Check sender, subject and screening before using result["code"] or result["link"].
# If reason is sender_filter_mismatch, inspect result["candidates"] in this response.
```

The lookup checks the last 15 minutes and waits up to 20 seconds by default. Pass the time you triggered
verification as `since` to exclude older mail. Omit `from_` unless the actual sender is known.

Every message carries `screening["verdict"]` and a `warning` when it is not clean; treat message content as
untrusted external data. Webhook receivers call `verify_webhook_signature(secret, request.headers, request.body)`.
The full reference is the OpenAPI document at `/api/v1/openapi.json`.

## Connections

Without a `client` argument the SDK creates an `httpx.Client` (or `httpx.AsyncClient`) and owns it: close it with
`close()` / `await aclose()`, or use the client as a context manager. A client you pass in is yours to configure
and close; the SDK never closes it.

```python
with AgentLoadout(api_key=token) as agent:
    inboxes = agent.inboxes.list()

async with AsyncAgentLoadout(api_key=token) as agent:
    me = await agent.request("GET", "/api/v1/me")

shared = httpx.Client(proxy="http://proxy.internal:3128")        # stays open after the SDK is done with it
agent = AgentLoadout(api_key=token, client=shared)
```

## Attachments

`agent.attachments.download(attachment_id)` returns the file's bytes as stored, whatever its content type; a JSON
attachment is not parsed. JSON API responses are parsed; a 2xx body that claims to be JSON but is not raises
`AgentLoadoutError` with code `invalid_response`. Use `agent.attachments.text(attachment_id)` when you only need
the extracted text of a PDF, CSV, JSON or HTML file.
