Skip to content

Conversation

@tibbe
Copy link
Contributor

@tibbe tibbe commented Nov 6, 2025

This allows convenient access to these even if the run didn't end, at which point they would not be available via AgentRun.result.

Let me know if you also want the _json versions and/or if you want the documentation to read differently.

@tibbe
Copy link
Contributor Author

tibbe commented Nov 6, 2025

FYI I tried to follow https://github.com/pydantic/pydantic-ai/blob/main/docs/contributing.md but:

  • I had to install pyright myself (uv tool install pyright) and
  • that caused make to fail with a bunch of unrelated type errors.

Example of pyright errors:

PYRIGHT_PYTHON_IGNORE_WARNINGS=1 uv run pyright 
/Users/tibbe/work/pydantic-ai/examples/pydantic_ai_examples/ag_ui/api/agentic_generative_ui.py
  /Users/tibbe/work/pydantic-ai/examples/pydantic_ai_examples/ag_ui/api/agentic_generative_ui.py:30:5 - error: Type of "steps" is partially unknown
    Type of "steps" is "list[Unknown]" (reportUnknownVariableType)
/Users/tibbe/work/pydantic-ai/examples/pydantic_ai_examples/ag_ui/api/shared_state.py
  /Users/tibbe/work/pydantic-ai/examples/pydantic_ai_examples/ag_ui/api/shared_state.py:64:5 - error: Type of "special_preferences" is partially unknown
    Type of "special_preferences" is "list[Unknown]" (reportUnknownVariableType)
  /Users/tibbe/work/pydantic-ai/examples/pydantic_ai_examples/ag_ui/api/shared_state.py:71:5 - error: Type of "ingredients" is partially unknown
    Type of "ingredients" is "list[Unknown]" (reportUnknownVariableType)
/Users/tibbe/work/pydantic-ai/examples/pydantic_ai_examples/data_analyst.py
  /Users/tibbe/work/pydantic-ai/examples/pydantic_ai_examples/data_analyst.py:12:5 - error: Type of "output" is partially unknown
    Type of "output" is "dict[Unknown, Unknown]" (reportUnknownVariableType)

@tibbe tibbe force-pushed the add-agent-run-message-properties branch from d0325e9 to 1bede61 Compare November 6, 2025 14:02
@tibbe
Copy link
Contributor Author

tibbe commented Nov 6, 2025

Also either my code is wrong or I cannot figure out how to do these snapshot tests correctly.

@DouweM DouweM self-assigned this Nov 6, 2025
@tibbe tibbe force-pushed the add-agent-run-message-properties branch 2 times, most recently from 50f0174 to 72ee2d2 Compare November 7, 2025 09:32
This allows convenient access to these even if the run didn't end, at
which point they would not be available via `AgentRun.result`.
@tibbe tibbe force-pushed the add-agent-run-message-properties branch from 72ee2d2 to 3a5d3d6 Compare November 7, 2025 09:43
@tibbe tibbe requested a review from DouweM November 7, 2025 09:43
@DouweM DouweM changed the title Add AgentRun.{all,new}_messages Add AgentRun.{all,new}_messages{_json} Nov 7, 2025
@DouweM DouweM enabled auto-merge (squash) November 7, 2025 19:59
@DouweM DouweM merged commit 86b645f into pydantic:main Nov 7, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants