Closes #3098
Heyy @DouweM, Hope ur're doing well
I have started working on the integrating of OpenAI's ChatKit framework with Pydantic AI.
ChatKit operates differently from other UI protocols in several key ways:
Unlike simple request-response patterns, ChatKit works with persistent threads where each conversation is considered a sequence of different thread items (user messages, assistant messages, tool calls, widgets, etc.).
It supports advanced UI elements beyond text:
- Widgets: Interactive components with real-time updates
- Progress Updates: Live feedback during agent reasoning
It also already provides comprehensive TypeScript definitions on the frontend and Python types in their official library, which I'm leveraging for type safety.
I've started implementing the adapter by importing types directly from the official chatkit Python library:
The core adapter structure follows Pydantic AI's BaseAdapter pattern but with ChatKit-specific considerations:
- Request validation: Handles multiple ChatKit request formats
- Message conversion: Transforms ChatKit's thread items to Pydantic AI's
ModelMessage format (currently in progress)
Before continuing the implementation, I have some questions about the desired scope and approach:
1. Session Management Responsibility
Since we're making Pydantic AI agents ChatKit-protocol compatible, who should handle session management?
Option A: Full ChatKit Backend Implementation
- Implement our own version of ChatKit's
ChatKitServer
- Manage conversation persistence
- Provide full API compatibility
Option B: Adapter-Only Approach
- Focus solely on protocol translation (ChatKit ↔ Pydantic AI)
- Leave session management to the user
2. Memory Store Integration
ChatKit's server implementation includes a MemoryStore interface for persisting conversations. Should we:
Option A: Provide ChatKit-Compatible Memory Store
Option B: Custom State Management
- Let users implement their own persistence layer
3. Protocol Compatibility Level
How closely should we follow ChatKit's backend implementation?
- Full Compatibility: Implement all ChatKit behaviors
- Minimal: Basic request/response translation
I would greatly appreciate your advice on the best path forward and on which specific ChatKit features or behaviors we should prioritize
Thanks in advance ^^!
Uh oh!
There was an error while loading. Please reload this page.
Closes #3098
Heyy @DouweM, Hope ur're doing well
I have started working on the integrating of OpenAI's ChatKit framework with Pydantic AI.
ChatKit operates differently from other UI protocols in several key ways:
Unlike simple request-response patterns, ChatKit works with persistent threads where each conversation is considered a sequence of different thread items (user messages, assistant messages, tool calls, widgets, etc.).
It supports advanced UI elements beyond text:
It also already provides comprehensive TypeScript definitions on the frontend and Python types in their official library, which I'm leveraging for type safety.
I've started implementing the adapter by importing types directly from the official
chatkitPython library:The core adapter structure follows Pydantic AI's
BaseAdapterpattern but with ChatKit-specific considerations:ModelMessageformat (currently in progress)Before continuing the implementation, I have some questions about the desired scope and approach:
1. Session Management Responsibility
Since we're making Pydantic AI agents ChatKit-protocol compatible, who should handle session management?
Option A: Full ChatKit Backend Implementation
ChatKitServerOption B: Adapter-Only Approach
2. Memory Store Integration
ChatKit's server implementation includes a
MemoryStoreinterface for persisting conversations. Should we:Option A: Provide ChatKit-Compatible Memory Store
Option B: Custom State Management
3. Protocol Compatibility Level
How closely should we follow ChatKit's backend implementation?
I would greatly appreciate your advice on the best path forward and on which specific ChatKit features or behaviors we should prioritize
Thanks in advance ^^!