Skip to content

Adds agentVersionId to aiCompletionResponse subscription

What does this MR do and why?

Solves Add agentVersionId to aiCompletionResponse trig... (#441658 - closed)

Adds Ai agents debug chat interface (!141698 - merged) introduced the debug chat for an AI agent. The idea is that you can create an agent with a system prompt and then use a chat interface to debug it (referred to as "debug chat"). We use the same architecture as Duo chat to reuse most parts of the stack.

Because we use the same GraphQl subscription that pushes new messages for both chat interfaces, you'd see all messages on both chat interfaces. So to distinguish between messages for Duo chat and the AI agents debug chat, we need to add the agentVersionId to the subscription. We already use this argument in the mutation. Duo chat will use nil|null and the debug chat will use the agent version global ID, so each chat will only receive messages that are meant for it.

This MR adds the agentVersionId argument to the aiCompletionResponse subscription.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

What should the screenshots illustrate? Before both the agent debug chat and Duo chat used the same subscription parameters. That caused all messages for Duo and the debug chat to appear in both chats.

After introducing the agentVersionId as a parameter for the subscription, Duo chat messages only appear in Duo chat (because agentVersionId: nil) and debug chat messages only appear in the debug chat (because agentVersionId: "gid://gitlab/Ai::AgentVersion/1" or the specific version).

Before After
image image
Screen_Recording_2024-02-28_at_11.40.10 Screen_Recording_2024-02-28_at_11.36.58

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Marc Saleiko

Merge request reports