VoltAgent architectural patterns and conventions. Covers agents vs workflows, project layout, memory, servers, and observability.
Quick reference for VoltAgent conventions and patterns.
| Use | When |
|---|---|
| Agent | Open-ended tasks that require tool selection and adaptive reasoning |
| Workflow | Multi-step pipelines with explicit control flow and suspend/resume |
src/
|-- index.ts
|-- agents/
|-- tools/
`-- workflows/
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).
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 }),
});
import { VoltAgent } from "@voltagent/core";
import { honoServer } from "@voltagent/server-hono";
new VoltAgent({
agents: { agent },
workflows: { workflow },
server: honoServer(),
});
memory for a shared default across agents and workflows.agentMemory or workflowMemory when defaults need to differ.@voltagent/server-hono for Node HTTP servers.@voltagent/server-elysia as an alternative Node server provider.serverless provider for fetch runtimes (Cloudflare, Netlify).VoltOpsClient or createVoltAgentObservability for tracing.VOLTAGENT_PUBLIC_KEY and VOLTAGENT_SECRET_KEY are set.Short best-practice recipes live in the embedded docs:
packages/core/docs/recipes/rg -n "keyword" packages/core/docs/recipes -g"*.md"cat packages/core/docs/recipes/<file>.mdJSON.stringify inside VoltAgent packages. Use safeStringify from @voltagent/internal.skillbazaar install voltagent-best-practices --agent claudeSign in (free) to install skills with the CLI.
Author
@VoltAgent
on GitHub
Published by