Metadata-Version: 2.1
Name: raindrop-pydantic-ai
Version: 0.0.2
Summary: Raindrop integration for Pydantic AI
License: MIT
Author: Raindrop AI
Author-email: sdk@raindrop.ai
Requires-Python: >=3.10,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: pydantic-ai (>=0.1.0)
Requires-Dist: raindrop-ai (>=0.0.42)
Description-Content-Type: text/markdown

# raindrop-pydantic-ai

Raindrop integration for Pydantic AI. Automatically captures Agent `run()` and `run_sync()` calls including input, output, model name, and token usage.

## Installation

```bash
pip install raindrop-pydantic-ai pydantic-ai
```

## Usage

```python
from raindrop_pydantic_ai import create_raindrop_pydantic_ai
from pydantic_ai import Agent

raindrop = create_raindrop_pydantic_ai(
    api_key="rk_...",
    user_id="user-123",
)

agent = Agent("openai:gpt-4o", system_prompt="Be helpful")
wrapped = raindrop["wrap"](agent)

result = wrapped.run_sync("What is the capital of France?")
print(result.output)

raindrop["flush"]()
```

## What gets captured

- **Agent runs**: input prompt, output text (including structured output), model name
- **Token usage**: input_tokens and output_tokens from the result
- **Errors**: tracked and re-raised to the caller
- **Async support**: both `run()` (async) and `run_sync()` (sync) are instrumented

## Options

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `api_key` | `str` | required | Raindrop API key |
| `user_id` | `str` | `None` | Associate all events with a user |
| `convo_id` | `str` | `None` | Group events into a conversation |

## Testing

```bash
cd packages/pydantic-ai-python
pip install -e .
python -m pytest tests/ -v
```

