functualize-ai-pydantic
Status: Published — Independently installable from PyPI.
PydanticAI-backed AI implementation plugin for functualize. Bridges the PydanticAI agent framework and LiteLLM model routing into functualize's AI capability system, providing tool calling, streaming, structured output, multi-turn agent loops, and conversation history continuation — all wired automatically via entry-point discovery.
Installation
pip install functualize-ai-pydantic
Quick Start
Once installed, the plugin registers itself via the functualize.ai_providers entry point. Configure it in your project config:
[ai]
provider = "pydantic"
model = "claude-sonnet-4-20250514"
Then use the AI capability in any functualize job:
from functualize_ai import AI, AIConfig
from functualize_ai_pydantic import PydanticAIProvider
config = AIConfig(model="claude-sonnet-4-20250514", max_tokens=1024)
provider = PydanticAIProvider(config)
result = provider.run("Summarize this document in 3 bullet points.")
print(result.output)
print(f"Tokens used: {result.usage.total_tokens}")
Features
- Tool calling — Translates functualize
ToolDefinstances into PydanticAI's nativeToolformat viaToolScopeTranslator, enabling LLM-driven function invocation - Structured output — Pass a Pydantic model as
response_modelto get typed, validated responses directly from the LLM - Streaming — Iterate over response tokens as they arrive using
PydanticAIProvider.stream() - Multi-turn agent loops —
PydanticAI.run_agent_loop()executes iterative tool-calling workflows with configurable iteration limits - Conversation history —
PydanticAI.run_with_history()continues conversations from prior message history - Auto-registration — Plugin hooks into
APP_READYto resolveAIConfig, create the provider, and register bothAIandPydanticAItypes with DI - Budget tracking — Integrates with functualize's state system for token usage and cost tracking across calls
API Reference
Public classes exported by this plugin:
PydanticAIPlugin— Entry-point plugin class that registers the provider with functualize's DI system at boot. Implements the plugin callable protocol.PydanticAIProvider—AIProviderprotocol implementation backed by PydanticAI and LiteLLM. Methods:complete(),run(),stream(),extract().PydanticAI— ExtendedAIcapability subclass with PydanticAI-specific methods:run_agent_loop()for multi-turn execution andrun_with_history()for conversation continuation.ToolScopeTranslator— Converts a list of functualizeToolDefinstances into PydanticAIToolobjects usingTool.from_schema().
Development
Run plugin tests:
uv run pytest plugins/functualize-ai-pydantic/tests/ -v
Lint and format:
uv run ruff check plugins/functualize-ai-pydantic/
uv run ruff format plugins/functualize-ai-pydantic/
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file functualize_ai_pydantic-0.1.0.tar.gz.
File metadata
- Download URL: functualize_ai_pydantic-0.1.0.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3804f001a97ae757cf77d782b59673ce74f4889f2ac0ac94e441d63c4474dc0
|
|
| MD5 |
41f48996271806b318bebd965af11887
|
|
| BLAKE2b-256 |
be34780c24f0ea7d9e275250978e6fd31baf69a5d39ebcf6199911167b61a321
|
File details
Details for the file functualize_ai_pydantic-0.1.0-py3-none-any.whl.
File metadata
- Download URL: functualize_ai_pydantic-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9211ba151bee7ce8b0aebdf119d5f602627db6cc8ec46c64a1acd4afa55ace40
|
|
| MD5 |
d67edd38ef7e3220dee8444b2e6e8c95
|
|
| BLAKE2b-256 |
eccbf97fafa4f492a791227b93e31bccf5e71228c32a6de90609983395765843
|