npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ag-ui/pydantic-ai

v0.0.2

Published

Implementation of the AG-UI protocol for [Pydantic AI](https://ai.pydantic.dev/).

Readme

Pydantic AI

Implementation of the AG-UI protocol for Pydantic AI.

For more information on the Pydantic AI implementation see the Pydantic AI AG-UI docs.

Prerequisites

This example uses a Pydantic AI agent using an OpenAI model and the AG-UI dojo.

Running

To run this integration you need to:

  1. Clone the AG-UI repository

    git clone https://github.com/ag-ui-protocol/ag-ui.git
  2. Change into the integrations/pydantic-ai/python` directory

    cd integrations/pydantic-ai/python
  3. Install the pydantic-ai-examples package, for example:

    pip install pydantic-ai-examples

    or:

    uv venv
    uv pip install pydantic-ai-examples
  4. Run the example dojo server

    export OPENAI_API_KEY=<your api key>
    python -m pydantic_ai_examples.ag_ui

    or:

    export OPENAI_API_KEY=<your api key>
    uv run python -m pydantic_ai_examples.ag_ui
  5. Open another terminal in root directory of the ag-ui repository clone

  6. Start the integration ag-ui dojo:

    pnpm install && pnpm run dev
  7. Visit http://localhost:3000/pydantic-ai

  8. Select View Pydantic AI from the sidebar

Feature Examples

Agentic Chat

This demonstrates a basic agent interaction including Pydantic AI server side tools and AG-UI client side tools.

View the Agentic Chat example.

Agent Tools

  • time - Pydantic AI tool to check the current time for a time zone
  • background - AG-UI tool to set the background color of the client window

Agent Prompts

What is the time in New York?
Change the background to blue

A complex example which mixes both AG-UI and Pydantic AI tools:

Perform the following steps, waiting for the response of each step before continuing:
1. Get the time
2. Set the background to red
3. Get the time
4. Report how long the background set took by diffing the two times

Agentic Generative UI

Demonstrates a long running task where the agent sends updates to the frontend to let the user know what's happening.

View the Agentic Generative UI example.

Plan Prompts

Create a plan for breakfast and execute it

Human in the Loop

Demonstrates simple human in the loop workflow where the agent comes up with a plan and the user can approve it using checkboxes.

Task Planning Tools

  • generate_task_steps - AG-UI tool to generate and confirm steps

Task Planning Prompt

Generate a list of steps for cleaning a car for me to review

Predictive State Updates

Demonstrates how to use the predictive state updates feature to update the state of the UI based on agent responses, including user interaction via user confirmation.

View the Predictive State Updates example.

Story Tools

  • write_document - AG-UI tool to write the document to a window
  • document_predict_state - Pydantic AI tool that enables document state prediction for the write_document tool

This also shows how to use custom instructions based on shared state information.

Story Example

Starting document text

Bruce was a good dog,

Agent prompt

Help me complete my story about bruce the dog, is should be no longer than a sentence.

Shared State

Demonstrates how to use the shared state between the UI and the agent.

State sent to the agent is detected by a function based instruction. This then validates the data using a custom pydantic model before using to create the instructions for the agent to follow and send to the client using a AG-UI tool.

View the Shared State example.

Recipe Tools

  • display_recipe - AG-UI tool to display the recipe in a graphical format

Recipe Example

  1. Customise the basic settings of your recipe
  2. Click Improve with AI

Tool Based Generative UI

Demonstrates customised rendering for tool output with used confirmation.

View the Tool Based Generative UI example.

Haiku Tools

  • generate_haiku - AG-UI tool to display a haiku in English and Japanese

Haiku Prompt

Generate a haiku about formula 1