Skip to main content
🔮
Pydantic AI+Stompy

Typed agents that read a record you keep

Strong types on the way in, a project record you own on the way through

The Problem

A Pydantic AI agent is typed, tested and predictable. Between runs it starts from whatever you put in its prompt and dependencies.

The decisions that shaped the project, and the reasons for them, are not in either place unless you put them there by hand.

How Stompy Helps

Stompy keeps those decisions in a project you own, and the agent reads them when it needs them.

There are two ways to connect. Pydantic AI can use remote MCP servers, so you can point it at https://mcp.stompy.ai/mcp and let it use the Stompy tools directly. Or you can register two ordinary functions that call the REST API, as below. The functions are the more explicit option, because you choose exactly which actions the agent can take.

Writing is a decision you make. A tool that locks should be one you expect the agent to call when you have asked it to keep something. The default write stores the entry immediately and compares it with what is already held afterwards, so the reply may name related entries. It does not silently drop a save as redundant.

Integration Walkthrough

1

Give the agent two plain functions

Two functions over the project's REST API, authenticated with a project API key. A project API key is minted by the project's owner while signed in, and works for that one project only. Read the project's own contexts and search with it; managing the project still needs a signed-in user.

import os
import httpx
BASE = "https://api.stompy.ai/api/v1/projects/my-project"
HEADERS = {"Authorization": f"Bearer {os.environ['STOMPY_PROJECT_KEY']}"}
def lock(topic: str, content: str) -> dict:
"""Keep a decision. Only called when the person asked for it."""
r = httpx.post(f"{BASE}/contexts", headers=HEADERS,
json={"topic": topic, "content": content})
r.raise_for_status()
return r.json()
def search(query: str) -> dict:
"""Find what the project already holds, by meaning."""
r = httpx.get(f"{BASE}/search", headers=HEADERS, params={"query": query})
r.raise_for_status()
return r.json()
2

Register them as tools

In Pydantic AI a plain function becomes a tool with the tool_plain decorator. Give the search tool to every agent, and the lock tool only to one you trust to write.

from pydantic_ai import Agent
agent = Agent(model) # whichever model you use
agent.tool_plain(search)
agent.tool_plain(lock)
3

Start from the brief

project_brief compiles the project's locked contexts and ticket summary into a short overview a new session can read. It is a summary of what you chose to keep, not a transcript.

project_brief(project="my-project")

What You Get

  • You choose which actions the agent can take: read only, or read and write
  • Entries are versioned; a changed mind is a new version, not an overwrite
  • Every save is compared with what is already held and related entries are named
  • The same project is readable from MCP, the stompy command and REST

Start your own record

Join the waitlist and we will tell you when your place is ready.