Skip to content

Agent Builder hosted workflow loses conversation context between turns (chat history not passed) #184

@Kenth06

Description

@Kenth06

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/sessions with workflow.id, user, and chatkit_configuration

Steps to Reproduce

  1. Create a workflow in Agent Builder with an Agent node that has "Include chat history" enabled
  2. Deploy the workflow and embed ChatKit using HostedApiConfig (getClientSecret)
  3. Send a message
  4. Agent responds with data
  5. Send a follow-up
  6. Expected: Agent understands this refers to, from the previous turn
  7. 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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions