Skip to main content

Base kernel for pydantic-ai kernels

Project description

Pydantic AI Kernel

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, ...)

Getting started

Within a python venv,

pip install pydantic-ai-kernel

Any 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_ai

In the kernel, send :

%config

to create the config file, and start chat. See documentation for more informations.

%help <magic_name> and %magic will give you appropriate documentation

Troubleshooting

TAB completion for magic can be broken with older metakernel versions (before 1.0.4). To fix it, install the earlier version :

uv add "metakernel @ git+https://github.com/Calysto/metakernel.git@afd3ddd"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydantic_ai_kernel-1.4.0.tar.gz (26.2 kB view details)

Uploaded Source

File details

Details for the file pydantic_ai_kernel-1.4.0.tar.gz.

File metadata

  • Download URL: pydantic_ai_kernel-1.4.0.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for pydantic_ai_kernel-1.4.0.tar.gz
Algorithm Hash digest
SHA256 e9aa4ce652f4f814b2802bee5f071d898d82e7f0321ad83f55d752cef552da7e
MD5 1de94260cb03baaa82e414dd8eee4e1e
BLAKE2b-256 259a9450374cfe3557b7ca20d3d69b22f6ccc762c273e2a9aad6c4b291746b86

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page