-
Notifications
You must be signed in to change notification settings - Fork 183
Description
Description
When using ChatKit (hosted mode) with an Agent Builder workflow deployed via getClientSecret / HostedApiConfig, the agent loses conversation context between turns. Follow-up messages are not understood in the context of the previous message.
Environment
- ChatKit:
@openai/chatkit-react@1.3.0→@openai/chatkit@1.1.0 - Agent Builder workflow: Multi-agent pipeline (Agent → Visualization Agent)
- Model:
gpt-5-nano - Session creation:
POST /v1/chatkit/sessionswithworkflow.id,user, andchatkit_configuration
Steps to Reproduce
- Create a workflow in Agent Builder with an Agent node that has "Include chat history" enabled
- Deploy the workflow and embed ChatKit using
HostedApiConfig(getClientSecret) - Send a message
- Agent responds with data
- Send a follow-up
- Expected: Agent understands this refers to, from the previous turn
- Actual: Agent responds but it has no context of the previous message
Root Cause Analysis
Looking at the generated SDK code from Agent Builder ("Get Code" → "Agents SDK"), the workflow creates a fresh conversationHistory array on every execution containing only the current message:
const conversationHistory: AgentInputItem[] = [
{ role: "user", content: [{ type: "input_text", text: workflow.input_as_text }] }
];The modelSettings.store is set to true, but the workflow code does not use previous_response_id, conversation_id, or any session mechanism to chain turns. Each workflow execution starts from scratch with no history.
When ChatKit hosted calls the workflow for a new user message, it should inject the previous thread messages into the execution context. Based on the observed behavior, this injection is either not happening or the conversationHistory is being overwritten.
Related Issues
- Resolved: Chat history not being referenced in Agent Builder — Same symptom reported Nov 2025, marked as resolved (server-side fix), but the behavior persists in our case as of March 2026.
- Conversation History With Agent Builder Agents — Unanswered thread from Feb 2026.
Expected Behavior
When "Include chat history" is enabled on Agent nodes in Agent Builder, ChatKit hosted should pass the full thread history (or at least relevant previous turns) to the workflow execution, so the agent can understand follow-up messages in context.