Metadata-Version: 2.4
Name: pine-assistant
Version: 0.1.1
Summary: Pine AI SDK — Let Pine AI handle your digital chores. Socket.IO + REST client.
Author: Pine AI
License-Expression: MIT
Project-URL: Homepage, https://github.com/19PINE-AI/pine-assistant-python
Project-URL: Repository, https://github.com/19PINE-AI/pine-assistant-python
Project-URL: Issues, https://github.com/19PINE-AI/pine-assistant-python/issues
Keywords: pine-assistant,pine,ai,customer-service,sdk,socketio
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: python-socketio[asyncio]>=5.11.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: pydantic>=2.0.0
Provides-Extra: cli
Requires-Dist: click>=8.1.0; extra == "cli"
Requires-Dist: rich>=13.0.0; extra == "cli"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
Requires-Dist: ruff>=0.4.0; extra == "dev"
Dynamic: license-file

# pine-assistant

[![PyPI version](https://img.shields.io/pypi/v/pine-assistant)](https://pypi.org/project/pine-assistant/)
[![Python versions](https://img.shields.io/pypi/pyversions/pine-assistant)](https://pypi.org/project/pine-assistant/)
[![license](https://img.shields.io/pypi/l/pine-assistant)](./LICENSE)

Pine AI SDK for Python. Let Pine AI handle your digital chores.

## Install

```bash
pip install pine-assistant          # SDK only
pip install pine-assistant[cli]     # SDK + CLI
```

## Quick Start (Async)

```python
from pine_assistant import AsyncPineAI

client = AsyncPineAI(access_token="...", user_id="...")
await client.connect()

session = await client.sessions.create()
await client.join_session(session["id"])

async for event in client.chat(session["id"], "Negotiate my Comcast bill"):
    print(event.type, event.data)

await client.disconnect()
```

## Quick Start (CLI)

```bash
pine auth login                          # Email verification
pine chat                                # Interactive REPL
pine send "Negotiate my Comcast bill"    # One-shot message
pine sessions list                       # List sessions
pine task start <session-id>             # Start task (Pro)
```

## Handling Events

Pine AI behaves like a human assistant. After you send a message, it sends
acknowledgments, then work logs, then the real response (form, text, or task_ready).
**Don't respond to acknowledgments** — only respond to forms, specific questions,
and task lifecycle events, or you'll create an infinite loop.

## Continuing Existing Sessions

```python
# List all sessions
result = await client.sessions.list(limit=20)

# Continue an existing session
await client.join_session(existing_session_id)
history = await client.get_history(existing_session_id)
async for event in client.chat(existing_session_id, "What is the status?"):
    ...
```

## Attachments

```python
# Upload a document for dispute tasks
attachments = await client.sessions.upload_attachment("bill.pdf")
```

## Stream Buffering

Text streaming is buffered internally. You receive one merged text event,
not individual chunks. Work log parts are debounced (3s silence).

## Payment

Pro subscription recommended. For non-subscribers:

```python
from pine_assistant import AsyncPineAI
print(f"Pay at: {AsyncPineAI.session_url(session_id)}")
```

## License

MIT
