From f3a838fe4567abc12e389c913750a859d8252c49 Mon Sep 17 00:00:00 2001 From: Leandro Barbosa Date: Wed, 18 Feb 2026 15:45:50 -0300 Subject: [PATCH] feat: add ToolPolicyConfig for per-agent tool filtering Add ToolPolicyConfig struct with Allow/Deny string slices supporting both individual tool names and group refs (e.g. "group:web"). Add ToolPolicy field to AgentConfig. Backward compatible: nil = full access. --- pkg/config/config.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/config/config.go b/pkg/config/config.go index 22ec0cd8a..d814edeb8 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -100,6 +100,14 @@ func (m AgentModelConfig) MarshalJSON() ([]byte, error) { return json.Marshal(raw{Primary: m.Primary, Fallbacks: m.Fallbacks}) } +// ToolPolicyConfig defines allow/deny lists for per-agent tool filtering. +// Tool names can be individual (e.g. "exec") or group refs (e.g. "group:web"). +// nil = full access (no filtering applied). +type ToolPolicyConfig struct { + Allow []string `json:"allow,omitempty"` // tool names or group refs + Deny []string `json:"deny,omitempty"` // tool names or group refs +} + type AgentConfig struct { ID string `json:"id"` Default bool `json:"default,omitempty"` @@ -111,6 +119,7 @@ type AgentConfig struct { Skills []string `json:"skills,omitempty"` Capabilities []string `json:"capabilities,omitempty"` Subagents *SubagentsConfig `json:"subagents,omitempty"` + ToolPolicy *ToolPolicyConfig `json:"tool_policy,omitempty"` } type SubagentsConfig struct {