Skip to main content

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 ToolDef instances into PydanticAI's native Tool format via ToolScopeTranslator, enabling LLM-driven function invocation
  • Structured output — Pass a Pydantic model as response_model to get typed, validated responses directly from the LLM
  • Streaming — Iterate over response tokens as they arrive using PydanticAIProvider.stream()
  • Multi-turn agent loopsPydanticAI.run_agent_loop() executes iterative tool-calling workflows with configurable iteration limits
  • Conversation historyPydanticAI.run_with_history() continues conversations from prior message history
  • Auto-registration — Plugin hooks into APP_READY to resolve AIConfig, create the provider, and register both AI and PydanticAI types 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.
  • PydanticAIProviderAIProvider protocol implementation backed by PydanticAI and LiteLLM. Methods: complete(), run(), stream(), extract().
  • PydanticAI — Extended AI capability subclass with PydanticAI-specific methods: run_agent_loop() for multi-turn execution and run_with_history() for conversation continuation.
  • ToolScopeTranslator — Converts a list of functualize ToolDef instances into PydanticAI Tool objects using Tool.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

functualize_ai_pydantic-0.1.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

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

functualize_ai_pydantic-0.1.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

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

Hashes for functualize_ai_pydantic-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c3804f001a97ae757cf77d782b59673ce74f4889f2ac0ac94e441d63c4474dc0
MD5 41f48996271806b318bebd965af11887
BLAKE2b-256 be34780c24f0ea7d9e275250978e6fd31baf69a5d39ebcf6199911167b61a321

See more details on using hashes here.

File details

Details for the file functualize_ai_pydantic-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for functualize_ai_pydantic-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9211ba151bee7ce8b0aebdf119d5f602627db6cc8ec46c64a1acd4afa55ace40
MD5 d67edd38ef7e3220dee8444b2e6e8c95
BLAKE2b-256 eccbf97fafa4f492a791227b93e31bccf5e71228c32a6de90609983395765843

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