This release is a pre-release and may not be stable for production use.
Kitaru PydanticAI adapter
Record and replay PydanticAI agent runs with Kitaru.
Install
uv add "kitaru-pydantic-ai[openai]"
Install kitaru-pydantic-ai without the extra when your project provides another PydanticAI model implementation.
Use
import uuid
from pydantic_ai import Agent
from kitaru_pydantic_ai import KitaruAgent
agent = KitaruAgent(
Agent("openai:gpt-5-nano"),
agent_id=uuid.UUID("018f0000-0000-7000-8000-000000000100"),
)
result = agent.run_sync("Hello")
print(result.output)
The adapter accepts the same run arguments as the wrapped PydanticAI agent. Kitaru workers provide task, replay, and authentication context through the standard task environment.
Model costs
The adapter estimates each completed LLM call's USD cost from its resolved model, provider, token usage, and request time. Pricing comes from the bundled genai-prices catalog. Unsupported models and providers leave the cost unset without failing the agent run. The recorded node attributes describe whether pricing was estimated or unavailable.
Supply cost_calculator for private models, negotiated rates, or provider billing rules. The callback receives a PydanticAIUsageSummary and returns a non-negative USD amount. A supplied callback takes priority over the bundled catalog.
from decimal import Decimal
from kitaru_pydantic_ai import KitaruAgent, PydanticAIUsageSummary
def calculate_cost(usage: PydanticAIUsageSummary) -> Decimal:
uncached_input = usage.input_tokens - usage.cached_input_tokens
return (
Decimal(uncached_input) * Decimal("0.000002")
+ Decimal(usage.cached_input_tokens) * Decimal("0.0000002")
+ Decimal(usage.output_tokens) * Decimal("0.000008")
)
agent = KitaruAgent(pydantic_agent, cost_calculator=calculate_cost)
Set estimate_costs=False when cost estimation should be disabled. This does not disable a supplied cost_calculator.
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 kitaru_pydantic_ai-0.1.0rc0.tar.gz.
File metadata
- Download URL: kitaru_pydantic_ai-0.1.0rc0.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
faa28dbdd035e266236ba9e7d376f3cd8498b30ef54555125bfa920c9c974f97
|
|
| MD5 |
463be4f3519d4cc65d49247ec5fea2f8
|
|
| BLAKE2b-256 |
5da60e37966dd09e7d5b3c5c73c20c3bf23824e2f5060008c3682b5756da0501
|
Provenance
The following attestation bundles were made for kitaru_pydantic_ai-0.1.0rc0.tar.gz:
Publisher:
release-plugins.yml on zenml-io/kitaru
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kitaru_pydantic_ai-0.1.0rc0.tar.gz -
Subject digest:
faa28dbdd035e266236ba9e7d376f3cd8498b30ef54555125bfa920c9c974f97 - Sigstore transparency entry: 2450520241
- Sigstore integration time:
-
Permalink:
zenml-io/kitaru@d52ef4fea75cded7a22ccb6512cda7529a7bff26 -
Branch / Tag:
refs/tags/python/kitaru-pydantic-ai/v0.1.0rc0 - Owner: https://github.com/zenml-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-plugins.yml@d52ef4fea75cded7a22ccb6512cda7529a7bff26 -
Trigger Event:
push
-
Statement type:
File details
Details for the file kitaru_pydantic_ai-0.1.0rc0-py3-none-any.whl.
File metadata
- Download URL: kitaru_pydantic_ai-0.1.0rc0-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8acf3d1d87e1d1b5ea110e7fa9ddf16300268f17095e7b91e548a428ccd0cfe1
|
|
| MD5 |
01d554983cea58961c648ba0c5657a8d
|
|
| BLAKE2b-256 |
596ebd9ab53389f8949c124a87fc231e73360938315995c8f0a118424c288901
|
Provenance
The following attestation bundles were made for kitaru_pydantic_ai-0.1.0rc0-py3-none-any.whl:
Publisher:
release-plugins.yml on zenml-io/kitaru
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kitaru_pydantic_ai-0.1.0rc0-py3-none-any.whl -
Subject digest:
8acf3d1d87e1d1b5ea110e7fa9ddf16300268f17095e7b91e548a428ccd0cfe1 - Sigstore transparency entry: 2450520818
- Sigstore integration time:
-
Permalink:
zenml-io/kitaru@d52ef4fea75cded7a22ccb6512cda7529a7bff26 -
Branch / Tag:
refs/tags/python/kitaru-pydantic-ai/v0.1.0rc0 - Owner: https://github.com/zenml-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-plugins.yml@d52ef4fea75cded7a22ccb6512cda7529a7bff26 -
Trigger Event:
push
-
Statement type: