Ai Agents Ui Skills
Comprehensive guide for building AI agents using ToolLoopAgent, workflow patterns, and AI SDK UI components (useChat, generative UIs, tool calling)
от gocallum★ 23 звезды на GitHub
Установить Ai Agents Ui Skills в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
AI Agents & UI Skills
Status: AI SDK 6 Beta Package Manager: pnpm Key Version: @ai-sdk/core, @ai-sdk/react (for UI) Official Docs:
- Agents Overview
- Building Agents
- Workflow Patterns
- AI SDK UI
- Chatbot Guide
- Chatbot Tool Usage
- Generative User Interfaces
Table of Contents
- Installation & Setup
- Understanding Agents
- Building ToolLoopAgent
- Agent Configuration Options
- System Instructions & Behavior
- Workflow Patterns
- AI SDK UI - useChat Hook
- Building Chatbot Applications
- Tool Calling in UI
- Generative User Interfaces
- Advanced Patterns
- Best Practices
Installation & Setup
Install Dependencies
# Core packages
pnpm add ai @ai-sdk/core @ai-sdk/anthropic
# For UI (React)
pnpm add @ai-sdk/react
# Optional: specific providers
pnpm add @ai-sdk/openai @ai-sdk/google
TypeScript Configuration
Ensure your tsconfig.json has proper settings:
{
"compilerOptions": {
"target": "ES2020",
"lib": ["ES2020", "DOM"],
"moduleResolution": "bundler",
"strict": true
}
}
Understanding Agents
What Are Agents?
Agents are LLMs that use tools in a loop to accomplish tasks. Three core components work together:
- LLMs - Process input, decide next action
- Tools - Extend capabilities (APIs, databases, files)
- Loop - Orchestrates execution through context management and stopping conditions
ToolLoopAgent Class
The ToolLoopAgent class is the recommended approach because it:
- Reduces boilerplate - Manages loops and message arrays automatically
- Improves reusability - Define once, use throughout application
- Simplifies maintenance - Single place to update configuration
- Provides type safety - Full TypeScript support for tools and outputs
vs. Core Functions
For most use cases, use ToolLoopAgent. Use core functions (generateText, streamText) when you need explicit control for complex structured workflows.
Building ToolLoopAgent
Basic Agent
import { ToolLoopAgent, tool } from 'ai';
import { z } from 'zod';
const weatherAgent = new ToolLoopAgent({
model: 'anthropic/claude-sonnet-4.5',
tools: {
weather: tool({
description: 'Get weather in a location (Fahrenheit)',
inputSchema: z.object({
location: z.string().describe('The location'),
}),
execute: async ({ location }) => ({
location,
temperature: 72 + Math.floor(Math.random() * 21) - 10,
}),
}),
convertFahrenheitToCelsius: tool({
description: 'Convert Fahrenheit to Celsius',
inputSchema: z.object({
temperature: z.number(),
}),
execute: async ({ temperature }) => ({
celsius: Math.round((temperature - 32) * (5 / 9)),
}),
}),
},
});
// Use the agent
const result = await weatherAgent.generate({
prompt: 'What is the weather in San Francisco in celsius?',
});
console.log(result.text); // Agent's final answer
console.log(result.steps); // Steps taken by agent
Multi-Tool Execution
The agent automatically:
- Calls
weathertool to get temperature in Fahrenheit - Calls
convertFahrenheitToCelsiusto convert it - Generates final text response with result
Agent Configuration Options
Model and System Instructions
const agent = new ToolLoopAgent({
model: 'anthropic/claude-sonnet-4.5',
instructions: 'You are an expert data analyst. Provide clear insights.',
});
Tools
const codeAgent = new ToolLoopAgent({
model: 'anthropic/claude-sonnet-4.5',
tools: {
runCode: tool({
description: 'Execute Python code',
inputSchema: z.object({
code: z.string(),
}),
execute: async ({ code }) => {
// Execute code
return { output: 'Result' };
},
}),
},
});
Loop Control (stopWhen)
By default, agents run for 20 steps (stopWhen: stepCountIs(20)). Each step is one generation (text or tool call).
import { ToolLoopAgent, stepCountIs } from 'ai';
const agent = new ToolLoopAgent({
model: 'anthropic/claude-sonnet-4.5',
stopWhen: stepCountIs(20), // Allow up to 20 steps
});
// Combine multiple stop conditions
const agent2 = new ToolLoopA
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Ai Agents Ui Skills?
Comprehensive guide for building AI agents using ToolLoopAgent, workflow patterns, and AI SDK UI components (useChat, generative UIs, tool calling)
Как установить скилл Ai Agents Ui Skills?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Ai Agents Ui Skills запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…