Skip to main content

Pydantic Chat

A local-first chat UI for your Pydantic AI agents.

uvx pydantic-work <module>:<agent variable>

# e.g. uvx pydantic-work chat.my_agent:agent

What is it?

Pydantic Chat provides a beautiful web interface for interacting with your Pydantic AI agents. Your agent runs locally on your machine, and the chat UI can be accessed either via localhost or through a secure remote URL.

Important: your messages never leave your machine and never touch the internet. Remote URLs are a convenience for you to run multiple agents on your machine without picking and keeping track of ports. Anyone visiting one of your URLs will get an empty chat window and a message like below ↓

image

Installation

# Run with uvx
uvx pydantic-work

# Or clone the repo and run locally
gh repo clone dsfaccini/ai-chat-ui
cd agent
uv run pydantic-work

Usage

# Or install with uv as a tool
uv tool install pydantic-work

# Basic usage
uvx pydantic-work module.path:agent_variable

# Example
pydantic-work chat.golden_gate_bridge:agent

# Localhost-only mode (skip remote registration)
pydantic-work --localhost chat.golden_gate_bridge:agent

# Custom port
pydantic-work --port 8000 chat.golden_gate_bridge:agent

How It Works

  1. Local Server: Your agent runs on your machine with a FastAPI server
  2. Remote Access (Optional): On first run, you'll be prompted to choose a project slug (e.g., my-project)
  3. Two URLs: Access your chat via:
    • Local: http://127.0.0.1:PORT
    • Remote: https://your-project.pydantic.work/ (if registered)

Your agent code and data never leave your machine. The remote URL just provides the frontend.

Note: The localhost UI is served via CDN (jsdelivr) at a pinned version, while the remote UI is served from the Cloudflare Worker and may be on a different version. Both UIs are compatible with the same backend API.

Example Agent

# src/my_agent.py
from pydantic_ai import Agent

agent = Agent(
    'anthropic:claude-sonnet-4-0',
    instructions="You are a helpful assistant."
)

@agent.tool_plain
def get_current_time() -> str:
    """Get the current time."""
    from datetime import datetime
    return datetime.now().strftime("%I:%M %p")

Run it:

pydantic-work chat.my_agent:agent

Configuration

On first run, Pydantic Chat creates .pydantic-work/config.json in your project directory with your slug, token, and port. This folder is automatically added to .gitignore.

Patterns

Multiple Projects

Each project directory gets its own config, so you can run multiple agents with different slugs:

cd project-a && pydantic-work agent:agent  # -> project-a.pydantic.work
cd project-b && pydantic-work agent:agent  # -> project-b.pydantic.work

Troubleshooting

Failed to load agent: Check that your module path is correct (module.path:variable_name).

Registration failed: The server will automatically fall back to localhost mode. Use --localhost to skip registration entirely.

Slug already taken: Choose a different slug when prompted. Slugs are globally unique.

Metadata

Release files for pydantic-work 0.1.11

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-work 0.1.11
File Size Uploaded Provenance
pydantic_work-0.1.11.tar.gz 15.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pydantic-work 0.1.11
File Interpreter ABI Platform
pydantic_work-0.1.11-py3-none-any.whl Python 3 none any Details

Total release size: 30.9 kB

Release files / pydantic_work-0.1.11.tar.gz

Download URL pydantic_work-0.1.11.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f790f1171a199a15ddc06c509f6386582e18c281596774b0aaf5f0105229b3c7
BLAKE2b-256 checksum
How to use checksums
5993d183a4e62fb180a6732d1ff14d18e3abfe98f6f7634526bdeb6a64aa98fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / pydantic_work-0.1.11-py3-none-any.whl

Download URL pydantic_work-0.1.11-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
65d3873e1b15e7aa552d5b3d6a13d6107e524f7296ee282bff6bddae10b1a344
BLAKE2b-256 checksum
How to use checksums
8725a195c52729fc4d4bc7bfec2fe458bbbc86a433ff04308e57a19236f15b2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Security for pydantic-work 0.1.11

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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