liveBook · Manning

Tool usage

As explained in Build AI-Enhanced Web Apps

Tool calling is a technique in which an AI model emits a structured request for an external tool or function, receives the execution result, and incorporates it into its response.

Tool calling lets a model request external information or actions when a prompt needs real-time or specialized data. The application executes the request and returns its result for the model to use in its response. section 4.4 section 4.4.1

Figure 4.14 The process of tool calling in an AI-powered application using the Vercel AI SDK. This shows how a user action initiates a prompt, which is formatted by the SDK and sent to the AI provider. The AI model may request a tool call, which is then executed by the SDK. The tool’s response is fed back to the AI model through the SDK, and finally, the result is used to update the UI for the user.

Follow the request from the user through the model and SDK, then back to the model and the interface. Tool execution stays under application control. section 4.4.1

Weather lookup

A model can request weather data for a region, receive the result, and incorporate it into an answer. An alternative is to insert fetched weather data directly into a prompt; this works best with a consistent prompt format and offers less flexibility. section 4.4 section 4.4.1

How Build AI-Enhanced Web Apps covers it

How deep it goes
Traces the structured-request and execution cycle through the application server and SDK, including a less-flexible prompt-injection alternative.
Examples
Demonstrates weather retrieval and tool-call messages, with booking systems, e-commerce, and automation agents as use cases.
What it assumes
Builds on familiarity with structured data generation and content streaming.
What you can do after
Apply tool calling with the Vercel AI SDK by defining custom tools, registering them, and handling their responses.
How it connects
Connects tool calling with external APIs, database queries, local functions, structured data generation, and the Vercel AI SDK.

Also explained in

Compare how 13 books explain tool usage →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build AI-Enhanced Web Apps. The section links point to the parts of the book it draws on.