Metadata-Version: 2.4
Name: waken-openai
Version: 0.1.0
Summary: OpenAI Target adapter for Waken — routes waken Events to the OpenAI Responses API.
Project-URL: Homepage, https://github.com/WakenHQ/waken-openai
Project-URL: Repository, https://github.com/WakenHQ/waken-openai
Project-URL: Issues, https://github.com/WakenHQ/waken-openai/issues
Author: Waken contributors
License: MIT
License-File: LICENSE
Keywords: agents,ai,gpt,openai,waken
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.12
Requires-Dist: openai>=1.0.0
Requires-Dist: waken>=0.1.1
Provides-Extra: dev
Requires-Dist: mypy>=1.11; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest>=8.3; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Description-Content-Type: text/markdown

# waken-openai

[![CI](https://github.com/WakenHQ/waken-openai/actions/workflows/ci.yml/badge.svg)](https://github.com/WakenHQ/waken-openai/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-lightgrey)](https://github.com/WakenHQ/waken-openai/blob/main/LICENSE)

OpenAI Target adapter for [Waken](https://github.com/WakenHQ/waken) — "nginx
for AI agents." Routes a waken `Event` to the
[OpenAI Responses API](https://platform.openai.com/docs/api-reference/responses)
and returns a `Response`.

## Install

```bash
pip install waken-openai
```

`OPENAI_API_KEY` must be set in the environment — that's the `openai` SDK's
own convention, nothing waken-specific.

## Usage

```python
from waken import Runtime
from waken_openai import OpenAIAdapter

runtime = Runtime()
runtime.target("openai", OpenAIAdapter())
runtime.run()
```

```bash
waken send openai "Build tic tac toe." --wait
```

`OpenAIAdapter` keeps a `waken session_id -> OpenAI response id` map
internally, so a multi-turn conversation (same `event.session_id` across
calls) resumes via the Responses API's own `previous_response_id` — its
native server-side continuation mechanism — instead of starting over each
turn. Pass a model or extra client options at construction time:

```python
runtime.target("openai", OpenAIAdapter(model="gpt-4o", organization="org-..."))
```

`model` defaults to `"gpt-4.1"`. Any other keyword argument is forwarded
straight to `AsyncOpenAI(...)` (`api_key`, `organization`, `base_url`, ...).

## Development

```bash
git clone https://github.com/WakenHQ/waken-openai
cd waken-openai
pip install -e ".[dev]"
pytest
```

Tests mock `openai.AsyncOpenAI` entirely — no API key or network access
needed to run the suite.

## License

[MIT](https://github.com/WakenHQ/waken-openai/blob/main/LICENSE)
