Loading...
Loading...
Compare original and translation side by side
| Use | When |
|---|---|
| Agent | Open-ended tasks that require tool selection and adaptive reasoning |
| Workflow | Multi-step pipelines with explicit control flow and suspend/resume |
| 使用场景 | 适用时机 |
|---|---|
| Agent | 需要工具选择和自适应推理的开放式任务 |
| Workflow | 具有显式控制流和暂停/恢复功能的多步骤流水线 |
src/
|-- index.ts
|-- agents/
|-- tools/
`-- workflows/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",
});provider/modelopenai/gpt-4o-minianthropic/claude-3-5-sonnetimport { Agent } from "@voltagent/core";
const agent = new Agent({
name: "assistant",
instructions: "You are helpful.",
model: "openai/gpt-4o-mini",
});provider/modelopenai/gpt-4o-minianthropic/claude-3-5-sonnetimport { 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 { 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(),
});import { VoltAgent } from "@voltagent/core";
import { honoServer } from "@voltagent/server-hono";
new VoltAgent({
agents: { agent },
workflows: { workflow },
server: honoServer(),
});memoryagentMemoryworkflowMemorymemoryagentMemoryworkflowMemory@voltagent/server-hono@voltagent/server-elysiaserverless@voltagent/server-hono@voltagent/server-elysiaserverlessVoltOpsClientcreateVoltAgentObservabilityVOLTAGENT_PUBLIC_KEYVOLTAGENT_SECRET_KEYVoltOpsClientcreateVoltAgentObservabilityVOLTAGENT_PUBLIC_KEYVOLTAGENT_SECRET_KEYpackages/core/docs/recipes/rg -n "keyword" packages/core/docs/recipes -g"*.md"cat packages/core/docs/recipes/<file>.mdpackages/core/docs/recipes/rg -n "keyword" packages/core/docs/recipes -g"*.md"cat packages/core/docs/recipes/<file>.mdJSON.stringifysafeStringify@voltagent/internalJSON.stringify@voltagent/internalsafeStringify