VoltAgent Server API
VoltAgent provides a flexible HTTP API for interacting with agents and workflows. The server architecture is framework-agnostic, allowing you to use different server implementations or create your own.
Architecture
VoltAgent 1.x introduces a pluggable server architecture:
@voltagent/server-core
- Framework-agnostic core with route definitions, handlers, and base provider@voltagent/server-hono
- Official server implementation using Hono (recommended)
Quick Start
import { Agent, VoltAgent } from "@voltagent/core";
import { honoServer } from "@voltagent/server-hono";
import { openai } from "@ai-sdk/openai";
const agent = new Agent({
name: "Assistant",
instructions: "You are a helpful assistant",
model: openai("gpt-4o-mini"),
});
new VoltAgent({
agents: { agent },
server: honoServer({
port: 3141,
enableSwaggerUI: true,
}),
});
The server starts automatically and displays:
══════════════════════════════════════════════════
VOLTAGENT SERVER STARTED SUCCESSFULLY
══════════════════════════════════════════════════
✓ HTTP Server: http://localhost:3141
✓ Swagger UI: http://localhost:3141/ui
══════════════════════════════════════════════════
API Documentation
Interactive Documentation
Access Swagger UI at http://localhost:3141/ui
to explore and test all endpoints directly in your browser.
OpenAPI Specification
Get the raw OpenAPI 3.1 spec at http://localhost:3141/doc
for code generation and tooling.
Core Endpoints
Agent Endpoints
GET /agents
- List all agentsPOST /agents/:id/text
- Generate text responsePOST /agents/:id/stream
- Stream text response (SSE)POST /agents/:id/object
- Generate structured objectPOST /agents/:id/stream-object
- Stream structured object (SSE)GET /agents/:id/history
- Get agent execution history
Workflow Endpoints
GET /workflows
- List all workflowsPOST /workflows/:id/execute
- Execute workflowPOST /workflows/:id/stream
- Stream workflow execution (SSE)POST /workflows/:id/executions/:executionId/suspend
- Suspend executionPOST /workflows/:id/executions/:executionId/resume
- Resume executionGET /workflows/:id/executions/:executionId/state
- Get execution state
Observability & Logs
POST /setup-observability
- Configure.env
with VoltAgent keysGET /observability/status
- Observability statusGET /observability/traces
- List tracesGET /observability/traces/:traceId
- Get trace by IDGET /observability/spans/:spanId
- Get span detailsGET /observability/traces/:traceId/logs
- Logs for a traceGET /observability/spans/:spanId/logs
- Logs for a spanGET /observability/logs
- Query logs (filters)GET /api/logs
- System logs (filters)
System
GET /updates
- Check available updatesPOST /updates/install
- Install updates (all or a specific package)
Documentation Sections
- Server Architecture - Understanding the pluggable server design
- Agent Endpoints - Complete agent API reference with examples
- Workflow Endpoints - Workflow execution and management
- Authentication - Securing your API endpoints
- Streaming - Real-time features with SSE and WebSocket
- Custom Endpoints - Adding your own REST endpoints
- API Reference - Complete endpoint reference
Next Steps
- Explore the Server Architecture to understand how VoltAgent servers work
- Check Agent Endpoints for detailed API usage
- Visit
/ui
on your running server for interactive API exploration