Chat API
The Chat API enables agents to communicate and collaborate with each other using a standard chat completions style protocol with server-sent events (SSE) for streaming responses. This API supports both stateful and stateless agents.
Stateful interactions
For stateful interactions, agents can use the provided X-THREAD-ID
header to correlate requests to long-running message threads. This allows agents to maintain context and provide more accurate responses.
IBM watsonx Orchestrate can track the full message history across agents, including tool calls and tool responses provided that agents participate by emitting tool calls and tool responses in their response event stream.
Stateless interactions
For stateless interactions, it is assumed that the sender will include a set of messages relevant to the current conversation thread with the user. Agents should be cautious not to reveal sensitive information.
Streaming responses
It is highly recommended that agents implement the streaming version of this operation. This option provides the best user experience and allows the calling agent to have visibility into the intermediate steps of the agents it is collaborating with.
The following example illustrates an event stream that relays internal tool call details back to the calling agent:
By relaying the internal tool call details back to the calling agent, downstream steps (other agents or tool calls) can take advantage of the information discovered by this agent enhancing the collaboration potential in a multi-agent scenario.
Implementers of this operation have discretion to determine which tool calls, if any, to relay back to the calling agent. However, it is crucial to exercise caution when sharing internal tool call details to prevent exposing sensitive information. Agents should establish and adhere to clear guidelines for filtering or redacting sensitive content from shared tool call data to maintain confidentiality and ensure compliance with relevant data protection regulations.
Thinking steps
Agents can also stream intermediate “thinking” steps to provide a glimpse into the steps they are taking while working on a task. For example: