execute calls Stophy, and the model answers from the results.
The search tool
Save this asstophy.ts. It calls Google search and returns the top 5 results as JSON. It works with no key. Set STOPHY_API_KEY to lift the free limit.
stophy.ts
Give it to the AI SDK
OPENAI_API_KEY in your environment.
Wrap the search in tool(). stopWhen lets the model search, read the results and answer in up to five steps. Any AI SDK model works, so swap openai(...) for another provider.