doc/user/duo_agent_platform/composite_identity.md
{{< history >}}
duo_workflow_use_composite_identity.{{< /history >}}
Composite identity is an authentication and authorization mechanism that combines two identities into a single token:
Composite identity is automatically included in GitLab Duo Agent Platform.
This dual-identity approach solves a critical challenge: agents need to act with access that does not exceed the access of the user who triggered them, or the access that the service account was granted, while maintaining a distinct identity that clearly shows the action was performed by an agent, not directly by the human user.
The composite identity is important because it helps ensure:
For example, when you ask an agent to create tests for your code, the resulting commits will show they were created by the service account on your behalf.
Composite identity is used when flows and agents execute on runners. This list includes:
api/v4/ai/duo_workflows/workflows.Composite identity does not apply to GitLab Duo Agentic Chat in the UI and IDE.
The token that authenticates requests is a composite of two identities:
id is included in the scopes of the token by using a dynamic scope.This composite identity ensures that any activities authored by the GitLab Duo Agent Platform are attributed to the human user, while preventing privilege escalation by either the human user or the service account.
The composite identity is part of the workflow.
ai-flowname-groupname.)The flow is executed by a one-time composite identity. This identity has a combination of the user's role and the service account's Developer role, whichever is more restrictive. So if the user is a Maintainer, but the service account is a Developer, the Developer role is used.
The flow has access to all projects that both:
For example, if the service account has been added to other projects, and the user has access to those projects the flow can access those projects even if the user has not used the flow there before.
AI Catalog flows use different token types with different permission scopes:
ai_workflows and mcp scopes.
This OAuth token is passed to the AI Gateway to run the flow.Because these are different token types with different scopes, the CI/CD job has different permissions than the OAuth token.
When a flow creates a merge request, the merge request is attributed to the human user who triggered the flow instead of the service account. This is done to adhere to compliance frameworks that require segregation of duties, including:
These frameworks typically require that a user cannot author code changes and approve those changes for production deployment.
Even though the service account creates the commits and opens the merge request, the human user is considered the author because: