Skip to main content

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

Optional
No description available.
Set[str]
No description available.
List[str]
No description available.

Methods

is_noop()

True when the policy would never remove any tool.

is_tool_allowed()

Return True if tool may be exposed on this route.

filter_tools()

Return a copy of tools with denied/disallowed tools removed.

Source

View on GitHub

praisonaiagents/gateway/protocols.py at line 1598

Tools Concept

Create Custom Tools

Tool Development