Skip to main content

pydantic-ai-toolkits

CI PyPI Downloads License Python

If you've used pydantic-ai, you already know the feeling: it's the first agent framework that feels like a regular Python library. Typed RunContext, a clean FunctionToolset protocol, model providers swapped behind one string. After a decade of frameworks that pretended to be Pythonic, this one actually is.

And then you sit down to wire up your agent, and realize: pydantic-ai will happily call any tool you give it — but the tools themselves are still on you. Want the agent to read a file? You write the sandbox. Run a SQL query? You write the read-only guard and the schema introspection. Search local documents? Text splitter, vector index, cosine math, persistence — all you.

After the third project where you wrote those by hand, the shape stops being interesting. This is them, written once:

pip install pydantic-ai-toolkits
from pydantic_ai import Agent
from pydantic_ai_toolkits import (
    FilesystemToolkit, SQLToolkit, PandasToolkit, MemoryToolkit, RAGToolkit,
)

agent = Agent(
    "openai:gpt-4o-mini",
    toolsets=[
        FilesystemToolkit(root="./workspace", read_only=False),
        SQLToolkit(dsn="postgresql://user:pwd@localhost/app"),
        PandasToolkit(),
        MemoryToolkit(storage_path="./memory.json"),
        RAGToolkit(embedder=my_embedder),
    ],
    system_prompt="You are a data assistant.",
)

print(agent.run_sync("Read README.md from the workspace and summarise it.").output)

That's the whole story. Five toolkits, one toolsets=[...], no new framework on top of pydantic-ai — each toolkit is a thin FunctionToolset subclass, exactly what pydantic-ai expects.


Install

pip install pydantic-ai-toolkits

The base install gives you FilesystemToolkit and MemoryToolkit (stdlib only). The rest are opt-in so you only pull in what you use:

pip install "pydantic-ai-toolkits[sql]"      # + SQLAlchemy
pip install "pydantic-ai-toolkits[pandas]"   # + pandas + pyarrow
pip install "pydantic-ai-toolkits[rag]"      # + numpy
pip install "pydantic-ai-toolkits[all]"      # everything

Extras are independent — picking up one doesn't pull in the others. Details: docs/INSTALL.md.


Toolkits

Toolkit What an agent can do with it Docs
FilesystemToolkit List, read, write, append, delete, mkdir, stat, glob — under one sandbox root, with path-escape rejection and an optional read-only mode. docs/FILESYSTEM.md
SQLToolkit List tables/views, describe schemas, run parameterised reads, optional execute for writes. Single-statement read-only by default. docs/SQL.md
PandasToolkit Manage a named dataframe registry; load CSV/Parquet; head / describe / schema / query / aggregate / value_counts. docs/PANDAS.md
MemoryToolkit Append/read/search messages; key-value scratchpad facts; optional atomic JSON persistence and per-namespace isolation. docs/MEMORY.md
RAGToolkit Recursive character text splitter + in-memory numpy vector index with cosine search and per-document delete. docs/RAG.md

Tiny snippets to taste each one:

# Filesystem — sandbox a workspace, then let the agent edit files
FilesystemToolkit(root="./workspace", read_only=False)

# SQL — read-only Postgres
SQLToolkit(dsn="postgresql://user:pwd@localhost/app")

# Pandas — start with an empty registry, agent loads CSVs as needed
PandasToolkit()

# Memory — persisted scratchpad, 200-message cap
MemoryToolkit(storage_path="./memory.json", max_messages=200)

# RAG — bring your own embedder
RAGToolkit(embedder=lambda texts: [embed(t) for t in texts])

Runnable end-to-end scripts live in examples/ (see docs/EXAMPLES.md).


What's not in here (and where to find it)

Before reaching for a toolkit here, check whether pydantic-ai already ships the capability you need — most of the time it does:

Need Use this
Web search pydantic_ai.common_tools.{duckduckgo, exa, tavily} or native_tools.WebSearchTool
Fetch a page and convert to Markdown pydantic_ai.common_tools.web_fetch.web_fetch_tool
Provider-side code execution / image gen pydantic_ai.native_tools.{CodeExecutionTool, ImageGenerationTool, FileSearchTool}
Provider-managed long-term memory pydantic_ai.native_tools.MemoryTool
Third-party MCP server (fs, postgres, …) pydantic_ai.mcp.MCPServerStdio / MCPServerHTTP

This package fills the gaps that aren't on that list — local sandboxed filesystem access, generic SQL via SQLAlchemy, in-memory dataframe ops, self-hosted conversation memory, and local RAG without an external vector DB.


Write your own toolkit

A toolkit is a BaseToolkit subclass whose public methods carry @tool:

from pydantic_ai_toolkits import BaseToolkit, tool


class WeatherToolkit(BaseToolkit):
    """Look up current weather for a configurable provider."""

    def __init__(self, api_key: str, units: str = "metric") -> None:
        self.api_key = api_key
        self.units = units
        super().__init__()          # MUST be last — scans @tool methods

    @tool
    def current_temperature(self, city: str) -> float:
        """Return the current temperature for `city` in the configured units."""
        ...

Full rules, schema-mapping table, and the contribution checklist: docs/WRITING.md, AGENTS.md.


Install from git (latest unreleased)

pip install git+https://github.com/wachawo/pydantic-ai-toolkits.git

Install from source (local development)

git clone git@github.com:wachawo/pydantic-ai-toolkits.git
cd pydantic-ai-toolkits
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[all]"
pip install -r requirements-dev.txt
pytest --cov          # 80% coverage gate

Documentation

Rendered with MkDocs at docs/:

If something's off — a missing convenience method, an awkward signature, a default that doesn't match your use case — the API is intentionally small. Open an issue on GitHub and say what you'd want instead.


License

MIT.

Metadata

Release files for pydantic-ai-toolkits 0.0.2

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-ai-toolkits 0.0.2
File Size Uploaded
pydantic_ai_toolkits-0.0.2.tar.gz 145.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pydantic-ai-toolkits 0.0.2
File Interpreter ABI Platform
pydantic_ai_toolkits-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 171.6 kB

Release files / pydantic_ai_toolkits-0.0.2.tar.gz

Download URL pydantic_ai_toolkits-0.0.2.tar.gz
Size 145.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fff0f9678663b790fa02207cf5706b7e2c7aec71167523ff9539e0b3547912ac
BLAKE2b-256 checksum
How to use checksums
c8f117dede6761b2d6508dbd1a70d25046fa66cb94347416154978a76076ac76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 18, 2026.

Transparency log

Release files / pydantic_ai_toolkits-0.0.2-py3-none-any.whl

Download URL pydantic_ai_toolkits-0.0.2-py3-none-any.whl
Size 25.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
539be4b3d819fda1f30e646f6619a62d27abb5e69b745adba7b1372fdc22abd0
BLAKE2b-256 checksum
How to use checksums
9cb6d5eb2f03c3f7343abc11d7aab9d1c7d97233e37137825ee51e55e7e97271
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

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