Metadata-Version: 2.5
Name: genkit-flask
Version: 0.13.0
Summary: Hang a Genkit flow on the Flask app you already have
Project-URL: Bug Tracker, https://github.com/genkit-ai/genkit/issues
Project-URL: Changelog, https://github.com/genkit-ai/genkit/releases
Project-URL: Documentation, https://genkit.dev/docs/get-started/?lang=python
Project-URL: Homepage, https://github.com/genkit-ai/genkit
Project-URL: Repository, https://github.com/genkit-ai/genkit/tree/main/py
Author: Google
Author-email: Yesudeep Mangalapilly <yesudeep@google.com>, Elisa Shen <mengqin@google.com>, Niraj Nepal <nnepal@google.com>
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: flask,genkit,streaming
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Environment :: Web Environment
Classifier: Framework :: AsyncIO
Classifier: Framework :: Flask
Classifier: Framework :: Pydantic
Classifier: Framework :: Pydantic :: 2
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
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: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: flask>=3.1.3
Requires-Dist: genkit<2,>=0.13.0
Requires-Dist: pydantic>=2.11
Description-Content-Type: text/markdown

# Genkit Flask Plugin

Expose Genkit flows as HTTP endpoints in a Flask application.

> **Building with a coding agent? Install the Genkit Python skill first.**
>
> ```bash
> npx skills add genkit-ai/skills --skill developing-genkit-python
> ```
>
> It teaches your agent the current Genkit Python APIs and common gotchas.
> Source, manual install and skills for other languages:
> [genkit-ai/skills](https://github.com/genkit-ai/skills).

## Installation

```bash
uv add genkit-flask genkit-google-genai
```

## Usage

```python
from flask import Flask
from genkit import Genkit
from genkit_flask import genkit_flask_handler
from genkit_google_genai import GoogleAI

app = Flask(__name__)
ai = Genkit(plugins=[GoogleAI()], model=GoogleAI.gemini('gemini-flash-latest'))


@app.post('/api/greet')
@genkit_flask_handler(ai)
@ai.flow()
async def greet_user(name: str) -> str:
    res = await ai.generate(prompt=f'Say hello to {name} in one sentence.')
    return res.text
```

The endpoint name defaults to the flow's name with dots replaced by underscores
(e.g., `greet_user`). To override the endpoint name or prevent clashes with an
existing view, pass `endpoint=` to the route decorator (e.g.,
`@app.post('/api/greet', endpoint='custom_greet')`).

Requires Flask 3.1+.
