Skip to main content
Vizra ADK is in maintenance mode. It continues to work and receives compatibility fixes, but no new features are planned. For evaluating AI agents — now built on the official Laravel AI SDK — check out Vizra Evals, its successor for the evaluation use-case. Coming from ADK? See the migration guide.

What Are Toolboxes?

Toolboxes let you group related tools into logical collections with built-in authorization support. Think of them as “tool bundles” that can be enabled or disabled based on user permissions, subscription tiers, or any other context.

Organized Tools

Group related tools together for cleaner agent definitions

Built-in Authorization

Use Laravel Gates and Policies at both toolbox and tool levels

Dynamic Loading

Tools are loaded on-demand based on user context

Runtime Flexibility

Add or remove toolboxes at runtime based on conditions

Using Toolboxes in Agents

The easiest way to use toolboxes is to declare them in your agent’s $toolboxes property:
app/Agents/CustomerAgent.php
When the agent loads, it automatically:
  1. Checks toolbox-level authorization for each toolbox
  2. Filters individual tools based on per-tool gates/policies
  3. Applies any conditional inclusion logic
  4. Merges authorized tools with the agent’s direct tools

Runtime Toolbox Management

You can add or remove toolboxes dynamically at runtime:
Adding/Removing Toolboxes at Runtime

Checking Toolbox Status

Toolbox Inspection Methods

Creating Your First Toolbox

Generate a new toolbox using the Artisan command:
You can also specify options during generation:

Basic Toolbox Structure

app/Toolboxes/CustomerSupportToolbox.php

Authorization

Toolboxes support a powerful multi-level authorization system using Laravel’s built-in Gates and Policies.

Toolbox-Level Gates

The simplest form of authorization uses a Laravel Gate:
app/Toolboxes/AdminToolbox.php
Define the gate in your AuthServiceProvider:
app/Providers/AuthServiceProvider.php

Toolbox-Level Policies

For more complex authorization logic, use a Policy:
app/Toolboxes/PremiumToolbox.php
app/Policies/SubscriptionPolicy.php
When both a $gate and $policy are defined, the policy takes precedence. Only one authorization method is checked.

Per-Tool Gates

You can apply fine-grained authorization to individual tools within a toolbox:
app/Toolboxes/FinanceToolbox.php

Per-Tool Policies

For even more control, use policies on individual tools:
Per-Tool Policy Configuration
The authorization hierarchy is:
  1. Toolbox gate/policy - Must pass to see any tools
  2. Per-tool gate - Additional check for specific tools
  3. Per-tool policy - Alternative to per-tool gates
  4. shouldIncludeTool() - Final conditional logic

Conditional Tool Inclusion

For dynamic logic that goes beyond gates and policies, override the shouldIncludeTool() method:
app/Toolboxes/ContextAwareToolbox.php
Authorized tools are cached per session ID for performance. If context changes mid-session and you need tools to be re-evaluated, call $toolbox->clearCache() or $agent->forceReloadTools().

Real-World Examples

Admin Toolbox with Gate

app/Toolboxes/AdminToolbox.php

Multi-Tenant Toolbox

app/Toolboxes/TenantToolbox.php

Feature-Flagged Toolbox

app/Toolboxes/ExperimentalToolbox.php

Best Practices

Group by Domain

Organize tools by business domain (orders, payments, support) rather than technical function

Use Gates for Simple Checks

Gates are perfect for role-based checks. Use policies for complex business logic

Keep Toolboxes Focused

A toolbox should have 3-8 related tools. Split large toolboxes into smaller ones

Prefer Toolbox Auth

Use toolbox-level authorization when possible. Per-tool auth adds complexity
Naming Convention: Use descriptive names ending in Toolbox - e.g., CustomerSupportToolbox, PaymentProcessingToolbox, AdminToolbox.

API Reference

BaseToolbox Properties

BaseToolbox Methods

Agent Toolbox Methods

Artisan Command


Tools

Learn the basics of creating tools

Tool Pipelines

Chain tools together for sequential workflows