Laravel AI v0.11.0 introduces a ToolSearch wrapper that defers tool definitions so OpenAI and Anthropic load a tool's full schema only when the model decides to use it, instead of sending every tool definition on every request. This cuts prompt token overhead for agents with large tool catalogs and improves model tool-selection accuracy. The wrapper maps to each provider's native hosted tool search (a `tool_search` type on OpenAI, versioned `tool_search_tool_regex` or `bm25` types on Anthropic), requires no changes to tool classes, and only works with OpenAiProvider and AnthropicProvider - other providers throw a LogicException. ToolSearch::budget() adjusts the SDK's step-count default so wrapping tools doesn't artificially shrink the agent's step budget. OpenAI's hosted search requires stored responses, so it's incompatible with `store=false` setups.

7m read timeFrom laravel-news.com
Post cover image
Table of contents
# Wrapping the Tools You Want Deferred# What Each Provider Receives# Checking What Was Sent# Provider Support and Limits# Step Budgeting# When to Use It# Client-Side Tool Search# Further Reading

Questions this post answers

How do I defer tool definitions in Laravel AI so they're only loaded when the model needs them?

Wrap the tools in Laravel AI's new ToolSearch class, introduced in Laravel AI v0.11.0. Pass the tools to defer as the first argument, e.g. new ToolSearch(tools: [new IssueRefund, new ChangePlan]). The provider receives a search entry plus deferred definitions and loads a tool's full schema only when it decides to call it, rather than sending every definition on every request. daily.dev surfaces Laravel ecosystem releases like this for teams optimizing AI agent token costs.

Which AI providers support Laravel AI's ToolSearch wrapper?

Only OpenAiProvider and AnthropicProvider implement the SupportsToolSearch marker in Laravel AI. Every other provider - including Azure, Groq, DeepSeek, Mistral, OpenRouter, Gemini, xAI, Bedrock, and Ollama - throws a LogicException before the request goes out if a ToolSearch wrapper is present, rather than silently dropping the deferred tools. Developers choosing AI providers for Laravel agent workflows can track compatibility details like this on daily.dev.

Why does OpenAI reject a ToolSearch wrapper when store is set to false?

OpenAI's hosted tool search requires stored responses to function, so Laravel AI rejects combining a ToolSearch wrapper with store=false rather than letting the request fail at the API level. This means applications that disable response storage to keep prompts off OpenAI's servers cannot use hosted tool search there. Teams balancing prompt privacy against AI feature tradeoffs can follow Laravel AI updates on daily.dev.

337 Impressions