#AG-UI adapter for Pydantic Graph

1 messages · Page 1 of 1 (latest)

onyx agate
#

If you want to connect to a LanGraph in FastAPI, there's the following:

from copilotkit import langgraph_agui_agent

Pydantic have recently released their v2 Graph, and I now have several implementations of CopilotKit working with it. However, I had to roll my own adapter, which isn't ideal.

Does anyone know if there's plans to create something similar to langgraph_agui_agent for Pydantic Graph?

Btw, I did raise a feature request on Pydantic AI's GitHub: https://github.com/pydantic/pydantic-ai/issues/5492.

I'm happy to raise a FR for CopilotKit too, and cross-reference to the one above, but I wanted to check in first.

Thanks

Ian

GitHub

AI Agent Framework, the Pydantic way. Contribute to pydantic/pydantic-ai development by creating an account on GitHub.

maiden tokenBOT
#

This solution has been AI generated

There isn't a built-in AG-UI adapter for Pydantic AI v2 Graph in CopilotKit today. CopilotKit supports Pydantic AI Agents via AG-UI, and provides a LangGraph-specific adapter, but no equivalent for Pydantic Graph is present or documented. Filing a feature request in CopilotKit (cross-referencing your Pydantic AI issue) is the right next step.

Current status

  • No PydanticGraphAGUIAgent (or similar) exists in the CopilotKit Python SDK.
  • CopilotKit includes a specialized LangGraph adapter (e.g., langgraph_agui_agent) to bridge LangGraph to AG-UI.
  • Existing Pydantic AI integrations in the repo use standard Agents, not the new Graph API.

What works today with Pydantic AI

You can expose standard Pydantic AI Agents to AG-UI:

from pydantic_ai import Agent
from pydantic_ai.ag_ui import StateDeps

agent = Agent(...)
app = agent.to_ag_ui(deps=StateDeps(MyState()))

Recommendation

  • Please open a Feature Request in CopilotKit and reference your Pydantic AI issue. A native adapter would need to:
    • Translate Pydantic Graph state transitions to AG-UI protocol events.
    • Support shared state, manual message emission, and state snapshots similar to the LangGraph adapter.

References

Was this helpful?

If this solution worked for you, please click on the appropriate option below to help us improve:

maiden tokenBOT
#

Thank you for confirming that your issue has been resolved! ✅

onyx agate