Loading
Draft: POC: Add flow slash commands to Duo Agentic Chat
This adds a slash command in GitLab Duo Agentic Chat for each AI Catalog flow enabled in the current project. Selecting a command starts that flow: chat acts as a launcher, the flow runs as its own agent session, and chat posts a card linking to it. The work is behind the duo_chat_flow_commands feature flag, disabled by default, and is a proof of concept. Try it out and give feedback, we'll likely throw this code away once we're settled on a proper direction.
Note: I couldn't help myself. But it did grab your attention.
Setup
- Watch this video first, before anything else: https://youtu.be/q7AVvzAVsvA The rest of these steps will make more sense afterwards.
- Check out this branch in your GDK.
- Make sure the GitLab Duo Agent Platform works in your GDK and that Duo Agentic Chat is available. Flows execute in a CI workload, so you need a working runner for the flow to actually run.
- Enable the feature flag. Either:
- In
gdk rails console, runFeature.enable(:duo_chat_flow_commands). or - Go to http://gdk.test:3000/rails/features and toogle on
duo_chat_flow_commands - Create a custom flow. In a project, go to Automate > Flows > New flow.
- Enable that flow in the project. Add whatever trigger you like, it doesn't matter for this demo.
- Open Duo Agentic Chat while you are inside that project. The commands are project scoped, so they will not appear in group or global chat.
Trying it out
- Type
/in the chat input. A dropdown lists one command per enabled flow, named/flow:<flow-name>with the flow name slugified. - Use the up and down arrow keys to move through the list, and Enter to select. Selecting a command fills the input and leaves a trailing space.
- Send it with nothing after the command to run the flow with no goal. The backend falls back to the flow's own description.
- Or type a goal after the command, for example
/flow:security-scan check the auth module. Everything after the command becomes the goal. - A card appears in the chat thread confirming the flow started. Click it to open the agent session.
Things to know
- Dispatch does not go through the LLM. Selecting a command always runs that exact flow.
- If two flows slugify to the same command name, the second gets the catalog item consumer ID appended to disambiguate. It is deliberately ugly so the problem is visible. I'm unsure what the proper fix would be here, we need to discuss that.
- The card rendered in the thread is fabricated on the frontend for this proof of concept. Normally that card comes from a tool message the Duo Workflow Service writes into the workflow checkpoint, but a user-invoked flow makes no tool call, so there is no such message. The real fix is to force a
start_flowtool call, which needs AI Gateway changes. This is markedPOC ONLYin the source. - There is no "Chat" trigger, in this POC we pull in all flows regardless of trigger. This is something else we should discuss.
- The chat has no knowledge that the session has been triggered as we bypass the chat gateway. If you trigger a session, then ask the chat what the status is or what the outcome is, it will be very confused
References
Edited by Sam Beckham
