pydantic-ai-pixeltable
Give a Pydantic AI agent read access to your Pixeltable tables, and optionally keep its Harness Memory in the same catalog.
Pixeltable: read-only toolslist_tables,describe_table,query_table, andsimilarity_searchover tables and views you already have.PixeltableMemoryStore: a HarnessMemoryStore, used asMemory(store)in place ofFileStore.
Each works without the other. Requires Python 3.11+, pydantic-ai-slim 2.38+, pydantic-ai-harness 0.29.0+, and Pixeltable 0.7.8+.
Quick start
pip install pydantic-ai-pixeltable "pydantic-ai-slim[openai]"
import pixeltable as pxt
from pixeltable.functions.openai import embeddings
from pydantic_ai import Agent
from pydantic_ai_harness import Memory
from pydantic_ai_pixeltable import Pixeltable, PixeltableMemoryStore
handbook = pxt.create_table("handbook", {"topic": pxt.String, "text": pxt.String})
handbook.insert([{"topic": "expenses", "text": "Meals during business travel are reimbursed up to 60 EUR per day."}])
handbook.add_embedding_index("text", embedding=embeddings.using(model="text-embedding-3-small"))
agent = Agent(
"openai:gpt-5.6-sol",
capabilities=[
Pixeltable(["handbook"]), # list_tables, describe_table, query_table, similarity_search
Memory(PixeltableMemoryStore(table_name="memory")), # notes kept across runs
],
)
print(agent.run_sync("Can I expense a 75 EUR dinner? Remember that I travel monthly.").output)
# The answer cites the 60 EUR daily limit; the note lands in the memory table.
quickstart.py is the full runnable version: a two-run HR assistant whose second run answers from what the first one remembered. In an app, declare the table on a TableModel and create it with pxt schema update.
Catalog tools
tablesis a required allowlist of table paths or directory prefixes.["*"]allows the whole catalog, including a memory table. A view inside an allowed directory exposes its base table's columns. Version handles (tbl:3) are refused, since old versions keep deleted rows and dropped columns.similarity_searchneeds an embedding index on the column.query_tablefilters by equality only; timestamp, date, and UUID values are ISO strings.- Default columns skip media, array, binary, and unstored computed columns, which recompute on every read (possibly a model call) and also reject filters. A named media column returns a file URL.
max_rows(20) andmax_chars(8000) bound every result. An oversized string is cut to end in...and any other oversized value becomesnull; the{"table", "rows", "truncated"}envelope is always returned.- Two instances on one agent share
id="pixeltable"and merge by intersecting their allowlists; a disjoint merge raises. A capability passed to a single run replaces the agent's, so it can widen access. pydantic-ai-chdbregisters the samelist_tablesanddescribe_tablenames; wrap one inPrefixToolsto use both.- From a spec:
Agent.from_spec({"model": ..., "capabilities": [{"Pixeltable": ["handbook"]}]}, custom_capability_types=[Pixeltable]).
Memory store
- The table is created on first use. Each memory path is a
kind == "file"row, and operation receipts are__op__/rows, so the roots__op__and__meta__are reserved. Paths are at most 255 characters. - Writes are compare-and-set on a UUID version. The intent is journaled before the write, so a crash rolls forward on replay instead of applying twice.
store.tableis an ordinary table: query it, join it, or add an embedding index oncontent.search_memorystays lexical, as in every Harness store. A directt.updateis not a Memory write and leaves the version unchanged.- Pixeltable keeps every row version and receipts are never pruned, so the table grows with history.
- Python only: Harness YAML backends are
memory,file, andsqlite. The package emits no telemetry;memory.*spans come from HarnessMemory.
On Pixeltable 0.7.8 with embedded Postgres, 20k rows, laptop (pytest tests/test_stress.py -m expensive): list_paths and search take ~115 and ~125 ms with 18k files under the prefix, a contended CAS write ~5 ms per attempt, query_table ~10 ms, similarity_search ~8 ms. list_paths and search sort in Python because database ordering depends on collation, so they scale with the files under the prefix, not with the table.
Development
pip install -e ".[dev]"
pytest tests/ # add -m expensive for the 20k-row volume tests
ruff check . && ruff format --check . && mypy pydantic_ai_pixeltable
License
Apache 2.0
Metadata
Release files for pydantic-ai-pixeltable 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pydantic_ai_pixeltable-0.3.1.tar.gz | 36.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydantic_ai_pixeltable-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 59.9 kB
Release files / pydantic_ai_pixeltable-0.3.1.tar.gz
| Download URL | pydantic_ai_pixeltable-0.3.1.tar.gz |
|---|---|
| Size | 36.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
16bb7b9b0c5d6c279a044ac556a03537b78e3c44dd0640c03a68371cf7d9ec7d
|
|
BLAKE2b-256 checksum How to use checksums |
bf09870ff8d6e70785ea2ccf3ac18301970c55f94c4be8ee0dbe71627e54ecfd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 23, 2026.
Transparency logRelease files / pydantic_ai_pixeltable-0.3.1-py3-none-any.whl
| Download URL | pydantic_ai_pixeltable-0.3.1-py3-none-any.whl |
|---|---|
| Size | 23.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
84596da765ca86b628ba3a88a795d59082c9cb69b284fdfa4d4df73a432c1c88
|
|
BLAKE2b-256 checksum How to use checksums |
0c1b772e4adf3b37433e0d3fb3049fd537242ebb8481726459234d0c7062aa65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 23, 2026.
Transparency log