ProductionAiToolPolicy class

Production-oriented tool policy for deployed applications.

This policy denies tool execution unless the invocation is explicitly allowed by tool name, role, capability, or an optional allowEnabledByDefault fallback.

By default, requireUserBinding is true and allowEnabledByDefault is false. That means tools must run with an authenticated user and must be allowed through one of the explicit allow paths.

This is the recommended policy for destructive tools such as billing, publishing, messaging, deletion, provisioning, or external integrations.

Implemented types

Constructors

ProductionAiToolPolicy({Set<String> allowedTools = const {}, Set<String> allowedCapabilities = const {}, Set<String> allowedRoles = const {}, bool requireUserBinding = true, bool allowEnabledByDefault = false})
const

Properties

allowedCapabilities Set<String>
Capabilities globally allowed by this policy.
final
allowedRoles Set<String>
User roles allowed to execute any tool under this policy.
final
allowedTools Set<String>
Tool names allowed regardless of required capabilities.
final
allowEnabledByDefault bool
Whether AiTool.enabledByDefault is honored in production.
final
hashCode int
The hash code for this object.
no setterinherited
requireUserBinding bool
Whether a user id is required before any tool can execute.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

canExecute(AiToolInvocation invocation) Future<bool>
Returns whether invocation may execute.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited