---
title: "Laravel AI: Load Tools On Demand With ToolSearch"
url: https://daily.dev/posts/laravel-ai-load-tools-on-demand-with-toolsearch-souygqalt
source_url: https://laravel-news.com/laravel-ai-tool-search
type: article
source: "Laravel News"
published: 2026-08-26T12:52:48.842Z
updated: 2026-08-26T12:53:12.976Z
tags: ["ai-agents", "php", "openai", "laravel", "anthropic"]
reading_time: 7
upvotes: 0
comments: 0
language: en
---

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

# Laravel AI: Load Tools On Demand With ToolSearch

**[Laravel News](https://daily.dev/sources/ln)** · 7 min read · 0 upvotes · 0 comments

## Summary

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.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://laravel-news.com/laravel-ai-tool-search>

## 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._

## Similar posts on daily.dev

- [Toolkit: Reusable AI Tools for the Laravel AI SDK](https://daily.dev/posts/toolkit-reusable-ai-tools-for-the-laravel-ai-sdk-8suwxwtfq) · Laravel News · 16 upvotes · 0 comments
- [Smart Tool Selection: Achieving 34-64% Token Savings with Spring AI's Dynamic Tool Discovery](https://daily.dev/posts/smart-tool-selection-achieving-34-64-token-savings-with-spring-ai-s-dynamic-tool-discovery-n1bvjlpdj) · Spring · 2 upvotes · 0 comments

---

Tags: [#ai-agents](https://daily.dev/tags/ai-agents), [#php](https://daily.dev/tags/php), [#openai](https://daily.dev/tags/openai), [#laravel](https://daily.dev/tags/laravel), [#anthropic](https://daily.dev/tags/anthropic)

[View this post on daily.dev](https://daily.dev/posts/laravel-ai-load-tools-on-demand-with-toolsearch-souygqalt)
