Tevpro insights

Building Durable AI Workflows With Eve

Durable AI workflows need more than prompts. Learn how Eve uses persistent sessions, tool execution, and human-in-the-loop approvals to build AI agents that can safely pause, resume, and take action across enterprise systems.

Artificial Intelligence
AI agent workflow white board man writing workflow

A production AI workflow needs more than a prompt and access to tools. It needs persistent state, controlled actions, failure handling, and a clear way for humans to intervene when an agent reaches a sensitive decision.

Eve provides these capabilities through durable agent sessions that can execute tools, pause for human approval, and resume without restarting the workflow.

How a Durable Eve Workflow Works

Consider an AI agent that prepares account briefs for a sales team.

A seller requests a brief, and the Eve agent retrieves approved CRM data, evaluates the account against defined instructions, and generates a draft. If the seller wants the brief saved to the CRM, the agent requests approval before performing the external write.

The workflow follows a simple pattern:

agent/
typescript
agent/
  agent.ts                 // model and runtime configuration
  instructions.md          // workflow rules and stopping conditions
  tools/
    get_account.ts         // read-only CRM lookup
    create_crm_note.ts     // external write, always requires approval
  skills/
    account-research.md    // optional playbook loaded for research work

The important distinction is that the agent can reason independently while consequential actions remain controlled.

1. Configure the agent

agent/agent.ts
typescript
import { defineAgent } from "eve";

export default defineAgent({
  model: "anthropic/claude-opus-4.8",
});

2. Put the workflow contract in instructions

agent/instructions.md
typescript
# Account brief workflow

When asked to prepare an account brief:
1. Call get_account before making claims about the account.
2. Identify missing data separately from risks and recommendations.
3. Draft a CRM note with: account context, risks, recommended next step, and sources used.
4. Never call create_crm_note until the draft is complete.
5. If the account does not exist or data is incomplete, explain what is missing and stop.
6. Do not invent customer facts, revenue, dates, or contacts.

3. Give the agent a read tool

agent/tools/get_account.ts
typescript
import { defineTool } from "eve/tools";
import { z } from "zod";

export default defineTool({
  description: "Read approved CRM account data by account ID. Use before drafting an account brief.",
  inputSchema: z.object({ accountId: z.string().min(1) }),
  async execute({ accountId }) {
    const response = await fetch(`${process.env.CRM_API_URL}/accounts/${accountId}`, {
      headers: { Authorization: `Bearer ${process.env.CRM_API_TOKEN}` },
    });

    if (response.status === 404) return { found: false };
    if (!response.ok) throw new Error(`CRM lookup failed: ${response.status}`);

    const account = await response.json();
    return {
      found: true,
      name: account.name,
      industry: account.industry,
      openOpportunities: account.openOpportunities,
      recentNotes: account.recentNotes,
    };
  },
});

4. Put the write behind an approval gate

The model can propose the write. It cannot make the write without a person approving it. The approval gate is also valuable when a run resumes after a restart because it forces a fresh human decision before a non-idempotent external action.

agent/tools/create_crm_note.ts
typescript
import { defineTool } from "eve/tools";
import { always } from "eve/tools/approval";
import { z } from "zod";

export default defineTool({
  description: "Create a CRM note only after the seller approves the final draft.",
  inputSchema: z.object({
    accountId: z.string().min(1),
    body: z.string().min(50),
  }),
  approval: always(),
  async execute({ accountId, body }) {
    const response = await fetch(`${process.env.CRM_API_URL}/accounts/${accountId}/notes`, {
      method: "POST",
      headers: {
        Authorization: `Bearer ${process.env.CRM_API_TOKEN}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ body, source: "account-brief-agent" }),
    });

    if (!response.ok) throw new Error(`CRM note failed: ${response.status}`);
    return response.json();
  },
});

5. Start the durable session from the product

Your application passes an explicit request into a new session. The session carries the conversation and durable checkpoints. The user gets a draft first. If the agent asks for approval, the client renders that request and responds through the same session.

app/api/account-brief/route.ts
typescript
import { Client } from "eve/client";

const client = new Client({ host: process.env.EVE_URL! });

export async function POST(request: Request) {
  const { accountId } = await request.json();

  const { session, response } = await client.sessions.create({
    message: `Prepare an account brief for account ${accountId}.`,
    clientContext: { accountId, requestedBy: "current-user-id" },
  });

  const result = await response.result();
  return Response.json({ sessionId: session.id, status: result.status, message: result.message });
}

What happens when this runs

First, Eve creates a durable session. The agent follows the instructions, calls the CRM read tool, and produces a brief. If the evidence is insufficient, it stops instead of filling the gaps. If the seller asks it to save the note, the create tool emits an approval request. The session can remain parked for minutes or days. After approval, Eve resumes at the pending tool call and writes the CRM note.

What Eve removes, and what it does not

Eve removes a great deal of agent-runtime plumbing: durable turns, session state, streaming, sandbox boundaries, channels, and approval pause-and-resume behavior. It does not decide whether the requesting user may access an account, whether an approval responder has the right role, what data may enter the model context, or how a CRM write becomes idempotent. Those are product decisions, not framework settings.

When Eve Is a Good Fit

Eve is well suited for AI workflows where an agent needs to evaluate information, make decisions, use tools, and occasionally wait for human input before continuing.

If a workflow must follow exactly the same sequence every time, a traditional application workflow may be more appropriate. The AI agent can then be introduced only where reasoning or interpretation adds value.

The goal is not to make every business process agentic. It is to use durable AI workflows where reasoning, tool execution, persistent state, and human oversight can improve how the process operates.

Sources

Why work with us

Why Tevpro?

Whether you’re a startup with a bold product idea or an established company seeking a stronger delivery partner, Tevpro delivers results. Our expert consultants specialize in building secure, scalable applications that simplify operations and drive real ROI.