Skip to content

Conversation

@MikeRyanDev
Copy link
Contributor

Hi there! I'm a developer on the AG-UI/CopilotKit team. We are changing the behavior of shared agent state in an upcoming release of CopilotKit, where the agent state object will always be supplied when running an agent. If state hasn't been configured, it will default to an empty object.

This change in behavior causes Pydantic AI to throw a UserError, since its current implementation requires a StateHandler to be configured if any state value is present.

This PR changes Pydantic AI's AG-UI implementation to silently accept an empty object as the state value, even if a StateHandler isn't present.

@MikeRyanDev MikeRyanDev force-pushed the fix/ag-ui-empty-state branch from 36d404c to a87af7e Compare November 18, 2025 05:00
@DouweM
Copy link
Collaborator

DouweM commented Nov 18, 2025

@MikeRyanDev Thanks Mike! I appreciate you proactively fixing the integration on our side :) Can you have a look at the failing coverage please?

@MikeRyanDev
Copy link
Contributor Author

Thanks @DouweM! I've added an additional test to increase coverage.

I'm seeing spurious errors like:

RuntimeError: Failed starting Temporal dev server: HTTP status server error (500 Internal Server Error) for url (https://temporal.download/cli/default?arch=amd64&platform=linux&format=tar.gz&sdk-name=sdk-python&sdk-version=1.19.0)

Maybe Temporal is sleepy this morning. I'll give it a few hours and re-run the build in a bit.

@MikeRyanDev MikeRyanDev reopened this Nov 18, 2025
@MikeRyanDev
Copy link
Contributor Author

All green, @DouweM!

@DouweM DouweM enabled auto-merge (squash) November 18, 2025 19:40
@DouweM DouweM merged commit 3450322 into pydantic:main Nov 18, 2025
29 checks passed
@MikeRyanDev MikeRyanDev deleted the fix/ag-ui-empty-state branch November 18, 2025 20:08
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