Grafana AI Observability Python Framework Module: Pydantic AI
sigil-sdk-pydantic-ai provides an AbstractCapability implementation that maps Pydantic AI lifecycle hooks into Sigil generation recorder lifecycles.
Installation
pip install sigil-sdk sigil-sdk-pydantic-ai
pip install pydantic-ai
Quickstart
from pydantic_ai import Agent
from sigil_sdk import Client
from sigil_sdk_pydantic_ai import create_sigil_pydantic_ai_capability
client = Client()
capability = create_sigil_pydantic_ai_capability(client=client, provider_resolver="auto")
agent = Agent("openai:gpt-4o", capabilities=[capability])
result = agent.run_sync("What is the weather?")
print(result.output)
client.shutdown()
End-to-end example (run + run_stream)
from pydantic_ai import Agent
from sigil_sdk import Client
from sigil_sdk_pydantic_ai import with_sigil_pydantic_ai_capability
client = Client()
capabilities = with_sigil_pydantic_ai_capability(
None,
client=client,
provider_resolver="auto",
agent_name="pydantic-ai-example",
agent_version="1.0.0",
)
agent = Agent("openai:gpt-4o-mini", capabilities=capabilities)
# Non-stream call -> SYNC generation mode.
result = agent.run_sync("Summarize why retry budgets matter.")
print(result.output)
# Stream call -> STREAM generation mode + TTFT tracking.
async def stream_example() -> None:
async with agent.run_stream("Give me three short reliability tips.") as stream:
async for chunk in stream.stream_text():
print(chunk, end="", flush=True)
print()
import asyncio
asyncio.run(stream_example())
client.shutdown()
Conversation mapping
Primary mapping is Pydantic AI run identity:
conversation_id/session_idfromctx.depsorctx.metadatathread_idfromctx.depsorctx.metadata- fallback
sigil:framework:pydantic-ai:<run_id>
Metadata and lineage
- Required:
sigil.framework.run_type - Optional:
sigil.framework.run_id,sigil.framework.parent_run_id,sigil.framework.thread_id,sigil.framework.event_id,sigil.framework.component_name,sigil.framework.retry_attempt
Provider resolver
Resolver order: explicit provider option -> callback payload -> model prefix inference -> custom.
Troubleshooting
- Provide stable
conversation_idviactx.depsorctx.metadatato avoid fragmented conversations. - If model aliases are custom, set explicit
provideron the handler. - Always call
client.shutdown()during teardown to flush buffered telemetry.
Metadata
Release files for sigil-sdk-pydantic-ai 0.9.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sigil_sdk_pydantic_ai-0.9.3.tar.gz | 13.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sigil_sdk_pydantic_ai-0.9.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.0 kB
Release files / sigil_sdk_pydantic_ai-0.9.3.tar.gz
| Download URL | sigil_sdk_pydantic_ai-0.9.3.tar.gz |
|---|---|
| Size | 13.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
93df3ce7c042f669387253363bdb352d8d0aad6354762857b1454719e3a82bf7
|
|
BLAKE2b-256 checksum How to use checksums |
7a73690e0b5ee592abcee9125d36a52e110d16eb29fa374d459b7d4d9502b7f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jul 13, 2026.
Transparency logRelease files / sigil_sdk_pydantic_ai-0.9.3-py3-none-any.whl
| Download URL | sigil_sdk_pydantic_ai-0.9.3-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f28e07cc997a56aaed279e804fbce1d3bf3f5b4e2b7e73d50a61429fc165827b
|
|
BLAKE2b-256 checksum How to use checksums |
5ab867bdbd04ca77faa5efe2d508edcf07d7462430112e0d0083715c679b58f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jul 13, 2026.
Transparency log