Skip to content
VoltAgent Best Practices

VoltAgent Best PracticesSkill

Added to Onei
v1.0.0
MIT
Repository Docs

Summary

VoltAgent's official conventions skill — when to reach for an agent versus a workflow, the expected project layout, and the core snippets for agents, workflows, memory and servers.

Features

  • Agent vs workflow decision table — adaptive reasoning against explicit control flow
  • Canonical src/ layout with agents/, tools/ and workflows/
  • Agent construction with the provider/model string format spelled out
  • createWorkflowChain pipelines typed with Zod input and result schemas
  • VoltAgent bootstrap registering agents and workflows behind honoServer()
  • Memory, server and observability conventions in one reference

Install This Skill

Add this skill to your favorite AI agent in a few steps.

Any AI agent

This skill is plain instructions — it works with any assistant that accepts custom instructions or system prompts.

  1. Copy the skill content with the button below.
  2. Paste it into your agent's instruction file or system prompt (for example AGENTS.md, .cursorrules, or a custom instructions field).
  3. Ask the agent to apply the skill whenever the task matches.

Skill Content

Markdown Content

Copy this content and use it with your preferred AI agent

---
name: voltagent-best-practices
# prettier-ignore
description: VoltAgent architectural patterns and conventions. Covers agents vs workflows, project layout, memory, servers, and observability.
license: MIT
metadata:
  author: VoltAgent
  version: "1.0.0"
  repository: https://github.com/VoltAgent/skills
---

# 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/examples

Usage Instructions

Learn how to use this skill with different AI agents.

Generic Instructions
npx skills add VoltAgent/skills

Description

VoltAgent is a TypeScript framework for building AI agents and multi-step workflows, with its own memory, server and observability pieces. This is the vendor's own conventions skill: a compact reference an agent loads before writing VoltAgent code, so what it produces looks like the framework's documentation rather than an approximation of it.

The decision it makes first

Agent or workflow. An Agent is for open-ended tasks where the model picks tools and reasons adaptively; a workflow is for multi-step pipelines with explicit control flow and suspend/resume. Getting this backwards produces either an agent asked to follow a rigid script or a workflow trying to improvise, and it is the single most common structural mistake in a new VoltAgent project.

Layout and snippets

The expected shape is src/index.ts with agents/, tools/ and workflows/ beside it. From there the skill carries the canonical snippets: constructing an Agent from @voltagent/core with name, instructions and a provider/model string (openai/gpt-4o-mini, anthropic/claude-3-5-sonnet — the slash format is a detail models routinely get wrong); building a typed pipeline with createWorkflowChain and Zod schemas for input and result; and the VoltAgent bootstrap that registers agents and workflows behind honoServer().

The rest covers memory, server configuration and observability conventions.

Where it fits

It is one of four skills in VoltAgent's official pack, alongside create-voltagent for project setup, voltagent-core-reference for the VoltAgent class options and lifecycle methods, and voltagent-docs-bundle, which reads the version-matched docs embedded in @voltagent/core so answers track the version you actually installed rather than whatever the model remembers.

MIT licensed. Install with npx skills add VoltAgent/skills, or clone the repository and point your agent at the directory.

Related Skills

New

Build crash-safe AI agents on AgentKit and step.ai — durable tool calls, human-in-the-loop approval, realtime progress, and when not to reach for an agent loop at all.

1 views

Inngest's durable-execution playbook as an agent skill — steps and memoisation, event and cron triggers, idempotency, cancellation, retries and non-retriable errors.

2 views
New

Temporal's official skill for building durable workflows — SDK patterns across seven languages, plus the determinism rules that decide whether a workflow survives a replay.

6 views
Browse all skills →