Skip to content

LearnTutorials

Build and deploy an AI agent with eve

Build an AI agent with Vercel's eve framework that posts a news digest to Slack each weekday morning, then deploy it, in 30 minutes.

By Recaply EditorsAdvanced30 min6 stepsUpdated

A hand winds an alarm clock that sits on a small box, as a paper airplane flies off

What you need

  1. Step 1: Create the project

    3 min

    One command builds the folders, installs what the agent needs and opens a chat with it.

    1. In a terminal, run the command below. Swap my-agent for your project's name.
    2. If eve asks you to connect a model, pick one in the /login menu: a ChatGPT subscription, your Vercel account or an API key.
    3. Type a short hello in the chat to check that the agent answers.
    Run this
    npx eve@latest init my-agent

    You should see a new my-agent folder with an agent/ folder inside, and a chat open in your terminal.

    The command fails on your Node.js version?

    eve needs Node.js 24 or newer. Run node -v to check, install a newer release, then run the command again.

    To get back to this chat later, run npx eve dev in the project folder. It reloads as you edit files.

  2. Step 2: Give the agent its job

    4 min

    The instructions file is the agent's standing brief, and eve sends it with every model call.

    1. Open agent/instructions.md and replace its text with the brief below. Fill in your team and topic.
    2. To pick a model, type /model in the chat and choose one, such as anthropic/claude-opus-5.5.
    Your instructions
    You are the news scout for [YOUR TEAM].
    Each time you run, get the top Hacker News stories with the get_top_stories tool.
    Pick the 5 stories that matter most to people who work on [YOUR TOPIC].
    For each one, write one plain sentence on why it matters, then its link.
    If nothing fits, say so in one line. Never make up a story or a link.

    You should see the agent describing its new role when you ask what it does.

    The agent still acts as before?

    Check the file is saved as agent/instructions.md. Then type /new in the chat to start a fresh session and ask again.

    With no agent/agent.ts file, eve uses openai/gpt-6-luna-fast. A model ID like anthropic/claude-opus-5.5 runs through AI Gateway.

  3. Step 3: Add a tool

    7 min

    A tool is a TypeScript function the agent can call, and its file name becomes the tool's name.

    1. Create the file agent/tools/get_top_stories.ts and paste in the code below.
    2. Save it. eve picks up the new tool on its own.
    3. In the chat, ask: What are the top stories right now?
    Your tool
    import { defineTool } from "eve/tools";
    import { z } from "zod";
    
    const HN = "https://hacker-news.firebaseio.com/v0";
    
    export default defineTool({
      description: "Get the current top Hacker News stories, with title, link and score.",
      inputSchema: z.object({ limit: z.number().int().min(1).max(30).default(20) }),
      async execute({ limit }) {
        const ids: number[] = await fetch(`${HN}/topstories.json`).then((r) => r.json());
        const stories = await Promise.all(
          ids.slice(0, limit).map((id) => fetch(`${HN}/item/${id}.json`).then((r) => r.json())),
        );
        return stories.map((s) => ({
          title: s.title,
          url: s.url ?? `https://news.ycombinator.com/item?id=${s.id}`,
          score: s.score,
        }));
      },
    });

    You should see a call to get_top_stories in the chat, then a short list of real headlines with links.

    The agent answers without calling the tool?

    Name the tool in your instructions, as the brief in step 2 does. Make sure its description says exactly what it returns.

    Tools run without asking by default. For a tool that sends, deletes or buys something, add approval: always() from eve/tools/approval, so a person approves each call.

  4. Step 4: Connect Slack

    6 min

    A channel is where people reach the agent and where its replies land.

    1. In the chat, type /add channel/slack.
    2. Follow the setup. It signs you in to Vercel, links a project and creates a Slack app.
    3. Install the app in your workspace when Slack asks. Then invite it to the channel where it should post.

    You should see a new file, agent/channels/slack.ts, in your project.

    Setup stopped halfway?

    Run npx eve add channel/slack in the project folder. It runs only the steps that are still missing.

    With this setup, Vercel keeps the Slack bot token for you. Never paste tokens into files you commit.

  5. Step 5: Schedule a morning post

    5 min

    A schedule wakes the agent on a timer, with no one asking, and sends its reply to Slack.

    1. In Slack, open the channel's details and copy its channel ID. It looks like C0123ABC.
    2. Create agent/schedules/morning-news.ts, paste the code below and put in your channel ID.
    3. Run npx eve info to check that eve found the schedule.
    Your schedule
    import { defineSchedule } from "eve/schedules";
    
    import slack from "../channels/slack";
    
    export default defineSchedule({
      cron: "0 9 * * 1-5",
      async run({ to, waitUntil, appAuth }) {
        waitUntil(
          to(slack, { channelId: "[YOUR CHANNEL ID]" }).send(
            "Post this morning's top 5 stories for the team.",
            { auth: appAuth },
          ),
        );
      },
    });

    You should see morning-news listed among the agent's files, with no errors.

    Nothing ever posts in the channel?

    eve dev never runs schedules on their timer, so they start firing once you deploy. Also check that the Slack app is a member of the channel.

    0 9 * * 1-5 means 9:00 on weekdays. On Vercel, schedules run on UTC time, so shift the hour to match yours.

  6. Step 6: Deploy and watch it run

    5 min

    Deploying puts the agent, its schedule and its Slack channel on Vercel, so it runs while your laptop is off.

    1. In the chat, type /deploy. Or run npx eve deploy in the project folder.
    2. Open the project on Vercel and check that Settings > Cron Jobs lists your schedule.
    3. Mention the agent in Slack to test it. Then find the session under Observability > Agent Runs.

    You should see your schedule under Settings > Cron Jobs, and a reply in a Slack thread when you mention the agent.

    There's no Agent Runs tab?

    Agent Runs is in beta and has to be on for your Vercel team. Until then, read each run's logs under Observability > Logs.

    Keep API keys in the Vercel project's environment settings, never in files you commit.

You get

An AI agent on Vercel that reads the news each weekday morning, posts a short digest to Slack and answers when someone mentions it

Did this guide work for you?

Sources