LLM is not doing the work.. your code is doing the work, LLM is just telling you which of the functions (aka tools) you should run.
web search is also another tool and you can gate it with logic so LLMs don’t go rogue.
that’s kinda simplest explanation i guess