
How to Build a Durable AI Support Agent with Eve.dev and Next.js
Learn how to use Eve.dev to build a durable, crash-resistant AI customer support agent that can pause, wait for user input, and resume seamlessly within a Next.js application.
Summary
TL;DR: Eve.dev simplifies building durable AI agents. This guide walks you through creating a customer support agent that can survive crashes and handle long-running workflows using Eve.dev's checkpointing system.
Customer support agents require more than just generating a text response. They often need to look up data in external systems, ask the user clarifying questions, and wait—sometimes for hours or days—for a response. Traditional stateless LLM calls fail here because they lose context or time out.
Enter Eve.dev, the open-source framework for building durable AI agents.
In this step-by-step tutorial, we will build a highly resilient AI support agent using Eve.dev and Next.js. This agent will demonstrate "durable execution"—the ability to park its state, wait for a user's reply, and resume exactly where it left off, even if your server restarts.
What makes Eve.dev different?
Eve.dev treats your agent's execution like a state machine with automatic checkpointing. Every tool call and state change is saved. If the agent needs to wait for human input (like an email reply), the workflow is suspended. When the input arrives, Eve.dev wakes the agent up with its full memory intact.
Step 1: Setting up your Next.js project with Eve.dev
First, initialize a new Next.js project and install the Eve.dev core package.
npx create-next-app@latest support-agent
cd support-agent
npm install @eve/core
Create a new directory called eve at the root of your project. Eve.dev uses a filesystem-first architecture—meaning your agent's skills, tools, and instructions are organized into standard folders, much like Next.js app routing.
mkdir -p eve/agents/support/tools
Step 2: Defining the Agent's Instructions
Inside eve/agents/support/, create a file named instructions.md. Eve.dev parses Markdown files to define the system prompt and core behavior of your agent.
# Support Agent Instructions
You are a helpful customer support assistant for a SaaS company.
Your goal is to resolve user tickets efficiently.
## Rules
1. Always check the user's account status using the `check_account` tool before suggesting a refund.
2. If you need more information, use the `ask_user` tool to pause execution and request input.
3. Be polite and concise.
Step 3: Creating the Tools
Next, let's create the tools our agent can use. Create eve/agents/support/tools/check_account.ts:
import { tool } from '@eve/core';
import { z } from 'zod';
export default tool({
name: 'check_account',
description: 'Check the account status and billing tier of a user.',
schema: z.object({
userId: z.string(),
}),
execute: async ({ userId }) => {
// In a real app, query your database here
console.log(`Checking account for ${userId}`);
return { tier: 'Pro', status: 'Active', pastDue: false };
}
});
Step 4: Implementing the Wait State (Human-in-the-Loop)
To make the agent durable, we will use Eve.dev's suspend capability. Create eve/agents/support/tools/ask_user.ts:
import { tool, suspend } from '@eve/core';
import { z } from 'zod';
export default tool({
name: 'ask_user',
description: 'Ask the user a clarifying question and wait for their response.',
schema: z.object({
question: z.string(),
}),
execute: async ({ question }) => {
// This suspends the agent's execution state to a database/storage.
// The agent will "park" here until it receives a resume signal.
return suspend({ reason: 'waiting_for_user', message: question });
}
});
Step 5: Triggering the Agent in Next.js
Finally, we need an API route in Next.js to start or resume the agent. Create app/api/chat/route.ts:
import { Eve } from '@eve/core';
import { NextResponse } from 'next/server';
const eve = new Eve({
workspace: './eve', // Points to our filesystem configuration
storage: 'postgres://...', // Configure your durable storage
});
export async function POST(req: Request) {
const { ticketId, userId, message } = await req.json();
// Load the agent configuration from the filesystem
const agent = await eve.getAgent('support');
// Run the agent. If this ticketId already has a parked state,
// Eve.dev automatically resumes it rather than starting fresh.
const result = await agent.run({
id: ticketId,
context: { userId },
input: message
});
if (result.status === 'suspended') {
return NextResponse.json({ reply: result.suspensionMessage });
}
return NextResponse.json({ reply: result.finalOutput });
}
Conclusion
With just a few files, we've built an AI agent that doesn't just chat—it executes durable, long-running workflows. By combining Next.js API routes with Eve.dev's checkpointing and filesystem architecture, you can build production-ready agents that survive server restarts and seamlessly handle asynchronous human interactions.
Frequently Asked Questions (FAQ)
What is durable execution in AI agents? Durable execution means an agent's state is continuously saved (checkpointed) to a database. If the server crashes or the agent needs to wait days for human input, it can be perfectly restored and resumed without losing context.
How does Eve.dev handle agent configuration? Eve.dev uses a filesystem-based approach, similar to Next.js routing. You define your agent's tools, instructions, and skills in standard directories, which Eve.dev automatically parses and loads.
Why use Eve.dev instead of standard Vercel AI SDK? While Vercel AI SDK is excellent for streaming chat and stateless tool calling, Eve.dev provides the infrastructure for complex, long-running agentic workflows that require persistence, background processing, and human-in-the-loop pausing.
Related reading
Build an AIOps on-call agent with Eve.dev that triages alerts, runs diagnostics, and gates risky remediation behind human approval—surviving restarts.
Use Eve.dev's multi-agent orchestration to build an accounts-payable pipeline: a supervisor delegates invoice extraction, 3-way matching, and durable approvals.
Discover how to build an AI sales assistant that scores leads, crafts personalized emails, and uses durable wait states to manage multi-day follow-up sequences using Eve.dev.
Let's build something great.
Have a project in mind? We are an elite software and AI development studio ready to bring your ideas to production. Let's talk about your roadmap.