Metadata-Version: 2.4
Name: waken-gemini
Version: 0.1.0
Summary: Gemini Target adapter for Waken — routes waken Events to Google's google-genai SDK.
Project-URL: Homepage, https://github.com/WakenHQ/waken-gemini
Project-URL: Repository, https://github.com/WakenHQ/waken-gemini
Project-URL: Issues, https://github.com/WakenHQ/waken-gemini/issues
Author: Waken contributors
License: MIT
License-File: LICENSE
Keywords: agents,ai,gemini,google,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: google-genai>=1.0.0
Requires-Dist: waken>=0.1.0
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-gemini

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

A Gemini [`Target`](https://github.com/WakenHQ/waken) adapter for
[Waken](https://github.com/WakenHQ/waken) — "nginx for AI agents." Routes
waken `Event`s to Google's `google-genai` SDK and returns the result as a
waken `Response`.

## Install

```bash
pip install waken-gemini
```

## Usage

```python
from waken import Runtime
from waken_gemini import GeminiAdapter

runtime = Runtime()
runtime.target("gemini", GeminiAdapter())
runtime.run()
```

`GeminiAdapter` reads `GEMINI_API_KEY` from the environment — that's
`google-genai`'s own convention (see `genai.Client()`), nothing
waken-specific. Pass `api_key=...` (or any other `genai.Client` keyword) to
override:

```python
runtime.target("gemini", GeminiAdapter(model="gemini-2.5-pro", api_key="..."))
```

## Sessions

Gemini's SDK, unlike some other providers, has no server-side resumable
session id — the `google-genai` `Chat` object keeps conversation history
client-side, in process memory. So `GeminiAdapter` maps a waken `session_id`
to the SDK's `Chat` object itself (not a string id) and keeps reusing that
same object turn over turn. A practical consequence: conversation history for
a given waken session does not survive an adapter process restart, since
there is nothing server-side to resume from. An `Event` with no `session_id`
gets a fresh one-off `Chat` every call and is never stored.

## Development

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

Tests mock `google.genai.Client` entirely — no API key or network access
needed to run the suite.

## License

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