Skip to content

Conversation

@adtyavrdhn
Copy link
Contributor

@adtyavrdhn adtyavrdhn commented Nov 7, 2025

Closes #3171

Adds a UUID run_id at agent start, thread it through GraphAgentState, and assign it to every ModelRequest/ModelResponse as they’re created so all execution paths share one identifier.

Keep run_id optional on message classes for backward compatibility.

Cover the change with tests:
(1) assert captured messages and result.all_messages() all carry the same non-empty run_id and
(2) confirm ModelMessagesTypeAdapter preserves the field through serialization.

@adtyavrdhn adtyavrdhn changed the title Adding run_id to ModelRequest and ModelResponse, propagating it via G… Adding run_id to ModelRequest and ModelResponse Nov 7, 2025
@adtyavrdhn
Copy link
Contributor Author

@DouweM A lot of tests will need to be modified to accommodate run_id in the snapshots.

@DouweM
Copy link
Collaborator

DouweM commented Nov 7, 2025

@DouweM A lot of tests will need to be modified to accommodate run_id in the snapshots.

@adtyavrdhn Yep, we'll need run_id=IsStr() everywhere.

@adtyavrdhn
Copy link
Contributor Author

This ended up being a much bigger diff than what I was expecting

@adtyavrdhn adtyavrdhn requested a review from DouweM November 8, 2025 13:07
Copy link
Collaborator

@DouweM DouweM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adtyavrdhn Nice work Aditya!

@adtyavrdhn adtyavrdhn requested a review from DouweM November 11, 2025 06:25
@DouweM DouweM changed the title Adding run_id to ModelRequest and ModelResponse Adding run_id to run, run resuilt, and message (request, response) classes Nov 12, 2025
@DouweM DouweM changed the title Adding run_id to run, run resuilt, and message (request, response) classes Adding run_id to run, run result, and message (request, response) classes Nov 12, 2025
@DouweM DouweM changed the title Adding run_id to run, run result, and message (request, response) classes Add unique run_id to run, run result, and message (request, response) classes Nov 12, 2025
@DouweM DouweM enabled auto-merge (squash) November 12, 2025 15:59
@DouweM DouweM merged commit 41336ac into pydantic:main Nov 12, 2025
59 of 61 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.

Add run_id field to ModelMessage for reliable run grouping

2 participants