You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: kai/python-client.md
+61Lines changed: 61 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -208,6 +208,67 @@ async with KaiClient(
208
208
print(f"API error: {e.code} - {e.message}")
209
209
```
210
210
211
+
## Use Cases
212
+
213
+
### Kai via CLI with Claude Code
214
+
215
+
The [kai-cli plugin](https://github.com/keboola/kai-client/tree/main/plugins/kai-cli) lets AI coding assistants like [Claude Code](https://claude.com/claude-code) interact with your Keboola project through the Kai CLI. Install the plugin to give Claude the ability to query data, manage configurations, run jobs, and troubleshoot issues — all through natural language in your terminal.
216
+
217
+
#### Installation
218
+
219
+
Download the plugin to your Claude Code plugins directory:
Once installed, ask Claude to "use kai" or "help me with kai cli" to activate the skill. Claude can then run `kai chat`, `kai history`, `kai ping`, and other CLI commands on your behalf.
236
+
237
+
### Integrating Kai into Data Apps
238
+
239
+
The Kai Python Client can be embedded into Keboola [Data Apps](/data-apps/) to provide AI-powered chat interfaces for your end users.
240
+
241
+
#### Streamlit Data Apps
242
+
243
+
The [kai-streamlit plugin](https://github.com/keboola/kai-client/tree/main/plugins/kai-streamlit) provides patterns and working code for building [Streamlit Data Apps](/data-apps/streamlit/) with an integrated Kai chat interface. It handles the async bridge between Streamlit's synchronous model and the KaiClient's async API, streaming responses into Streamlit containers, tool approval flows with interactive Approve/Deny buttons, and session state management across Streamlit reruns.
244
+
245
+
To get started, install the dependencies:
246
+
247
+
```bash
248
+
pip install kai-client streamlit
249
+
```
250
+
251
+
Then use the `run_async` bridge pattern to call KaiClient from Streamlit:
252
+
253
+
```python
254
+
import asyncio
255
+
from kai_client import KaiClient
256
+
257
+
defrun_async(coro):
258
+
"""Run an async coroutine from sync Streamlit code."""
259
+
loop = asyncio.new_event_loop()
260
+
try:
261
+
return loop.run_until_complete(coro)
262
+
finally:
263
+
loop.close()
264
+
```
265
+
266
+
See the [plugin repository](https://github.com/keboola/kai-client/tree/main/plugins/kai-streamlit) for a complete working example with streaming, tool approval, and suggested action buttons.
267
+
268
+
#### Python/JS Data Apps
269
+
270
+
Support for integrating Kai into [Python/JS Data Apps](/data-apps/python-js/) is coming soon. A dedicated plugin will be available to simplify embedding Kai chat into custom Python and JavaScript-based data applications.
0 commit comments