AI
AI SDK Patterns
PatternsLearnnewComposeGitHub
PatternsComposeLearnAI SDK DocsGitHub

Built with AI SDK · shadcn/ui · Next.js

© 2026 AI SDK Patterns

Part of The loop → What is an agent loop?

Tool Calling

Let the AI model call functions and use external tools with the multi-step tool loop.

Popularagentsintermediate

🔒 Demo mode - uses `tools` parameter with real AI providers

Install this lab

Option 1: shadcn CLI

pnpm dlx shadcn@latest add https://ai-sdk-patterns.vercel.app/r/tool-calling

Option 2: Copy or download

Use cases

Weather Information Systems

Build weather applications that call real weather APIs, parse data, and present forecasts in natural language.

Financial Calculators

Create smart financial tools that perform complex calculations, market analysis, and investment recommendations.

Related labs

Streaming Chat

Stream text responses from AI models in real-time using streamText and the useChat hook.

Multi-Step Agent

Build an agent that orchestrates multiple tool calls in sequence, using stopWhen: stepCountIs() and automatic tool result forwarding.