Skip to content

GraphQL API for duoWorkflowEvents

Dylan Griffith requested to merge 469679-graphql-api-for-workflow-state into master

What does this MR do and why?

This MR adds a GraphQL resolver which returns duo workflow events for a given 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.

How to set up and validate locally

  1. Enable FF start_duo_workflows
  2. Create a duo workflow for a project you have developer access
curl -XPOST -i http://gdk.test:3000/api/v4/ai/duo_workflows/workflows\?private_token\=[YOUR_TOKEN]\&project_id\=[PROJECT_ID]
  1. Create a checkpoint for the workflow
POST http://gdk.test:3000/api/v4/ai/duo_workflows/workflows/[WORKFLOW_ID_FROM_STEP_ABOVE]/checkpoints?private_token=[YOUR_TOKEN]
Content-Type: application/json

{
  "thread_ts": "2024-07-03 11:00:10 UTC",
  "checkpoint" : {
    "key": "value"
  },
  "metadata": {
    "key": "value"
  }
}
  1. Visit http://gdk.test:3000/-/graphql-explorer
  2. Run the following query. The workflowId should be like "gid://gitlab/Ai::DuoWorkflows::Workflow/1"
query getDuoWorkflowEvents($workflowId: AiDuoWorkflowsWorkflowID!) {
  duoWorkflowEvents(workflowId: $workflowId) {
    edges {
      node {
        timestamp,
        errors,
        metadata, 
        parentTimestamp,
        checkpoint
      }
    }
  }
}
  1. You should receive a success response with the workflow events.

Summary of Code Changes (DUO generated)

This merge request introduces a new feature to the GitLab application, which allows users to query for Duo Workflow events. Duo Workflow is a tool that helps users manage their workflows more efficiently. With this new feature, users can now access detailed information about the events that occur during a Duo Workflow, such as the timestamp, errors, checkpoint, metadata, and parent timestamp. This information can be useful for troubleshooting and monitoring the progress of a Duo Workflow. The feature is currently in the experimental phase and is only available to users with the appropriate permissions.

Related to #469679 (closed)

Edited by Halil Coban

Merge request reports

Loading