Metadata-Version: 2.5
Name: openintents
Version: 0.1.1
Summary: Python SDK for OpenIntents: let your agents buy anything
Project-URL: Homepage, https://openintents.io
Project-URL: Documentation, https://openintents.io/docs
Project-URL: Repository, https://github.com/tinyhumansai/openintents
Author: TinyHumans AI
License-Expression: GPL-3.0-or-later
License-File: LICENSE
Keywords: agentic,agents,openintents,payments,sdk
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx<1,>=0.27
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Description-Content-Type: text/markdown

# openintents (Python)

Python SDK for [OpenIntents](https://openintents.io): let your agents buy
anything. Send an intent in plain language and it gets bought end to end in a
real browser, paid, and resolved to a receipt. Inference, browser,
compute and bandwidth are free.

> Preview: the API is still being built, so it may change before launch.

```bash
pip install openintents
```

## Usage

```python
from openintents import OpenIntents

oi = OpenIntents()  # reads OPENINTENTS_API_KEY

intent = oi.intents.create(
    "flat white, oat milk, pickup 8:45 at the Blue Bottle on 5th",
    max_amount=1000,  # cents: never spend more than $10.00
)

intent = oi.intents.wait(intent["id"])  # returns when final, or when it needs payment

if intent["status"] == "requires_payment":
    print("Pay here:", intent["payment"]["payment_url"])
elif intent["status"] == "completed":
    receipt = intent["result"]
    print(receipt["merchant"], receipt["total"], receipt["confirmation"])
```

Async:

```python
from openintents import AsyncOpenIntents

async with AsyncOpenIntents() as oi:
    intent = await oi.intents.create("book an Uber to SFO at 7am", max_amount=6000)
    intent = await oi.intents.wait(intent["id"])
```

Also: `oi.intents.get(id)`, `oi.intents.list(status=..., limit=...)`,
`oi.intents.list_all()`, `oi.intents.cancel(id)` and `oi.balance.get()`.
Errors raise `OpenIntentsError` (`status`, `type`, `code`, `param`); 429s,
5xx and network errors are retried with backoff.

## Webhooks

```python
from openintents import verify_webhook, WebhookVerificationError

event = verify_webhook(request_body_bytes, request.headers.get("OpenIntents-Signature"), "whsec_...")
```

## Development

```bash
uv run --extra dev pytest
uv run --extra dev ruff check src tests
```

Docs: <https://openintents.io/docs>. License: GPL-3.0-or-later.
