Metadata-Version: 2.4
Name: straleio
Version: 0.1.3
Summary: Python SDK for the Strale API — let AI agents buy capabilities at runtime
Author-email: Strale <hello@strale.io>
License: MIT
Project-URL: Homepage, https://strale.dev
Project-URL: Repository, https://github.com/strale-io/strale
Project-URL: Documentation, https://strale.dev/docs
Keywords: strale,ai,agent,capabilities,api,sdk
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.24.0

# straleio

Python SDK for the [Strale](https://strale.dev) API — let AI agents buy and execute capabilities at runtime.

## Install

```bash
pip install straleio
```

## Quick start

```python
from straleio import Strale

strale = Strale(api_key="sk_live_...")

result = strale.do(task="validate VAT number SE556703748501")

print(result.output)
# {"valid": True, "country_code": "SE", "company_name": "Spotify AB"}
```

## Execute by slug

```python
result = strale.do(
    capability_slug="vat-validate",
    inputs={"vat_number": "SE556703748501"},
    max_price_cents=10,
)
```

## Dry run (preview cost without executing)

```python
preview = strale.dry_run(task="look up Swedish company Klarna")

print(preview.matched_capability)  # "swedish-company-data"
print(preview.price_cents)         # 80
```

## Async support

```python
import asyncio
from straleio import Strale

async def main():
    strale = Strale(api_key="sk_live_...")
    result = await strale.do_async(task="validate VAT number SE556703748501")
    print(result.output)

asyncio.run(main())
```

## Check balance

```python
balance = strale.get_balance()
print(balance.balance_eur)  # "1.84"
```

## List capabilities

```python
capabilities = strale.list_capabilities()
# 250+ capabilities with slug, name, price, category
```

## Free-tier (no API key)

5 capabilities work without authentication:

```python
strale = Strale(api_key="")

result = strale.do(
    capability_slug="email-validate",
    inputs={"email": "hello@example.com"},
)
```

## Options

```python
strale = Strale(
    api_key="sk_live_...",
    base_url="https://api.strale.io",  # default
    timeout=60.0,                       # seconds, default 60
    default_max_price_cents=200,        # cap per call, default €2.00
)
```

## Error handling

```python
from straleio import Strale, StraleError

try:
    result = strale.do(task="...")
except StraleError as e:
    print(e.code)     # "insufficient_balance" | "no_matching_capability" | ...
    print(e.message)
```

---

## Try for Free

5 capabilities work without an API key or signup:

- `email-validate` — verify email deliverability
- `dns-lookup` — DNS record lookup
- `json-repair` — fix malformed JSON
- `url-to-markdown` — convert any URL to markdown
- `iban-validate` — validate international bank account numbers

For all 250+ capabilities, [sign up](https://strale.dev/signup) for €2 in free trial credits.

## Resources

- 📖 [Documentation](https://strale.dev/docs)
- 💡 [Examples](https://github.com/strale-io/strale-examples) — copy-paste examples for every integration
- 💰 [Pricing](https://strale.dev/pricing)
- 🔍 [Quality methodology](https://strale.dev/methodology)
- 🔒 [Security](https://strale.dev/security)

## License

MIT — see [LICENSE](../../LICENSE)
