doc/user/duo_agent_platform/agents/tool-governance.md
{{< details >}}
{{< /details >}}
{{< history >}}
gitlab_duo_governance_settings. Enabled by default.duo_workflow_background_tool_governance. Disabled by default.{{< /history >}}
[!warning] This feature is in beta. It is subject to change without notice. For more information, see GitLab Testing Agreement.
Tool governance sits at the execution boundary. After an agent has been admitted to a project, and before a tool is invoked, the governance layer consults the configured rules for the user's role and the tool's action category, then enforces the resulting mode.
[!flag] Enforcement for background flows is controlled by a feature flag. For more information, see the history.
Tools are classified into three action categories:
Agent tool governance (human-in-the-loop guardrail) lets administrators define how each agent tool is enforced at the moment of execution. Instead of allowing agents to invoke any tool without review, you can configure each tool to one of three modes:
This feature applies to Agentic Chat and IDE extensions. For flows, governance enforcement depends on where the flow runs:
| Classification | Mode |
|---|---|
| Read | Always Allow |
| Write | Always Ask |
| Delete | Always Ask |
When an agent calls a tool configured as Always Ask, execution pauses and an inline approval card is displayed. The card shows:
If you approve, the tool executes and the agent continues. If you reject, the tool is not executed. The agent receives a rejection signal and may attempt an alternative approach or stop.
When an agent attempts to invoke a tool that is configured as Always Deny for your role, the tool is not surfaced to the agent. If the agent's plan requires a denied tool, it receives an error indicating the tool is unavailable due to governance policy.
Rules are resolved in the following order, from most specific to least specific:
Project-level rules override group-level rules for the same tool, but can only be equal to or stricter than the group-level rule. Group-level rules override the defaults. If no rule is configured at any level, the tool defaults to Always Allow.
The fail-closed principle applies. If the governance service encounters a persistent error when resolving rules, the agent receives no tools rather than silently allowing execution.
Group-level rules apply to all projects in the group unless overridden at the project level.
Prerequisites:
To configure tool governance rules for a group:
Changes apply to all subgroups and projects that do not have a project-level override.
Project-level rules override the group-level rules for the same tool within that project.
Prerequisites:
To configure tool governance rules for a project:
{{< history >}}
mcp_server_block_enforcement. Disabled by default.{{< /history >}}
[!warning] This feature is in beta. It is subject to change without notice. For more information, see GitLab Testing Agreement.
In addition to per-tool governance, group Owners can block all tools from a specific external MCP server. When an MCP server is blocked, no tools from that server can be invoked, regardless of individual tool governance settings or user approvals.
This block is enforced on every tool call, including mid-session. If an administrator blocks an MCP server while a workflow is running, subsequent calls to tools from that server are denied immediately.
When a tool from a blocked MCP server is called, the agent receives a policy message instead of a tool result. The agent cannot use any tools from that server.
This differs from the Always Deny tool governance mode:
[!note] Blocking an MCP server requires GitLab 19.3 or later. On older GitLab Self-Managed and Dedicated instances, the block is not enforced and tools from the server are allowed by default. In GitLab 19.3, enforcing the block requires one additional request per MCP tool call.
You can block an MCP server at the group or project level:
Prerequisites:
To block an MCP server for a group:
The block applies immediately. All tools from the blocked server are denied for all users in the group and its subgroups and projects.
Prerequisites:
To block an MCP server for a project:
The block applies immediately. All tools from the blocked server are denied for all users in the project.