Skip to content

Duo Workflow Checkpointing APIs

Dylan Griffith requested to merge 467828-api-to-persist-workflow-state into master

What does this MR do and why?

This merge request is the first for the GitLab rails project in order to build out the Duo Workflow architecture described in https://docs.gitlab.com/ee/architecture/blueprints/duo_workflow/ . This will be a new feature where most of the AI based logic is running in the AI Gateway. The AI Gateway does not have any database so the main GitLab rails application will be the source of truth for persisting state of the running workflow.

The structure of this new API is designed specifically to support LangGraph persistence which is an internal mechanism of the LangGraph framework. The checkpoints history will support features like restarting a suspended workflow as well as time travelling back to a specific checkpoint in the past to change some step during the workflow.

This MR introduces all the models/services/API endpoints needed for us to checkpoint the state of a workflow from the AI Gateway. The main important functionality introduced in this MR is in the ee/lib/api/ai/duo_workflows/workflows.rb file. It introduces 4 new CRUD endpoints we'll need to get started:

  1. POST /ai/duo_workflows/workflows => this will be used when a workflow is started and it will return an ID that is used for future checkpointing
  2. GET /ai/duo_workflows/workflows/:id => this just returns the workflow
  3. POST /ai/duo_workflows/workflows/:id/checkpoints => this is the most important part and is the endpoint that is used by AI Gateway to persist checkpoints as it progresses through a workflow
  4. GET /ai/duo_workflows/workflows/:id/checkpoints => this returns all the created checkpoints. This will be used by the AI Gateway when it needs to resume a previously run workflow.

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.

Before After

How to set up and validate locally

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

Related to #467828 (closed)

Edited by Dylan Griffith

Merge request reports

Loading