Skip to content

Conversation

@desertaxle
Copy link
Contributor

Reintroduces the changes in #3074 with a fix for the test that was faling on main.

Comment on lines +146 to +152
async def event_stream_handler(
ctx: RunContext[Deps],
stream: AsyncIterable[AgentStreamEvent],
):
logfire.info(f'{ctx.run_step=}')
async for event in stream:
logfire.info('event', event=event)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The failure on main was caused by this function being wrapped with @task, which is the opposite of what we want to do. The inputs to event_stream_handler can't be serialized, so we wrap the event stream handler within PrefetAgent to manage this. I've also corrected an inaccuracy that was in the PrefectAgent docs regarding this.

@desertaxle desertaxle marked this pull request as ready for review October 13, 2025 18:01
@DouweM DouweM enabled auto-merge (squash) October 14, 2025 06:29
@DouweM DouweM merged commit 2d84e6a into pydantic:main Oct 14, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants