Skip to main content
Tool whitelisting prevents agent confusion by filtering visible tools to only those explicitly allowed, solving collision problems in multi-environment deployments.
The user restricts visible tools; the agent only sees whitelisted names from the environment or config.

Quick Start

1

Set Environment Variable

Enable tool whitelisting by setting ALLOWED_TOOLS to a comma-separated list of tool names:
The user requests news and a message; only tools on the allow-list are exposed to the model.
2

Programmatic Usage

Use the AllowedToolsFilter class directly for more control:

How It Works

The filter operates at tool registration time, intercepting the complete tool registry and returning only whitelisted tools.

Configuration Options

AllowedToolsFilter Methods


Common Patterns

Multi-Environment Composition

Combine YouTube, Twilio, and Gmail tool modules while ensuring agents see only canonical tools:

CI/CD Strict Mode

Catch typos early by enabling strict mode in pipelines:

Backward Compatibility Migration

Existing projects using HERMES_ONLY_TOOLS continue working:

Best Practices

Tool names are case-sensitive and must match exactly as registered in the tool registry. Use list_tools() to verify available names before whitelisting.
Set CI=true in automated environments to catch typos in ALLOWED_TOOLS that would otherwise be silently ignored in development.
New projects should use ALLOWED_TOOLS instead of the deprecated HERMES_ONLY_TOOLS. The new name is clearer and future-proof.
Environment-variable whitelisting is global and name-based, while BotConfig.allowed_tools provides per-bot runtime filtering. Use both for comprehensive tool security.

When to Use ALLOWED_TOOLS

Real-World Scenario

User runs an agent in an environment with YouTube, Gmail, and Twilio integrations. Each provides a send_message tool:
  1. Without ALLOWED_TOOLS: Agent might pick wrong send_message implementation
  2. With ALLOWED_TOOLS: Agent gets deterministic tool set: search,gmail_send,twilio_sms
  3. User types: “/summarize latest emails and send alerts”
  4. Agent behavior: Uses search for email summary, gmail_send for notifications (not the conflicting tools)

Tool Configuration

Environment variables and tool setup

Security Best Practices

Agent and tool security guidelines