Tool Policy • AI Agent SDK
ToolPolicy: Declarative, per-route scope applied to an agent's tool surface.
ToolPolicy
Defined in the protocols module.
AI Agent
Declarative, per-route scope applied to an agent’s tool surface.
Mirrors the scheduler’s `RunPolicy.filter_tools contract (wrapper layer) but lives in core so :class:RouteBinding` can declare the scope without importing any heavy wrapper code. The wrapper inbound path applies it via a small apply/restore helper, exactly as the scheduler already does for unattended runs.
Attributes: allow_tools: If set, only tools whose name is in this set are kept; everything else is removed. `None means "allow all except deny_tools / the trust deny-list". deny_tools: Exact tool names removed before the run. deny_substrings: Case-insensitive substrings; a tool whose name contains any of them is removed (used by the untrusted` tier).
Properties
OptionalNo description available.
Set[str]No description available.
List[str]No description available.
Methods
`True` when the policy would never remove any tool.
Return `True if tool` may be exposed on this route.
Return a copy of `tools` with denied/disallowed tools removed.
Source
View on GitHubpraisonaiagents/gateway/protocols.py at line 2241