Allow to pass namespace id when creating workflow
What does this MR do and why?
This MR allows clients (e.g. WebUI, Editor Extension) to pass namespace id to duo workflow Rest and GraphQL APIs for Agentic Chat doesn't work outside of project (G... (#550324 - closed).
This doesn't change the current behavior of project-level duo workflow/agentic-chat. Users can execute duo workflow and agentic chat as-is. See #550324 (closed) for the implementation overview.
References
This MR is currently blocking Allow to pass namespace id when creating workflow (!196781 - merged) and Editor extension side of work.
Related to Agentic Chat doesn't work outside of project (G... (#550324 - closed) !195737 (merged)
Screenshots or screen recordings
Example of GraphQL Workflow creation mutation query
mutation {
aiDuoWorkflowCreate(input: {
namespaceId: "gid://gitlab/Group/1000000",
goal: "test"
workflowDefinition: "chat"
}) {
workflow {
id
project { name }
namespace { name }
}
errors
}
}
Response:
{
"data": {
"aiDuoWorkflowCreate": {
"workflow": {
"id": "gid://gitlab/Ai::DuoWorkflows::Workflow/221",
"project": null,
"namespace": {
"name": "GitLab Duo"
}
},
"errors": []
}
},
"correlationId": "01K03WMH3Y2C56CS7DTHVVYDBG"
}
Verifying database records:
[3] pry(main)> Ai::DuoWorkflows::Workflow.last.namespace
=> #<Group id:1000000 @gitlab-duo>
Example of RestAPI Workflow creation request
curl --request POST \
--header "Content-Type: application/json" \
--data '{"namespace_id": "1000000", "goal": "test", "workflow_definition": "chat"}' \
--header "PRIVATE-TOKEN: [REDACTED]" \
"http://gdk.test:3000//api/v4/ai/duo_workflows/workflows"
Response:
{
"id": 223,
"project_id": null,
"namespace_id": 1000000,
"agent_privileges": [
1,
2
],
"agent_privileges_names": [
"read_write_files",
"read_only_gitlab"
],
"pre_approved_agent_privileges": [
1,
2
],
"pre_approved_agent_privileges_names": [
"read_write_files",
"read_only_gitlab"
],
"workflow_definition": "chat",
"status": "created",
"allow_agent_to_request_user": true,
"image": null,
"workload": {
"id": null,
"message": null
},
"mcp_enabled": false,
"gitlab_url": "http://gdk.test:3000"
}
Verifying database records:
[3] pry(main)> Ai::DuoWorkflows::Workflow.last.namespace
=> #<Group id:1000000 @gitlab-duo>
Example of RestAPI Workflow Checkpoint creation request
curl --request POST \
--header "Content-Type: application/json" \
--data '{"thread_ts": "1", "checkpoint": {"test": "test"}, "metadata": {"test": "test"}}' \
--header "PRIVATE-TOKEN: [REDACTED]" \
"http://gdk.test:3000//api/v4/ai/duo_workflows/workflows/223/checkpoints"
Response:
{
"id": 2,
"thread_ts": "1",
"parent_ts": null,
"checkpoint": {
"test": "test"
},
"metadata": {
"test": "test"
},
"checkpoint_writes": []
}
Verifying database records:
[7] pry(main)> Ai::DuoWorkflows::Checkpoint.last.namespace
=> #<Group id:1000000 @gitlab-duo>
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.