---
title: Eve agent framework
description: Build Eve agents that learn from feedback, personalize how they help each user, and choose effective actions for the task at hand.
---

Learn about the Eve agent framework in [Vercel’s overview](https://vercel.com/eve) and the [official Eve docs](https://eve.dev/docs).

## Why add Spacefolder to your Eve agents?

Eve is Vercel’s framework for building agents. Spacefolder lets an agent use what happened on earlier requests to decide how to help this user now. A personal assistant might learn that someone acts on reminders in their daily digest but dismisses them during meetings. A support agent might learn which response helps a customer resolve a return.

**Coding agent benchmark**

On Eve coding agents, Spacefolder reached useful evidence <strong class="eve-benchmark-metric">4.41× faster</strong> with a <strong class="eve-benchmark-metric">2.89× reduction in tokens</strong>. [See the benchmark](/docs/benchmarks/eve-coding-agent)

You choose what a good outcome means. For reminder timing, the goal can be getting the task done with fewer interruptions. For recommendations, it can be helping the user find an item they want. The Spacefolder benchmarks explore both kinds of decisions. [**Reminder timing on generated histories**](/docs/benchmarks/personal) · [**Shopping recommendations on public data**](/docs/benchmarks/shopping) · [**All benchmarks**](/docs/benchmarks)

## Install the extension

From the root of an Eve project running Node 24+, use `eve add` to install the Spacefolder extension from npm and create `agent/extensions/spacefolder.ts`. The extension includes `@spacefolder/sdk` as a dependency. [Install integrations in Eve](https://eve.dev/docs/install-integrations)

```sh
npx eve add https://www.spacefolder.com/docs/r/spacefolder.json
```

For a manual install, run `npm install @spacefolder/eve` and create `agent/extensions/spacefolder.ts` with the configuration below.

Set your World ID and workspace key in the environment that runs the agent. [Create a World and key](/docs/get-started)

```sh
export SPACEFOLDER_WORLD_ID='<your World ID>'
export SPACEFOLDER_API_KEY='<your workspace key>'
```

## Configure a decision

Choose a decision your agent makes repeatedly. The starter skips a turn when `navigate` returns `null`. To guide a decision, return the context available when the agent acts, its possible actions, and the outcome you want to predict. Use `horizon` to specify how long after the decision that outcome counts. [Decision context and actions](/docs/concepts/primitives#context) · [How Eve mounts extensions](https://eve.dev/docs/extensions)

This example assumes your agent already has tools named `notify_now` and `add_to_digest`. It uses the signed-in user’s ID and whether the request mentions a meeting to choose when to send a reminder. Success means the user completes the task within a day.

```ts
import spacefolder from "@spacefolder/eve";

export default spacefolder({
  navigate(ctx) {
    const request = ctx.turn?.input.find((part) => part.kind === "text")?.text;
    const userId = ctx.session.auth.current?.principalId;
    const world = process.env.SPACEFOLDER_WORLD_ID;
    if (!world || !userId || !request || !/\bremind(?:er)?\b/i.test(request)) return null;

    return {
      world,
      context: { user: { id: userId }, mentionsMeeting: /\bmeeting\b/i.test(request) },
      options: {
        notify_now: "Use notify_now to send the reminder immediately.",
        add_to_digest: "Use add_to_digest to include it in the user's next daily digest.",
      },
      outcome: "task.completed",
      horizon: "1d",
    };
  },
  fold(observation, candidates) {
    if (observation.kind === "tool" && candidates.includes(observation.name)) {
      return observation.name;
    }
    return null;
  },
});
```

**Navigate** compares how likely each option is to lead to the configured outcome. When it can score an option, Eve receives the corresponding suggestion. If Navigate returns no scores, Eve proceeds without a suggestion. In either case, **Fold** records the tool Eve actually used when that tool completes. [Navigate API reference](/docs/reference/api/navigate/navigate) · [Dynamic instructions in Eve](https://eve.dev/docs/guides/dynamic-capabilities)

## Record the outcome

Keep the Spacefolder decision ID with the item your agent acted on. When your application observes the outcome, use `foldEvent` to record it in the same World with that decision ID. For a local test, the ID is the `episode` value in the `Spacefolder Navigate` log.

In the reminder example, call this function when the user marks the task complete:

```ts
import { foldEvent, SpacefolderClient } from "@spacefolder/eve/experience";

export async function recordCompletion(world: string, decisionId: string, completedAt: Date) {
  await foldEvent(
    new SpacefolderClient(),
    { world, id: decisionId },
    "task.completed",
    completedAt.toISOString(),
    decisionId + "-completed",
  );
}
```

If the user dismisses the reminder, record `reminder.dismissed` with its own event ID. Linking each response to the original decision lets Spacefolder learn which timing works for that user. [Fold and events](/docs/concepts/primitives#fold) · [Fold API reference](/docs/reference/api/fold/fold)
