Voltagent Best Practices
VoltAgent architectural patterns and conventions. Covers agents vs workflows, project layout, memory, servers, and observability.
MCP get_skill({ skillId: "voltagent-best-practices-09ff3511" })Use this skill with your agent
Create a free account and connect via MCP
# VoltAgent Best Practices
Quick reference for VoltAgent conventions and patterns.
---
## Choosing Agent or Workflow
| Use | When |
| --- | --- |
| Agent | Open-ended tasks that require tool selection and adaptive reasoning |
| Workflow | Multi-step pipelines with explicit control flow and suspend/resume |
---
## Layout
```
src/
|-- index.ts
|-- agents/
|-- tools/
`-- workflows/
```
---
## Quick Snippets
### Basic Agent
```typescript
import { Agent } from "@voltagent/core";
const agent = new Agent({
name: "assistant",
instructions: "You are helpful.",
model: "openai/gpt-4o-mini",
});
```
Model format is `provider/model` (for example `openai/gpt-4o-mini` or `anthropic/claude-3-5-sonnet`).
### Basic Workflow
```typescript
import { createWorkflowChain } from "@voltagent/core";
import { z } from "zod";
const workflow = createWorkflowChain({
id: "example",
input: z.object({ text: z.string() }),
result: z.object({ summary: z.string() }),
}).andThen({
id: "summarize",
execute: async ({ data }) => ({ summary: data.text }),
});
```
### VoltAgent Bootstrap
```typescript
import { VoltAgent } from "@voltagent/core";
import { honoServer } from "@voltagent/server-hono";
new VoltAgent({
agents: { agent },
workflows: { workflow },
server: honoServer(),
});
```
---
## Memory Defaults
- Use `memory` for a shared default across agents and workflows.
- Use `agentMemory` or `workflowMemory` when defaults need to differ.
---
## Server Options
- Use `@voltagent/server-hono` for Node HTTP servers.
- Use `@voltagent/server-elysia` as an alternative Node server provider.
- Use `serverless` provider for fetch runtimes (Cloudflare, Netlify).
---
## Observability Notes
- Use `VoltOpsClient` or `createVoltAgentObservability` for tracing.
- VoltAgent will auto-configure VoltOps if `VOLTAGENT_PUBLIC_KEY` and `VOLTAGENT_SECRET_KEY` are set.
---
## Recipes
Short best-practice recipes live in the embedded docs:
- `packages/core/docs/recipes/`
- Search: `rg -n "keyword" packages/core/docs/recipes -g"*.md"`
- Read: `cat packages/core/docs/recipes/<file>.md`
---
## Footguns
- Do not use `JSON.stringify` inside VoltAgent packages. Use `safeStringify` from `@voltagent/internal`.
---
## Resources
- https://voltagent.dev/docs
- https://github.com/voltagent/voltagent
- https://github.com/voltagent/voltagent/tree/main/examplesRelated Skills
More skills in Agent Orchestration
1. Product type search — what design patterns fit this product?
Design UI/UX systems with style guides, palettes, typography, and component specs for new interfaces
Acp Router
Route plain-language requests for Claude Code, Cursor, Copilot, OpenClaw ACP, OpenCode, Gemini CLI, Qwen, Kiro, Kimi, iFlow, Factory Droid, Kilocode, or explicit ACP harness work into either OpenClaw ACP runtime sessions or direct acpx-driven sessions ("telephone game" flow). For coding-agent thread requests, read this skill first, then use only `sessions_spawn` for thread creation. Codex chat binding defaults to the native Codex app-server plugin unless ACP is explicit or background spawn needs ACP.
Add New Safe Output Type
Adding a New Safe Output Type to GitHub Agentic Workflows
Agent Governance
Patterns and techniques for adding governance, safety, and trust controls to AI agent systems. Use this skill when: - Building AI agents that call external tools (APIs, databases, file systems) - Implementing policy-based access controls for agent tool usage - Adding semantic intent classification to detect dangerous prompts - Creating trust scoring systems for multi-agent workflows - Building audit trails for agent actions and decisions - Enforcing rate limits, content filters, or tool restrictions on agents - Working with any agent framework (PydanticAI, CrewAI, OpenAI Agents, LangChain, AutoGen)
Agentic Development
Build AI agents with Pydantic AI (Python) and Claude SDK (Node.js)
Agentic Workflows
Route gh-aw workflow design/create/debug/upgrade requests to the right prompts.
Explore Other Categories
Skills from other categories with shared topics
Anthropic Brand Styling
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
API Design Principles
Master REST and GraphQL API design principles to build intuitive, scalable, and maintainable APIs that delight developers. Use when designing new APIs, reviewing API specifications, or establishing API design standards.
Azure Aks Agent Skill
Azure Aks Agent Skill linked from Juliano Barbosa Claude Code Skills, with the upstream skill instructions available on GitHub.