pydantic-ai: Pydantic AI OpenTelemetry instrumentation: exception events on tool and agent run spans include content when `include_content=False`
What fixes it
- 1.107.6pydantic-ai, pipGitHub
- 2.44.0pydantic-ai, pipGitHub
- 1.107.6pydantic-ai-slim, pipGitHub
- 2.44.0pydantic-ai-slim, pipGitHub
- 1.107.6pydantic-ai, PyPIOSV
pip install "pydantic-ai>=1.107.6" - 2.44.0pydantic-ai, PyPIOSV
pip install "pydantic-ai>=2.44.0"
Show all 8 fixed versions
A fixed version on one release line is not the upgrade target for every line. Check your exact version and any vendor backports.
Description
Summary
Pydantic AI's OpenTelemetry instrumentation supports InstrumentationSettings(include_content=False) to exclude message content — user prompts, model completions, tool call arguments and responses, and any other message content — from exported telemetry, so that agents can be monitored without sending sensitive content to the observability backend.
The message attributes honoured the setting. Several other parts of the same spans did not, and exported content regardless of it:
- Exceptions. Recorded as OpenTelemetry exception events, with their message and stack trace, on tool, agent run, model request, embedding and image generation spans, and on realtime session spans. The message of the exception carrying a tool's
ModelRetryorToolFailedfeedback is the text sent back to the model, which can quote tool arguments and results. When a tool ran out of retries, the error that ended the run was chained from the last retry, so its stack trace repeated that text on the run span. Exceptions raised by tool code were recorded with their full message, as were failures of a model request, embedding or image generation, whose messages carry the provider's error response body. - The error status description. The OpenTelemetry SDK describes a span's ERROR status with the exception's type and message, so the message reached the backend a second time even where the event itself was redacted.
- Instructions and the prompted-output template. The
model_request_parametersattribute serialized the request's instruction parts in full, exporting the agent's instructions — both static and those built from dependencies at request time — along with the template used to prompt for structured output.
Details
Content reaches these places because of what they carry rather than through any single missing check, which is why the setting was applied correctly to the message attributes (gen_ai.input.messages, gen_ai.tool.call.arguments, gen_ai.tool.call.result, and so on) while these paths were not: the exception recording and the status description came from the OpenTelemetry SDK's defaults, and the instructions and output template were serialized as part of the request's parameters rather than treated as content.
Impact
This does not grant an attacker any new access to the agent or its data: the content is only visible to whoever can read the exported telemetry. The exposure matters when traces are exported to a destination whose audience is broader or less trusted than the agent's own data — a third-party observability vendor or a shared backend — which is the scenario include_content=False exists for.
Who Is Affected
You are affected if you enabled instrumentation with include_content=False. Instructions are exported on every successful run, so no failure is needed to be affected; the exception paths additionally require a tool to raise, or a model, embedding or image generation request to fail. Realtime sessions are affected the same way, through the errors their provider connections report. GHSA-3gh4-cghq-f8v4 stated that retries coming from tool calls were redacted correctly; that was true of the retry prompt in the message attributes but not of the exception event on the tool span. You are not affected if you don't set include_content=False.
Remediation
Upgrade to a patched version. With include_content=False, exception events now record only the exception type, error statuses carry no description, and model_request_parameters is exported without its instruction content or output template. If you rely on this setting, consider reviewing previously exported traces for exception events, for error status descriptions, and for model_request_parameters.
Workaround for Unpatched Versions
If you cannot upgrade, scrub the exception.message and exception.stacktrace event attributes, the error status description, and the instruction parts and prompted_output_template within model_request_parameters, on spans emitted by Pydantic AI in your telemetry pipeline (for example with an OpenTelemetry Collector processor). Setting include_model_request_parameters=False alongside include_content=False removes both, at the cost of the rest of that attribute.
Credits
Reported privately by @BrianWillows, whose report covered the exception events on tool and agent run spans. The remaining paths were found while fixing it, by a test that drives content through every channel at once and checks the whole exported trace.
Text from GitHub Advisory Database
Affected versions 212
- pydantic-ai, pip>= 0.3.4, < 1.107.6GitHub
- pydantic-ai, pip>= 2.0.0b1, < 2.44.0GitHub
- pydantic-ai-slim, pip>= 0.3.4, < 1.107.6GitHub
- pydantic-ai-slim, pip>= 2.0.0b1, < 2.44.0GitHub
- pydantic-aiaffected: >= 0.3.4, < 1.107.6CVE List
- pydantic-aiaffected: >= 2.0.0b1, < 2.44.0CVE List
- pydantic-ai-slimaffected: >= 0.3.4, < 1.107.6CVE List
- pydantic-ai-slimaffected: >= 2.0.0b1, < 2.44.0CVE List
- pydantic-ai, PyPIfrom 0.3.4, fixed in 1.107.6OSV
- pydantic-ai, PyPI0.3.4OSV
- pydantic-ai, PyPI0.3.5OSV
- pydantic-ai, PyPI0.3.6OSV
- pydantic-ai, PyPI0.3.7OSV
- pydantic-ai, PyPI0.4.0OSV
- pydantic-ai, PyPI0.4.1OSV
- pydantic-ai, PyPI0.4.10OSV
- pydantic-ai, PyPI0.4.11OSV
- pydantic-ai, PyPI0.4.2OSV
- pydantic-ai, PyPI0.4.3OSV
- pydantic-ai, PyPI0.4.4OSV
- pydantic-ai, PyPI0.4.5OSV
- pydantic-ai, PyPI0.4.6OSV
- pydantic-ai, PyPI0.4.7OSV
- pydantic-ai, PyPI0.4.8OSV
- pydantic-ai, PyPI0.4.9OSV
- pydantic-ai, PyPI0.5.0OSV
- pydantic-ai, PyPI0.5.1OSV
- pydantic-ai, PyPI0.6.0OSV
- pydantic-ai, PyPI0.6.1OSV
- pydantic-ai, PyPI0.6.2OSV
- pydantic-ai, PyPI0.7.0OSV
- pydantic-ai, PyPI0.7.1OSV
- pydantic-ai, PyPI0.7.2OSV
- pydantic-ai, PyPI0.7.3OSV
- pydantic-ai, PyPI0.7.4OSV
- pydantic-ai, PyPI0.7.5OSV
- pydantic-ai, PyPI0.7.6OSV
- pydantic-ai, PyPI0.8.0OSV
- pydantic-ai, PyPI0.8.1OSV
- pydantic-ai, PyPI1.0.0OSV
- pydantic-ai, PyPI1.0.0b1OSV
- pydantic-ai, PyPI1.0.1OSV
- pydantic-ai, PyPI1.0.10OSV
- pydantic-ai, PyPI1.0.11OSV
- pydantic-ai, PyPI1.0.12OSV
- pydantic-ai, PyPI1.0.13OSV
- pydantic-ai, PyPI1.0.14OSV
- pydantic-ai, PyPI1.0.15OSV
- pydantic-ai, PyPI1.0.16OSV
- pydantic-ai, PyPI1.0.17OSV
- pydantic-ai, PyPI1.0.18OSV
- pydantic-ai, PyPI1.0.2OSV
- pydantic-ai, PyPI1.0.3OSV
- pydantic-ai, PyPI1.0.4OSV
- pydantic-ai, PyPI1.0.5OSV
- pydantic-ai, PyPI1.0.6OSV
- pydantic-ai, PyPI1.0.7OSV
- pydantic-ai, PyPI1.0.8OSV
- pydantic-ai, PyPI1.0.9OSV
- pydantic-ai, PyPIfrom 2.0.0b1, fixed in 2.44.0OSV
- pydantic-ai, PyPI2.0.0OSV
- pydantic-ai, PyPI2.0.0b1OSV
- pydantic-ai, PyPI2.0.0b2OSV
- pydantic-ai, PyPI2.0.0b3OSV
- pydantic-ai, PyPI2.0.0b4OSV
- pydantic-ai, PyPI2.0.0b5OSV
- pydantic-ai, PyPI2.0.0b6OSV
- pydantic-ai, PyPI2.0.0b7OSV
- pydantic-ai, PyPI2.1.0OSV
- pydantic-ai, PyPI2.10.0OSV
- pydantic-ai, PyPI2.11.0OSV
- pydantic-ai, PyPI2.12.0OSV
- pydantic-ai, PyPI2.13.0OSV
- pydantic-ai, PyPI2.14.0OSV
- pydantic-ai, PyPI2.14.1OSV
- pydantic-ai, PyPI2.15.0OSV
- pydantic-ai, PyPI2.16.0OSV
- pydantic-ai, PyPI2.17.0OSV
- pydantic-ai, PyPI2.18.0OSV
- pydantic-ai, PyPI2.19.0OSV
- pydantic-ai, PyPI2.2.0OSV
- pydantic-ai, PyPI2.20.0OSV
- pydantic-ai, PyPI2.21.0OSV
- pydantic-ai, PyPI2.22.0OSV
- pydantic-ai, PyPI2.23.0OSV
- pydantic-ai, PyPI2.24.0OSV
- pydantic-ai, PyPI2.25.0OSV
- pydantic-ai, PyPI2.26.0OSV
- pydantic-ai, PyPI2.27.0OSV
- pydantic-ai, PyPI2.27.1OSV
- pydantic-ai, PyPI2.28.0OSV
- pydantic-ai, PyPI2.29.0OSV
- pydantic-ai, PyPI2.3.0OSV
- pydantic-ai, PyPI2.30.0OSV
- pydantic-ai, PyPI2.31.0OSV
- pydantic-ai, PyPI2.31.1OSV
- pydantic-ai, PyPI2.32.0OSV
- pydantic-ai, PyPI2.32.1OSV
- pydantic-ai, PyPI2.32.2OSV
- pydantic-ai, PyPI2.33.0OSV
- pydantic-ai, PyPI2.34.0OSV
- pydantic-ai, PyPI2.35.0OSV
- pydantic-ai, PyPI2.35.1OSV
- pydantic-ai, PyPI2.35.3OSV
- pydantic-ai, PyPI2.36.0OSV
- pydantic-ai, PyPI2.37.0OSV
- pydantic-ai, PyPI2.38.0OSV
- pydantic-ai, PyPI2.39.0OSV
- pydantic-ai, PyPI2.4.0OSV
- pydantic-ai, PyPI2.40.0OSV
- pydantic-ai-slim, PyPIfrom 0.3.4, fixed in 1.107.6OSV
- pydantic-ai-slim, PyPI0.3.4OSV
- pydantic-ai-slim, PyPI0.3.5OSV
- pydantic-ai-slim, PyPI0.3.6OSV
- pydantic-ai-slim, PyPI0.3.7OSV
- pydantic-ai-slim, PyPI0.4.0OSV
- pydantic-ai-slim, PyPI0.4.1OSV
- pydantic-ai-slim, PyPI0.4.10OSV
- pydantic-ai-slim, PyPI0.4.11OSV
- pydantic-ai-slim, PyPI0.4.2OSV
- pydantic-ai-slim, PyPI0.4.3OSV
- pydantic-ai-slim, PyPI0.4.4OSV
- pydantic-ai-slim, PyPI0.4.5OSV
- pydantic-ai-slim, PyPI0.4.6OSV
- pydantic-ai-slim, PyPI0.4.7OSV
- pydantic-ai-slim, PyPI0.4.8OSV
- pydantic-ai-slim, PyPI0.4.9OSV
- pydantic-ai-slim, PyPI0.5.0OSV
- pydantic-ai-slim, PyPI0.5.1OSV
- pydantic-ai-slim, PyPI0.6.0OSV
- pydantic-ai-slim, PyPI0.6.1OSV
- pydantic-ai-slim, PyPI0.6.2OSV
- pydantic-ai-slim, PyPI0.7.0OSV
- pydantic-ai-slim, PyPI0.7.1OSV
- pydantic-ai-slim, PyPI0.7.2OSV
- pydantic-ai-slim, PyPI0.7.3OSV
- pydantic-ai-slim, PyPI0.7.4OSV
- pydantic-ai-slim, PyPI0.7.5OSV
- pydantic-ai-slim, PyPI0.7.6OSV
- pydantic-ai-slim, PyPI0.8.0OSV
- pydantic-ai-slim, PyPI0.8.1OSV
- pydantic-ai-slim, PyPI1.0.0OSV
- pydantic-ai-slim, PyPI1.0.0b1OSV
- pydantic-ai-slim, PyPI1.0.1OSV
- pydantic-ai-slim, PyPI1.0.10OSV
- pydantic-ai-slim, PyPI1.0.11OSV
- pydantic-ai-slim, PyPI1.0.12OSV
- pydantic-ai-slim, PyPI1.0.13OSV
- pydantic-ai-slim, PyPI1.0.14OSV
- pydantic-ai-slim, PyPI1.0.15OSV
- pydantic-ai-slim, PyPI1.0.16OSV
- pydantic-ai-slim, PyPI1.0.17OSV
- pydantic-ai-slim, PyPI1.0.18OSV
- pydantic-ai-slim, PyPI1.0.2OSV
- pydantic-ai-slim, PyPI1.0.3OSV
- pydantic-ai-slim, PyPI1.0.4OSV
- pydantic-ai-slim, PyPI1.0.5OSV
- pydantic-ai-slim, PyPI1.0.6OSV
- pydantic-ai-slim, PyPI1.0.7OSV
- pydantic-ai-slim, PyPI1.0.8OSV
- pydantic-ai-slim, PyPI1.0.9OSV
- pydantic-ai-slim, PyPIfrom 2.0.0b1, fixed in 2.44.0OSV
- pydantic-ai-slim, PyPI2.0.0OSV
- pydantic-ai-slim, PyPI2.0.0b1OSV
- pydantic-ai-slim, PyPI2.0.0b2OSV
- pydantic-ai-slim, PyPI2.0.0b3OSV
- pydantic-ai-slim, PyPI2.0.0b4OSV
- pydantic-ai-slim, PyPI2.0.0b5OSV
- pydantic-ai-slim, PyPI2.0.0b6OSV
- pydantic-ai-slim, PyPI2.0.0b7OSV
- pydantic-ai-slim, PyPI2.1.0OSV
- pydantic-ai-slim, PyPI2.10.0OSV
- pydantic-ai-slim, PyPI2.11.0OSV
- pydantic-ai-slim, PyPI2.12.0OSV
- pydantic-ai-slim, PyPI2.13.0OSV
- pydantic-ai-slim, PyPI2.14.0OSV
- pydantic-ai-slim, PyPI2.14.1OSV
- pydantic-ai-slim, PyPI2.15.0OSV
- pydantic-ai-slim, PyPI2.16.0OSV
- pydantic-ai-slim, PyPI2.17.0OSV
- pydantic-ai-slim, PyPI2.18.0OSV
- pydantic-ai-slim, PyPI2.19.0OSV
- pydantic-ai-slim, PyPI2.2.0OSV
- pydantic-ai-slim, PyPI2.20.0OSV
- pydantic-ai-slim, PyPI2.21.0OSV
- pydantic-ai-slim, PyPI2.22.0OSV
- pydantic-ai-slim, PyPI2.23.0OSV
- pydantic-ai-slim, PyPI2.24.0OSV
- pydantic-ai-slim, PyPI2.25.0OSV
- pydantic-ai-slim, PyPI2.26.0OSV
- pydantic-ai-slim, PyPI2.27.0OSV
- pydantic-ai-slim, PyPI2.27.1OSV
- pydantic-ai-slim, PyPI2.28.0OSV
- pydantic-ai-slim, PyPI2.29.0OSV
- pydantic-ai-slim, PyPI2.3.0OSV
- pydantic-ai-slim, PyPI2.30.0OSV
- pydantic-ai-slim, PyPI2.31.0OSV
- pydantic-ai-slim, PyPI2.31.1OSV
- pydantic-ai-slim, PyPI2.32.0OSV
- pydantic-ai-slim, PyPI2.32.1OSV
- pydantic-ai-slim, PyPI2.32.2OSV
- pydantic-ai-slim, PyPI2.33.0OSV
- pydantic-ai-slim, PyPI2.34.0OSV
- pydantic-ai-slim, PyPI2.35.0OSV
- pydantic-ai-slim, PyPI2.35.1OSV
- pydantic-ai-slim, PyPI2.35.3OSV
- pydantic-ai-slim, PyPI2.36.0OSV
- pydantic-ai-slim, PyPI2.37.0OSV
- pydantic-ai-slim, PyPI2.38.0OSV
- pydantic-ai-slim, PyPI2.39.0OSV
- pydantic-ai-slim, PyPI2.4.0OSV
- pydantic-ai-slim, PyPI2.40.0OSV
References 14
- github.com/pydantic/pydantic-ai/commit/4e013c51a50659aba2adf7853bfb22bb77f6a518Fixvia CVE List
- github.com/pydantic/pydantic-ai/commit/6b14c74cb281f899a2ae4fae5327111e33f60771Fixvia CVE List
- github.com/pydantic/pydantic-ai/commit/7ee27e38ab2e525ca60ff1a25d16413ff989fd79Fixvia CVE List
- github.com/pydantic/pydantic-ai/commit/963dec5f70d6f558997fc259356c0090cc5ea487Fixvia CVE List
- github.com/pydantic/pydantic-ai/commit/de4e61515327bd80a19cd8552001c30933e6acc3Fixvia CVE List
- github.com/pydantic/pydantic-ai/releases/tag/v1.107.6Fixvia CVE List
- github.com/pydantic/pydantic-ai/releases/tag/v2.44.0Fixvia CVE List
- github.com/pydantic/pydantic-ai/security/advisories/GHSA-4x9p-g9wm-8q7fAdvisoryvia CVE List
- github.com/advisories/GHSA-4x9p-g9wm-8q7fAdvisoryvia GitHub
- github.com/pydantic/pydantic-ai/pull/8403Referencevia CVE List
- github.com/pydantic/pydantic-ai/pull/8404Referencevia CVE List
- github.com/pydantic/pydantic-ai/pull/8408Referencevia CVE List
- github.com/pydantic/pydantic-ai/pull/8428Referencevia CVE List
- github.com/pydantic/pydantic-ai/pull/8429Referencevia CVE List