Command Palette

Search for a command to run...

YepAPI
Free · All Tools

AI Agents Agent Skill

Tool-use patterns, multi-step reasoning, agent orchestration, and structured outputs.

aiagentstoolsorchestration

The Skill

Full content, every format. Copy it, download it, or install with one command.

SKILL.md
---
description: Tool-use patterns, multi-step reasoning, agent orchestration, and structured outputs.
homepage: https://yepapi.com/skills/ai-agents
metadata:
  tags: [ai, agents, tools, orchestration]
---

# AI Agents

## Rules

- Define tools as typed functions with descriptions — the model picks which tool to call
- Tool schema: `{ name, description, parameters: zodSchema, execute: async (args) => result }`
- Multi-step loop: send messages → model returns tool call → execute tool → feed result back → repeat until done
- `maxSteps` limit to prevent infinite loops — default 5-10 steps depending on complexity
- Structured outputs with Zod: `generateObject({ schema: z.object({...}) })` for guaranteed shape
- Retry logic: wrap tool execution in try/catch, retry transient failures 2-3 times with exponential backoff
- Agent orchestration: break complex tasks into sub-agents with focused tool sets, coordinator agent delegates
- Always validate tool results before feeding back to the model — sanitize untrusted data
- Use `streamText` with `onToolCall` for real-time visibility into agent reasoning

## Patterns

```ts
// Tool definition
const tools = {
  searchDatabase: tool({
    description: "Search the product database",
    parameters: z.object({ query: z.string(), limit: z.number().default(10) }),
    execute: async ({ query, limit }) => db.products.search(query, limit),
  }),
};

// Agent loop
const result = await generateText({
  model,
  tools,
  maxSteps: 10,
  messages,
});
```

## Avoid

- Giving agents unrestricted tool access — scope tools to the task
- Missing `maxSteps` — agents can loop forever
- Trusting tool outputs without validation — always check before acting on results
- Monolithic agents — prefer focused sub-agents over one agent with 20+ tools

Install

Why Use the AI Agents Skill?

Without this skill, your AI guesses at ai agents patterns. It might hallucinate deprecated APIs, use outdated conventions, or miss best practices entirely. With it, your AI follows a proven ruleset — every suggestion aligns with current standards.

Drop this skill into your project and your AI instantly knows the rules. Better code suggestions, fewer errors, faster shipping.

Try These Prompts

These prompts work better with the AI Agents skill installed. Your AI knows the context and writes code that fits.

"Build a multi-step AI agent that uses tool calling to search the web and summarize results"

"Create an agent orchestration system with structured outputs and error recovery"

"Implement a tool-use pattern where the AI can query a database and format the results"

AI Agents skill — FAQ

It covers tool-use patterns, multi-step reasoning chains, agent orchestration, and structured output parsing. Your AI generates agent code with proper error recovery and tool calling conventions.

Run `npx skills add YepAPI/skills --skill ai-agents` in your project root. This copies the skill file into your repo where your AI coding tool can read it automatically.

An agent uses tool calling to take actions (search, query databases, write files), while a chatbot primarily generates text responses. This skill covers tool-use patterns, multi-step reasoning, and orchestration.

Want more skills?

Browse all 110 free skills for builders.

See All Skills