Multi-kernel Manager
Project description
Silik Kernel
This is a jupyter kernel that allows to interface with multiple kernels, you can:
-
start, stop and restart kernels,
-
switch between kernels,
-
list available kernels.
As a jupyter kernel, it takes text as input, transfer it to appropriate sub-kernel; and returns the result in a cell output. Silik kernel also forwards TAB completion from kernels, as well as multiline cells.
Any jupyter kernel can be plugged to silik
But managing multi-kernels seems to be a nightmare ?
Not with Agents and LLM. In order to allow users to easily manage multi-kernels, we present a way to access AI agents through jupyter kernels. To do so, we provide a wrapper of a pydantic-ai agent in a kernel. This allows to interact easily with these agents, through ipython for example, and let them manage the output of cells.
It also allows to share agents easily (with pypi for example); because they can be shipped in a python module. We split properly the agent and the interaction framework with the agent, by reusing the ones from jupyter kernels.
Getting started
pip install silik-kernel
The kernel is then installed on the current python venv.
Any jupyter frontend should be able to access the kernel, for example :
• Notebook (you might need to restart the IDE) : select 'silik' on top right of the notebook
• CLI : Install jupyter-console (pip install jupyter-console); and run jupyter console --kernel silik
• Silik Signal Messaging : Access the kernel through Signal Message Application.
To use diverse kernels through silik, you can install some example kernels : https://github.com/Tariqve/jupyter-kernels. You can also create new agent-based kernel by subclassing pydantic-ai base kernel.
You can list the available kernels by running
jupyter kernelspec listin a terminal.
Usage
Tuto
Start by running mkdir <kernel_type> --label=my-kernel with <kernel_type> among the installed kernels (send kernels to see which ones).
Then, you can run cd my-kernel and, run <code> to run one shot code in this kernel.
You can also run /cnct to avoid typing run. /cmd allows at any time to go back to command mode (navigation and creation of kernels).
Commands
Here is a quick reminder of available commands
• cd
• ls | tree : Displays the kernels tree
• mkdir <kernel_type> --label=<kernel_label> : starts a kernel (see 'kernels' command)
• run code | r code : run code on selected kernel - in one shot
• restart : restart the selected kernel
• branch <kernel_label> : branch the output of selected kernel to the input of one of its children. Output of parent kernel is now output of children kernel. (In -> Parent Kernel -> Children Kernel -> Out)
• detach : detach the branch starting from the selected kernel
• history : displays the cells input history for this kernel
• kernels : displays the list of available kernels types
• /cnct : direct connection towards selected kernel : cells will be directly executed on this kernel; except if cell content is '/cmd'
• /cmd : switch to command mode (default one) - exit /cnct mode
Recursive
You can start a silik kernel from a silik kernel. But you can only control the children-silik with 'run code'; and not directly /cmd or /cnct (because these two are catched before by the first silik). Here is an example :
You can hence implement your own sub-class of silik kernel, and add any method for spreading silik input to sub-kernels, and merging output of sub-kernels to produce silik output.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file silik_kernel-1.5.1.tar.gz.
File metadata
- Download URL: silik_kernel-1.5.1.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c3374ca60880e54eb0420fba3f4eef670efc78bff76a161cd0c9c3648611ec2
|
|
| MD5 |
21d475b2585200673bacd63f4ca975f7
|
|
| BLAKE2b-256 |
ab0f5de0f500e16ecde1e29e6bdd0eb767c9cb84f792f929f8c276b613110910
|