Summary: tours feature removed, human agent events renamed for clarity, some ChatInstance methods changed, Chain of Thought feature changed, and custom element sizing behavior simplified with required className for React and consistent class-based approach for both React and Web Component versions.
The entire tours feature has been removed from the library.
What's gone:
ChatInstance.tours
and all its methodsSendOptions.skipTourCard
PublicConfig.tourConfig
PublicWebChatState.isTourActive
tour:start
, tour:end
, CALLED_START_TOUR
, etc.)START_TOUR_METHOD
message sourceAgent related events have been renamed to be more explicit about human agents vs AI bots.
Event renames:
AGENT_*
events → HUMAN_AGENT_*
in BusEventTypeAGENT_PRE_RECEIVE
→ HUMAN_AGENT_PRE_RECEIVE
, AGENT_END_CHAT
→ HUMAN_AGENT_END_CHAT
ServiceDesk type changes:
AgentsOnlineStatus
→ HumanAgentsOnlineStatus
ServiceDeskCallback.agentJoined(profile: AgentProfile)
→ agentJoined(profile: ResponseUserProfile)
ServiceDeskPublicConfig.skipConnectAgentCard
→ skipConnectHumanAgentCard
EndChatInfo.endedByAgent
→ endedByHumanAgent
Migration steps:
AGENT_
with HUMAN_AGENT_
in event listenersMethod renames:
updateAssistantInputFieldVisibility(isVisible)
-> updateInputFieldVisibility(isVisible)
Method removals:
agentEndConversation()
- use instance.serviceDesk.endConversation()
insteadupdateIsTypingCounter(direction)
- use instance.updateIsLoadingCounter()
insteadRemoved:
cspNonce
- Widget no longer accepts CSP nonce via config as it is no longer neededBoth ChatCustomElement
(React) and cds-aichat-custom-element
(Web Component) now use a simplified class-based approach for show/hide behavior.
Breaking changes:
React (ChatCustomElement
):
className
prop is now required (was optional)Web Component (cds-aichat-custom-element
):
cds-aichat--hidden
class for hide/show (same as React)Migration steps:
For React:
ChatCustomElement
usages include a className
propFor Web Components:
cds-aichat-custom-element
CSS examples (works for both):
.my-chat-container {
width: 500px;
height: 600px;
/* other positioning styles */
}
/* Or use logical properties (recommended for international support) */
.my-chat-container-logical {
inline-size: 500px;
block-size: 600px;
/* other positioning styles */
}
Benefits:
cds-aichat--hidden
classChain of Thought was available in 0.4.0 but has moved location and gained streaming support.
Changes:
GenericItemMessageOptions
to MessageOptions
partial_response.message_options.chain_of_thought
Usage:
Add chain_of_thought
to message message_options
(moved from item level):
const messageWithThinking = {
id: "msg-123",
output: { generic: [{ response_type: "text", text: "Here's my answer..." }] },
message_options: {
chain_of_thought: [
{
title: "Analyzing the question",
tool_name: "reasoning",
status: ChainOfThoughtStepStatus.SUCCESS,
input: "User asked about...",
response: "I need to consider...",
},
{
title: "Searching knowledge base",
tool_name: "search",
status: ChainOfThoughtStepStatus.PROCESSING,
},
],
},
};
Migration note: If you were using Chain of Thought in 0.4.0, move it from the individual item's message_options
to the top-level message message_options
.
Customize message sender identity using ResponseUserProfile
:
import { UserType } from "@carbon/ai-chat";
const response = {
id: "resp-123",
output: {
generic: [{ response_type: "text", text: "Hello from the legal bot!" }],
},
message_options: {
response_user_profile: {
id: "legal-bot",
nickname: "Legal Assistant",
user_type: UserType.BOT,
profile_picture_url: "https://example.com/legal-bot-avatar.png",
},
},
};
Options:
UserType.WATSONX
for default bot styling with custom nameUserType.BOT
with profile_picture_url
for custom avatarsinstance.updateBotName()
and instance.updateMainHeaderAvatar()
for global changesimport { ChainOfThoughtStep, ChainOfThoughtStepStatus } from "@carbon/ai-chat";
const responseWithThinking = {
id: "thinking-response",
output: {
generic: [
{
response_type: "text",
text: "Based on my analysis, I recommend...",
},
],
},
message_options: {
chain_of_thought: [
{
title: "Understanding the request",
tool_name: "comprehension",
status: ChainOfThoughtStepStatus.SUCCESS,
input: "User wants to know about...",
response: "I need to analyze multiple factors...",
},
{
title: "Searching documentation",
tool_name: "doc_search",
status: ChainOfThoughtStepStatus.SUCCESS,
input: "search query: user requirements",
response: "Found 15 relevant documents...",
},
] as ChainOfThoughtStep[],
},
};
// instance.messaging.addMessage(responseWithThinking);
Currently, the message might silently throw if you pass in unsupported items (or items that have moved!), this is a bug that will be fixed in the next release.
For custom streaming implementations using instance.messaging.addMessageChunk
:
Partial response payload:
partial_response.history
was merged into message historypartial_response.message_options
is merged.Complete item handling:
complete_item
could create new message itemcomplete_item
updates existing item in-place (prevents duplicates and component re-mounting)response_type
on first chunk for each itempartial_item.text
), not top levelstreaming_metadata.response_id
for message, streaming_metadata.id
for each itemstreaming_metadata.response_id
used during streaming// First chunk - must include response_type
instance.messaging.addMessageChunk({
streaming_metadata: { response_id: "resp-123" },
partial_item: {
response_type: "text", // Required on first chunk
streaming_metadata: { id: "item-1", cancellable: true },
text: "Hello",
},
});
// Follow-up chunks
instance.messaging.addMessageChunk({
streaming_metadata: { response_id: "resp-123" },
partial_item: {
streaming_metadata: { id: "item-1" },
text: " world",
},
});
// Complete the item
instance.messaging.addMessageChunk({
streaming_metadata: { response_id: "resp-123" },
complete_item: {
response_type: "text",
streaming_metadata: { id: "item-1" },
text: "Hello world!",
},
});
Stream chain of thought steps during message delivery:
instance.messaging.addMessageChunk({
streaming_metadata: { response_id: "resp-123" },
partial_response: {
message_options: {
chain_of_thought: [
{
title: "Processing request",
tool_name: "thinking",
status: ChainOfThoughtStepStatus.PROCESSING,
},
],
},
},
partial_item: {
response_type: "text",
streaming_metadata: { id: "item-1" },
text: "Let me think...",
},
});
Debug tip: Enable config.debug: true
to see streaming logs and catch errors early.