This document tracks the implementation status of features to achieve parity with the Python ChatKit SDK.
-
Feature #1: Reuse Agent SDK Message IDs
- Status: ✅ Complete
- Location:
src/agents/stream-converter.ts:187 - Description: Reuses message IDs from the Agent SDK for consistency instead of generating new ones
- Matches Python:
agents.py:486-487
-
Feature #2: Support Multiple Content Parts
- Status: ✅ Complete
- Location:
src/agents/stream-converter.ts:91, 243, 267 - Description: Tracks text accumulation separately for each content part using
content_indexfrom events - Matches Python:
agents.py:441, 449, 457
-
Feature #3: Add Content Part Lifecycle Events
- Status: ✅ Complete
- Location:
src/agents/stream-converter.ts:216-236 - Description: Emits
content_part.addedevents when content parts are initialized - Matches Python:
agents.py:434-444
-
Feature #4: Add Annotations Support (Citations)
- Status: ✅ Complete
- Location:
src/agents/stream-converter.ts:11-42, 217-232 - Description: Converts Agent SDK annotations (file citations, URL citations) to ChatKit format
- Matches Python:
agents.py:224-254
-
Feature #5: Add Workflow/Reasoning Support
- Status: ✅ Complete
- Location:
src/agents/stream-converter.ts:107-156, 287-372 - Description: Emits workflow items for GPT-5 reasoning with streaming thought support
- Matches Python:
agents.py:468-526 - Configuration: Toggle via
showThinkingoption (default: true)
-
Feature #9: Use SDK's Final Content
- Status: ✅ Complete
- Location:
src/agents/stream-converter.ts:384-427 - Description: Uses Agent SDK's final content from
response.output_item.doneinstead of accumulated text - Matches Python:
agents.py:527-545
-
Feature #10: Handle response.output_text.done Events
- Status: ✅ Complete
- Location:
src/agents/stream-converter.ts:265-285 - Description: Processes
response.output_text.doneevents to finalize content parts - Matches Python:
agents.py:453-463
-
Feature #7: Implement Event Merging (Multi-Agent & Widget Support)
- Status: ✅ Complete
- Location: Multiple files (see details below)
- Priority: High (Widget Support)
- Description: Merge Agent SDK stream events with custom integration events
- Required for: Custom widgets, multi-agent workflows, advanced integrations
- Python reference:
agents.py:261-294, 386-414 - Implementation files:
src/agents/merge-streams.ts- Stream merging utilitysrc/agents/widget-helpers.ts- diffWidget, accumulateTextsrc/agents/types.ts- AsyncEventQueue, AgentContext extensionssrc/agents/context-helpers.ts- createAgentContext factorysrc/server/widget-stream.ts- Standalone streamWidget functionsrc/agents/stream-converter.ts- Integrated merging logic
-
Feature #6: Add Tool Call Support
- Status: ✅ Complete
- Location:
src/agents/stream-converter.ts:99-174, 523-554 - Description: Handle client-side tool calls from Agent SDK tools
- Matches Python:
agents.py:416-426, 177-193, 81-88 - Implementation:
- Added
ClientToolCallinterface tosrc/agents/types.ts:10-15 - Added
clientToolCallproperty toAgentContextinterface (src/agents/types.ts:150) - Track tool calls via
run_item_stream_eventin stream-converter - Emit
ClientToolCallItemat end of stream ifcontext.clientToolCallis set
- Added
- Test tool:
advanced-chatkit-server.js:229-251(add_to_todo_list)
- Feature #8: Add Guardrail Handling
- Status: ⏸️ Pending
- Priority: Low (Safety/Moderation)
- Description: Handle input/output guardrail tripwire events
- Required for: Content moderation, safety checks
- Python reference:
agents.py:570-580 - Implementation notes:
- Track
produced_itemsset of item IDs - Catch
InputGuardrailTripwireTriggeredandOutputGuardrailTripwireTriggeredexceptions - Emit
ThreadItemRemovedEventfor all produced items on tripwire - Drain remaining events without processing
- Track
Current test coverage:
- ✅ Basic message streaming
- ✅ Reasoning/workflow display
- ✅ Annotations/citations
- ✅ Multiple content parts
- ✅ Widget streaming (Feature #7)
- ✅ Custom event merging (Feature #7)
- ✅ Client tool calls (Feature #6)
- ⏸️ Guardrail handling (pending Feature #8)
- All completed features match Python SDK behavior
- Configuration options (e.g.,
showThinking) match Python patterns - Event types and structure match ChatKit protocol specification
- Widget system fully implemented with streaming support
- Client tool call support fully implemented
- Ready for production use with single-agent and multi-agent workflows
- Tools can emit custom widgets using
context.streamWidget() - Tools can trigger client-side actions using
context.clientToolCall - Supports both static widgets and streaming widget generators