For an agent that can restart after a failed request, ToolLoopAgent provides the model-and-tool loop inside your TypeScript application. WorkflowAgent adds durable execution for work that must survive interruptions.
eve packages durable sessions with channels, a sandbox, approvals, and evals. Choose it when you want those parts supplied by a framework configured through Markdown and TypeScript files.
Copy link to headingHow the three options relate
ToolLoopAgent is part of the AI SDK. Both WorkflowAgent and eve use its model and tool interfaces, and all three accept AI Gateway model strings.
Copy link to headingWhat ToolLoopAgent does
ToolLoopAgent runs a model-and-tool loop inside your application. You supply a model, instructions, and tools; it calls the model, executes tools that are ready to run, and sends their results back for another model call.
It returns when the model no longer requests executable tools, when approval or external tool handling is needed, or when a stop condition is met. The default stopWhen setting allows up to 20 steps.
ToolLoopAgent does not persist execution checkpoints. If the process crashes or times out, your app handles recovery using any messages or results it saved.
This order-status agent uses one tool and sets a 10-step limit. The tool returns a fixed response; replace it with a lookup in your order system.
Copy link to headingWhat WorkflowAgent does
WorkflowAgent from @ai-sdk/workflow runs an AI SDK agent loop inside a Edgenivo Workflow. Model calls run as durable steps, and tools gain checkpointing and retries when their execute function is marked 'use step'. Failed steps retry up to three times by default, for four attempts total.
Setting needsApproval produces an approval request without executing the tool. The agent call then returns, and your application submits the decision with the conversation history in a later workflow invocation. Use a workflow hook if the same run must suspend until a decision arrives.
WorkflowAgent replaces DurableAgent from the Workflow SDK and requires Workflow 5.1 or later. It writes output to a workflow writable stream. Its stream() method has no default step limit, so set stopWhen to limit model calls.
This workflow requests approval before calling the refund tool. The tool is a placeholder; replace its return value with an idempotent call to your payments API.
The caller must display the approval request, authorize the reviewer's decision, and start a new invocation with the updated message history. For client-supplied approval history, configure signed approvals. Follow the approval integration to connect the workflow to your application.
Copy link to headingWhat eve does
eve is an open-source, filesystem-first framework for durable backend agents. You define an agent as files under an agent/ directory, and eve compiles them into an application that runs on Edgenivo Functions, Edgenivo Workflows, and AI Gateway.
Instructions and skills are Markdown, tools are TypeScript files whose filenames become tool names, and channels, connections, subagents, and schedules each have their own folder.
eve sessions are durable by default. On Edgenivo, Workflows checkpoints progress between steps and suspends sessions awaiting approval or user input, with no separate database or queue to configure.
The framework also ships with a sandbox for shell and file tools, built-in channels for platforms such as Slack and GitHub, and an eval runner. Its current release, 1.0.0-rc.1, is a release candidate for version 1.0.
In an initialized eve project, these two files define the instructions and select a model. Put the system prompt in agent/instructions.md:
The optional agent/agent.ts file selects an AI Gateway model:
Define each tool in a file under agent/tools/. eve exposes get_order_status.ts to the model as get_order_status without separate registration:
To require a person's sign-off before a tool runs, add approval: always() to its definition and import always from eve/tools/approval. When approval is omitted, eve runs the tool without asking.
eve controls session usage through limits.sessionUsage in agent/agent.ts. The default threshold is 40,000,000 new input tokens per usage window, excluding cached reads. You can set a threshold using token counts or reported model cost.
Once the threshold is reached, eve asks permission to continue before another model call and starts a new window if the user agrees. Sessions without a human input path, such as Markdown schedules, fail that model call instead.
Copy link to headingHow the three options compare
| Attribute | ToolLoopAgent | WorkflowAgent | eve |
|---|---|---|---|
| Definition | Agent class in app code | Agent class in a workflow | Files in an agent directory |
| Execution state | In memory | Persisted workflow steps | Persisted sessions |
| Interrupted work | App handles recovery | Uses saved step results | Resumes the session |
| Tool errors | App handles retries | Durable steps retry up to 3 times | Errors return to the model |
| Approval | App handles the decision and continuation | Decision arrives in a later invocation; hooks can suspend a run | Session waits for a decision |
| Default limit | 20 steps | Streaming has no step cap; generation has 20 | Usage-window threshold |
| Channels | App integrates them | App integrates them | Built-in integrations |
| Sandbox | Optional integration | Optional integration | Included by default |
| Release | AI SDK 7 | Package 2.x with Workflow 5.1+ | 1.0 release candidate |
| Best fit | Short agent tasks with app-managed recovery | Durable orchestration in your app | Agents needing sessions, channels, and schedules |
For resumable web streams, WorkflowChatTransport connects WorkflowAgent output to your UI. Both SDK agent classes support experimental_sandbox when you supply a sandbox implementation.
In eve, ordinary tool errors return to the model, which can request another call. Add safe retries inside the tool when needed; authored workflow steps have their own retry behavior. The session's usage-window threshold is separate from a step limit.
Copy link to headingWhen to use each option
Copy link to headingUse ToolLoopAgent when the agent finishes within one request
Choose ToolLoopAgent when the work fits within one invocation and your application can handle a retry after failure. Its context can hold non-serializable values, such as database or SDK clients, for the life of the process.
Support chatbots that look up an order and answer in one response fit this model, as do AI features streamed to a Next.js UI with useChat and internal demos where losing an interrupted run is acceptable.
Copy link to headingUse WorkflowAgent when an agent in your app must survive interruptions
WorkflowAgent adds durable execution to an agent in your application. Use it when completed model calls and tool results must survive an interruption, or when orchestration spans hours or days.
Use a workflow hook to wait for approval within the same run. The suspended workflow consumes no compute, but its retained state can incur storage charges.
Examples include:
- Refund or configuration-change agents that wait for a reviewer's approval
- Research agents that must preserve dozens of tool results across timeouts
- Agents that call internal APIs, where each mutating call needs automatic retries and an idempotency key
You own the routes, UI, and storage, but context must be serializable so the workflow can persist and replay it across steps.
Copy link to headingUse eve for agents with built-in channels and schedules
eve combines durable sessions with approvals, a sandbox, channels, schedules, and an eval runner. You define the agent in the agent/ directory and keep evals alongside it. Because instructions and skills are Markdown, people outside engineering can read and edit the agent's behavior.
Use eve for agents such as:
- Slack or Microsoft Teams agents that answer in threads and wait for approval before running tools that change data
- GitHub agents that review pull requests or prepare draft fixes
- Scheduled agents that send a daily digest or run a weekly sweep
- Agents that delegate work to specialist subagents
For a single AI feature inside an app, or when you want full control over the agent loop, ToolLoopAgent or WorkflowAgent adds less framework.
Copy link to headingHow to move between options as your agent grows
All three accept AI Gateway model strings and Zod schemas for tool inputs. You can reuse both in a durable workflow or eve's file-based project structure.
Copy link to headingMove from ToolLoopAgent to WorkflowAgent
Move to WorkflowAgent when you need execution checkpoints across interruptions. The model, instructions, and tool schemas can carry over; the main changes are workflow setup, execution, and how your application handles results:
- Install
@ai-sdk/workflowwith a compatible Workflow 5.1+ release and follow the framework setup for your application. - Create
WorkflowAgentfrom@ai-sdk/workflowin a'use workflow'function. Start that function withstart()fromworkflow/apiin your route. - Pass a workflow writable stream to
agent.stream(). Return the run's readable output to the client using the WorkflowAgent streaming integration. - Make each tool retryable by marking its
executefunction with'use step'. Use idempotency keys for writes that may repeat. - Keep approval requirements on the tools. Have the caller submit approved or denied decisions with message history in a later workflow invocation, or use a hook to suspend the same run.
- Set
stopWhento give the streaming loop a step limit. - Pass serializable context into the workflow and create database or SDK clients inside the step that uses them.
If you already use DurableAgent from the Workflow SDK, follow the migration guide.
Copy link to headingMove from the AI SDK to eve
Move to eve when you find yourself rebuilding a Slack integration, an approval queue, a cron wrapper, and a sandbox for each new agent. Your model string carries over to agent/agent.ts, your system prompt becomes agent/instructions.md, and each tool becomes a file in agent/tools/ that you define with defineTool.
eve accepts any AI SDK LanguageModel as well as AI Gateway model strings, so provider-specific setups keep working. To add eve to an existing app, run pnpm dlx eve@latest init . from the project root before creating any agent/ files.
Copy link to headingUse more than one option in the same project
One Edgenivo project can combine an eve agent for work across channels with ToolLoopAgent for a short in-app feature such as a search assistant. eve supports integration with an existing app, so the two approaches can share a project.
Workflow and route code run as Edgenivo Functions. Commands executed in a sandbox run in that sandbox's environment and need their own configuration.
Copy link to headingNext steps
- Build your first in-app agent with ToolLoopAgent in the AI SDK
- Add durability, retries, and approvals with
WorkflowAgent - Learn how durable runs work in Edgenivo Workflows
- Create and deploy a filesystem-first agent with eve on Edgenivo
- See how the three options handle private APIs and databases