Skip to main content

A local-first chat UI for Pydantic AI agents

Project description

Pydantic Chat

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

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

# e.g. uvx pydantic-work src.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

# Install with uv
uv tool install pydantic-work

# Or install in development mode
cd agent
uv pip install -e ".[cli]"

Usage

# Basic usage
pydantic-work module.path:agent_variable

# Example
pydantic-work src.golden_gate_bridge:agent

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

# Custom port
pydantic-work --port 8000 src.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 src.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.

Links

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_work-0.1.10.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydantic_work-0.1.10-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file pydantic_work-0.1.10.tar.gz.

File metadata

  • Download URL: pydantic_work-0.1.10.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.12

File hashes

Hashes for pydantic_work-0.1.10.tar.gz
Algorithm Hash digest
SHA256 3d4fd9c3437280121e78dd7fcafa968798c1be02d0e0661d41d8e02bdd993f30
MD5 9966675e3452b86c539e7f1e0312ef1f
BLAKE2b-256 764315bdc5694762ea9c191a14da8f1875ebac601c7be1d0ab8c2da06c33bee1

See more details on using hashes here.

File details

Details for the file pydantic_work-0.1.10-py3-none-any.whl.

File metadata

File hashes

Hashes for pydantic_work-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 1223c5645c42fe32b5824ba2866d6ba4ca2f9fdb4a070694f5aeb53d78b1f3b0
MD5 f3d3a2bd9b2d67a8d9040ff8a591b0e9
BLAKE2b-256 8ecb4d5ac78772eeb39635d46ea9203aeb0ad06e4a4978478dd1d7de7d0d2912

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