This is wrapper around pydantic-ai agent, that allows to request it through jupyter kernel messaging protocol.
We support :
- streaming output,
- multi-type output (markdown, raw text), and soon : images, audio, jupyter widgets
- API's for accessing the agent :
- classical ZeroMQ jupyter kernel API
- web socket API, with jupyter kernel gateway
- user-approval (human in the loop) with input_request messages
- any pydantic-ai agent can be wrapped in this kernel
- basic configuration through metakernel magics (agent history, tool list, mcp server, output formatter, ...)
Documentation : https://mariusgarenaux.github.io/pydantic-ai-kernel
Within a python venv,
pip install pydantic-ai-kernelAny jupyter frontend should be able to dialog with this kernel, for example :
• CLI : Install jupyter-console (pip install jupyter-console); and run jupyter console --kernel pydantic_ai
• Notebook (you might need to restart the IDE) : select 'pydantic_ai' on top right of the notebook
• Jupyter Lab : see [Jupyter Lab]
• jpterm : a fancy jupyter lab interface, in the terminal ! https://davidbrochart.github.io/jpterm/
• euporie : a fancy kernel frontend : https://euporie.readthedocs.io/en/latest/pages/installation.html
• Silik Signal Messaging : Access the kernel through Signal Message Application, see here
For example :
jupyter console --kernel pydantic_aiIn the kernel, send :
%config
to create the config file, and start chat. See documentation for more informations.
%help <magic_name>and%magicwill give you appropriate documentation
TAB completion for magic can be broken with older metakernel versions (before 1.0.4). To fix it, install the 1.0.4 manually :
uv add "metakernel @ git+https://github.com/Calysto/metakernel.git@afd3ddd"or without uv:
git clone https://github.com/Calysto/metakernel
cd metakernel
git checkout afd3ddd
pip install -e .
cd ..