Metadata-Version: 2.4
Name: intent-base-sdk
Version: 0.4.0
Summary: intent-base Python SDK: launch isolated Profiles via the local Profile Service and drive them with Playwright over CDP.
License: MIT
Requires-Python: >=3.9
Requires-Dist: httpx>=0.27
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: respx>=0.21; extra == 'dev'
Requires-Dist: twine>=5; extra == 'dev'
Provides-Extra: playwright
Requires-Dist: playwright>=1.45; extra == 'playwright'
Description-Content-Type: text/markdown

# intent-base-sdk

Python SDK for [intent-base](https://github.com/YOUR_ORG/intent-base): launch an
isolated Profile through the local Profile Service and drive it with Playwright
over CDP. The SDK never launches Chromium itself — only the Profile Service
does.

## Install (PyPI)

Requires Profile Service running (default `http://127.0.0.1:17390`).

```bash
pip install intent-base-sdk==0.4.0
pip install "intent-base-sdk[playwright]==0.4.0"
playwright install chromium
```

The base package only needs `httpx`. Playwright is an optional extra.

## Configuration

| Option        | Default                     | Environment variable        |
| ------------- | --------------------------- | --------------------------- |
| `service_url` | `http://127.0.0.1:17390`    | `INTENT_BASE_SERVICE_URL`   |
| `timeout_ms`  | `30000`                     | `INTENT_BASE_TIMEOUT_MS`    |

## Sync usage

```python
from intent_base import launch_profile

result = launch_profile("profile_123")
result.page.goto("https://example.com")
print(result.page.title())
result.close()
```

Pass `auto_stop=True` to also stop the Profile on `close()`.

## Async usage

```python
import asyncio
from intent_base import launch_profile_async

async def main():
    result = await launch_profile_async("profile_123")
    await result.page.goto("https://example.com")
    print(await result.page.title())
    await result.aclose()

asyncio.run(main())
```

## Errors

```python
from intent_base import launch_profile, ProfileAlreadyRunningError, IntentBaseError

try:
    result = launch_profile("profile_123")
except ProfileAlreadyRunningError as err:
    print("already running:", err.code)
except IntentBaseError as err:
    print(err.code, err.message, err.status)
```

## Monorepo development

```bash
pip install -e "sdks/python[dev,playwright]"
python -m pytest sdks/python/tests
```

See [docs/PUBLISH.md](../../docs/PUBLISH.md) for PyPI release steps.
