Create with VoltAgent CLI
Build your first AI agent with VoltAgent. This guide covers creating an agent, connecting it to external events, running workflows, and deploying to production.
Looking for full recipes? Check out the Recipes & Guides section.
Create New Project
Run the following command to create a new VoltAgent project:
- npm
- yarn
- pnpm
npm create voltagent-app@latest my-agent-app
yarn create voltagent-app my-agent-app
pnpm create voltagent-app my-agent-app
The CLI will prompt you for project name, AI provider, and API key. Once complete:
cd my-agent-app
Be sure your environment is running Node.js 20.19 or newer so the generated tsdown build works without ESM resolution issues.
Configure and Start
If you skipped API key entry during setup, create or edit the .env file in your project root and add your API key:
- OpenAI
- Anthropic
- Google Gemini
- Groq
- Mistral
OPENAI_API_KEY=your-api-key-here
ANTHROPIC_API_KEY=your-api-key-here
GOOGLE_GENERATIVE_AI_API_KEY=your-api-key-here
GROQ_API_KEY=your-api-key-here
MISTRAL_API_KEY=your-api-key-here
Now start the development server:
- npm
- yarn
- pnpm
npm run dev
yarn dev
pnpm dev
You should see the VoltAgent server startup message:
══════════════════════════════════════════════════
VOLTAGENT SERVER STARTED SUCCESSFULLY
══════════════════════════════════════════════════
✓ HTTP Server: http://localhost:3141
↪ Share it: pnpm volt tunnel 3141 (secure HTTPS tunnel for teammates)
Docs: https://voltagent.dev/docs/deployment/local-tunnel/
✓ Swagger UI: http://localhost:3141/ui
Test your agents with VoltOps Console: https://console.voltagent.dev
══════════════════════════════════════════════════
Test Your Agent
Open https://console.voltagent.dev and click Agents & Workflows in the sidebar to find your agent.
Select it, click the chat icon in the bottom right corner, and try asking "What's the weather in San Francisco?"
You should receive a response, you've successfully created your first basic AI agent that understand and generate responses.
For teams that need to self-host VoltAgent Console. We also offer enterprise support:
Up to this point, you created and tested a basic working AI agent. The next steps show how to connect it to external events, services, and using workflows.
Add Triggers and Actions (Optional)
You now have a working AI agent that responds to messages. VoltAgent also supports event-driven workflows.
- VoltAgent Triggers listen for external events like GitHub webhooks or cron schedules.
- Voltagent Actions send data to external services like Discord or Slack.
Together, they let your agent react to events and take actions automatically.
The diagram below shows an event-driven agent example: a GitHub star event triggers the agent, which generates a message and sends it to Discord.

Workflow steps:
- Trigger - Captures a GitHub star webhook event
- AI Agent - Generates a message based on the event
- Action - Sends the message to Discord
To implement this workflow with your agent, go to the VoltAgent Console Get Started Guide and continue from Step 4.
Run a Workflow
Running Your First Human-in-the-Loop Workflow
Workflows chain multiple steps (data transformations, API calls, AI agent interactions) into a single execution. Unlike a standalone agent that responds to one message at a time, workflows coordinate multi-step processes.
The generated project includes an expense approval workflow that demonstrates suspend/resume functionality. Workflows can pause execution, wait for human input, and then continue.
Run the example workflow
Open the Workflows page in console, select "Expense Approval Workflow", and click "Test Workflow". Enter input and click "Execute Workflow".
This workflow simulates an expense approval process where certain decisions require human input before continuing:
- Expenses under $500 are auto-approved by the system
- Expenses over $500 trigger a suspend, pausing the workflow until a manager approves or rejects
Auto-approval example (under $500):
{
"employeeId": "EMP-123",
"amount": 250,
"category": "office-supplies",
"description": "New laptop mouse and keyboard"
}
Manual review example (over $500):
{
"employeeId": "EMP-456",
"amount": 750,
"category": "travel",
"description": "Flight tickets for client meeting"
}
Share Your Local Server
When you need to demo your agent remotely or receive external webhooks, install the VoltAgent CLI and open a tunnel:
npx @voltagent/cli init
Then expose your local server:
pnpm volt tunnel 3141
The command prints an HTTPS URL (for example https://your-tunnel-address.tunnel.voltagent.dev) that forwards traffic to your local port until you press Ctrl+C. You can also run it ad‑hoc without installing dependencies:
Tip: skipping the port (
pnpm volt tunnel) uses the default3141.
npx @voltagent/cli tunnel 3141
See the Local Tunnel guide for details.
Build for Production
When you're ready to deploy, bundle the app and run the compiled JavaScript with Node:
- npm
- yarn
- pnpm
npm run build
npm start
yarn build
yarn start
pnpm build
pnpm start
The build script invokes tsdown, which bundles your TypeScript entrypoint (and any sibling directories such as ./workflows or ./tools) into dist/index.js. This extra step keeps the Node ESM loader from throwing ERR_UNSUPPORTED_DIR_IMPORT while preserving extensionless imports during development.
Next Steps
- Tutorial - Build agents with tools, memory, and integrations
- Agent Configuration - Agent options and settings
- Memory - Conversation history and persistence
- Tools - Create custom tools for your agent
To add VoltAgent to an existing project, see Create from scratch.