> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Tool Policy • AI Agent SDK

> ToolPolicy: Declarative, per-route scope applied to an agent's tool surface.

# ToolPolicy

> Defined in the [**protocols**](../modules/protocols) module.

<Badge color="blue">AI Agent</Badge>

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).

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%

graph LR
    agent["Agent"] -- "uses" --> tool["Tool: ToolPolicy"]
    tool -- "returns" --> result["Result"]
    style tool fill:#189AB4,color:#fff
    style agent fill:#8B0000,color:#fff
    style result fill:#8B0000,color:#fff
```

## Properties

<ResponseField name="allow_tools" type="Optional">
  No description available.
</ResponseField>

<ResponseField name="deny_tools" type="Set[str]">
  No description available.
</ResponseField>

<ResponseField name="deny_substrings" type="List[str]">
  No description available.
</ResponseField>

## Methods

<CardGroup cols={2}>
  <Card title="is_noop()" icon="function" href="../functions/ToolPolicy-is_noop">
    `True` when the policy would never remove any tool.
  </Card>

  <Card title="is_tool_allowed()" icon="function" href="../functions/ToolPolicy-is_tool_allowed">
    Return `True` if `tool` may be exposed on this route.
  </Card>

  <Card title="filter_tools()" icon="function" href="../functions/ToolPolicy-filter_tools">
    Return a copy of `tools` with denied/disallowed tools removed.
  </Card>
</CardGroup>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L1598">
  `praisonaiagents/gateway/protocols.py` at line 1598
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Tools Concept" icon="wrench" href="/docs/docs/concepts/tools" />

  <Card title="Create Custom Tools" icon="plus" href="/docs/docs/guides/tools/create-custom-tools" />

  <Card title="Tool Development" icon="code" href="/docs/docs/tutorials/advanced-tool-development" />
</CardGroup>
