Why Your AI Agent Needs Live Web Access
A well-built Laravel AI support agent can query order history, search a knowledge base, and hold multi-turn conversations. But the moment a customer asks "Is FedEx experiencing delays right now?", a static knowledge base falls flat. Shipping carrier statuses, outage pages, and real-time availability change by the minute — and training data can be months stale.
Episode 8 of the Ship AI with Laravel series solves this by wiring the agent into the live web using the SDK's built-in provider tools.
The Two Provider Tools: WebSearch and WebFetch
The Laravel AI SDK ships with two provider-level tools:
- WebSearch — queries the web and returns a ranked list of results.
- WebFetch — fetches and reads a specific URL's content.
Note: WebFetch is currently supported on Anthropic and Gemini only. Because this series runs on OpenAI, WebSearch is the right choice and handles the use case well.
Adding WebSearch to the Support Agent
The integration involves three decisions:
- Cap the result count. The example limits results to five to keep context concise and costs predictable.
- Define an allow list. Restrict the domains the agent may search. Without this, the agent could browse anywhere on the internet and return unvetted content to customers.
- Update the system instructions. Tell the agent to be transparent about the source of its answer — distinguishing between your official policy and something retrieved from the live web.
A simplified configuration looks like this:
WebSearch::make()
->maxResults(5)
->allowedDomains([
'fedex.com',
'ups.com',
'usps.com',
])
The provider handles the actual HTTP requests and ranking; your code only declares the constraints.
Testing Real-World Queries
With WebSearch active, the agent handles two scenarios that previously produced unhelpful responses:
- FedEx delay check — the agent queries both the order record and FedEx's live status page, then synthesises a single answer.
- USPS Priority Mail transit time — instead of guessing from potentially outdated training data, the agent returns the current published estimate.
You can also bias results by geographic region if your customer base is concentrated in a specific area, giving locally relevant answers without extra application logic.
The Agent's Full Tool Set (After Episode 8)
At this point the support agent has five tools available:
- Order lookup
- Customer history
- Knowledge base search
- Document search
- Live web search
It can now answer from your database, your internal documentation, and the live web — covering the full spectrum from structured business data to real-time external information.
Key Takeaways
- Use the SDK's
WebSearchprovider tool to give a Laravel AI agent access to live web results. - Always define an
allowedDomainslist — leaving it open lets the agent retrieve and surface arbitrary web content. - Cap
maxResultsto control context size and inference cost. - Update system instructions so the agent cites whether an answer comes from internal policy or a live web source.
WebFetch(for reading a specific URL) is currently limited to Anthropic and Gemini; OpenAI users should rely onWebSearch.- Location biasing is available when your users are concentrated in a specific region.
Source: Ship AI with Laravel: Give Your AI Agent Live Web Search — Laravel News, June 18, 2026