Skip to main content

pydantic-ai-jupyter

Tests

Experiment with Pydantic AI Agents interactively in Jupyter notebooks.

Installation

pip install pydantic-ai-jupyter

Or with uv:

uv add pydantic-ai-jupyter

Usage

from pydantic_ai import Agent
from pydantic_ai_jupyter import run_in_jupyter

agent = Agent("openai:gpt-4o-mini")

@agent.tool_plain
def get_weather(city: str) -> str:
    return f"Sunny, 22°C in {city}"

# Run with rich display
result = await run_in_jupyter(agent, "What's the weather in Tokyo?")

Features

  • Streaming text - See the model's response as it generates
  • Streaming tool calls - Watch tool arguments stream in (with providers that support it, like OpenAI)
  • Tool results - Styled success and retry results
  • Thinking/reasoning - Collapsible display of model thinking
  • Error handling - Graceful display of exceptions with tracebacks

Multi-turn conversations

# First turn
result = await run_in_jupyter(agent, "What's the weather in Tokyo?")

# Continue the conversation
result = await run_in_jupyter(
    agent,
    "What about London?",
    message_history=result.all_messages(),
)

Debug mode

Enable debug mode to see all events:

result = await run_in_jupyter(agent, "Hello!", debug=True)

Supported providers

Tool call argument streaming works best with OpenAI, which streams arguments token-by-token. Other providers like Groq and Ollama (via OpenAI-compat) buffer tool calls and send them all at once.

Provider Text streaming Tool call streaming
OpenAI
Groq ❌ (buffered)
Ollama ❌ (buffered)

Development

See TESTING.md for testing guidelines and PUBLISHING.md for release instructions.

# Install dependencies
uv sync --extra dev

# Run tests
uv run pytest tests/ -v

# Run linting
uv run ruff check .
uv run ruff format .

# Type checking
uv run mypy pydantic_ai_jupyter/

License

BSD 3-Clause

Release files for pydantic-ai-jupyter 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydantic-ai-jupyter 0.1.2
File Size Uploaded
pydantic_ai_jupyter-0.1.2.tar.gz 281.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pydantic-ai-jupyter 0.1.2
File Interpreter ABI Platform
pydantic_ai_jupyter-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size:292.7 kB

Release files / pydantic_ai_jupyter-0.1.2.tar.gz

Download URL pydantic_ai_jupyter-0.1.2.tar.gz
Size 281.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d942b123e50357c92b64bf749cc1a4da60949d2d821d5fb40c03f5a0a41c6ac2
BLAKE2b-256 checksum
How to use checksums
a058ce29cc80fd3b60a8496cd68453c16549b0c009786408f84b7f34e2c5d8d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 26, 2026.

Transparency log

Release files / pydantic_ai_jupyter-0.1.2-py3-none-any.whl

Download URL pydantic_ai_jupyter-0.1.2-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
99fa25612bf75de578b985372fdffe8eccea7303b5ff750df063c67d53d522d3
BLAKE2b-256 checksum
How to use checksums
66a5773e2e510e714bbef05b24c9458da673cb6fc640f79b713d152088b6bfeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page