### Initialize a New Eve Agent Source: https://eve.dev/docs/getting-started Use this command to quickly set up a new Eve agent project. It creates a directory, installs dependencies, initializes Git, and starts the development server. ```bash npx eve@latest init my-agent ``` -------------------------------- ### Scaffold a New Eve Project Source: https://eve.dev/docs/getting-started Use this command to scaffold a new Eve project. It installs dependencies, initializes Git, and starts the development server. Stop the server with Ctrl+C before making edits. ```bash npx eve@latest init ``` -------------------------------- ### Install Vercel Connect Package Source: https://eve.dev/docs/channels/slack Install the necessary Vercel Connect package for Slack channel integration. ```bash npm install @vercel/connect ``` -------------------------------- ### Start a Session with curl Source: https://eve.dev/docs/channels/eve Demonstrates how to start a new session with the Eve channel using a curl command. It includes the necessary headers and a minimal JSON body. ```bash curl -X POST https:///eve/v1/session \ -H "Content-Type: application/json" \ -d '{"message":"What is the weather in Paris?"}' # {"continuationToken":"eve:7f3c...","ok":true,"sessionId":"ses_01h..."} ``` -------------------------------- ### Start Eve Project Source: https://eve.dev/docs/reference/cli Serves the previously built output. Optionally specify the host and port to listen on. Prints the listening URL. ```bash eve start [--host ] [--port ] ``` -------------------------------- ### Install Eve Dependencies Manually Source: https://eve.dev/docs/getting-started Install the core Eve package along with necessary AI and Zod dependencies when wiring Eve into an existing app by hand. ```bash npm install eve@latest ai zod ``` -------------------------------- ### Re-resolve Tools on Turn Start Source: https://eve.dev/docs/guides/dynamic-capabilities This example shows how to re-resolve dynamic tools on `turn.started` to replace tools defined by `session.started`. This allows for tools to be updated or changed mid-session, making them available for subsequent model calls within the same turn. ```typescript import { defineDynamic, defineTool } from "eve/tools"; import { z } from "zod"; import { runReadOnly, searchCatalog } from "../lib/catalog.js"; export default defineDynamic({ events: { "session.started": async (_event, ctx) => ({ query: defineTool({ description: "Run a read-only query.", inputSchema: z.object({ sql: z.string() }), execute: ({ sql }) => runReadOnly(sql), }), }), // On each turn, re-resolve. Replaces this file's session.started tools for later calls. "turn.started": async (_event, ctx) => ({ search: defineTool({ description: "Search the catalog.", inputSchema: z.object({ term: z.string() }), execute: ({ term }) => searchCatalog(term), }), }), }, }); ``` -------------------------------- ### Deploy Eve Application with Vercel CLI Source: https://eve.dev/docs/guides/deployment Use this command to deploy your application to Vercel. Ensure you have the Vercel CLI installed and are logged in. ```bash vercel deploy ``` -------------------------------- ### Run a Scaffolded Eve App Source: https://eve.dev/docs/getting-started Use this command to start a development server for a scaffolded Eve application. Ensure you are in the app's root directory. ```bash npm run dev ``` -------------------------------- ### Configure Node Runtime for Eve Source: https://eve.dev/docs/getting-started Declare a compatible Node.js runtime version in your `package.json` when manually installing Eve. ```json { "engines": { "node": "24.x" } } ``` -------------------------------- ### Eval File Structure Example Source: https://eve.dev/docs/evals/overview Illustrates the typical directory structure for organizing eval files within an Eve agent project. ```text my-agent/ ├── agent/ ├── evals/ │ ├── evals.config.ts │ ├── smoke.eval.ts │ └── weather/ │ ├── brooklyn-forecast.eval.ts │ └── no-tools-for-greetings.eval.ts └── package.json ``` -------------------------------- ### Start a Session Source: https://eve.dev/docs/channels/eve Initiates a new session with the agent. The response includes a sessionId and a continuationToken for subsequent requests. ```APIDOC ## POST /eve/v1/session ### Description Starts a new session with the agent. ### Method POST ### Endpoint /eve/v1/session ### Request Body - **message** (string) - Required - The user's initial message. ### Request Example ```json { "message": "What is the weather in Paris?" } ``` ### Response #### Success Response (200) - **sessionId** (string) - The unique identifier for the session. - **continuationToken** (string) - A token to be used for subsequent follow-up messages. - **ok** (boolean) - Indicates if the request was successful. ``` -------------------------------- ### Add Eve to an Existing Project Source: https://eve.dev/docs/getting-started To integrate Eve into an existing application, use this command. Alternatively, you can manually install the necessary dependencies. ```bash eve init . ``` -------------------------------- ### Skill Description Example Source: https://eve.dev/docs/skills Use this format for the description frontmatter in a skill's markdown file. It acts as a routing hint for the model. ```markdown Use when the user needs a release checklist or changelog workflow. ``` -------------------------------- ### Start a Session with a Message Source: https://eve.dev/docs/concepts/sessions-runs-and-streaming Use this endpoint to initiate a new session with an initial message. The response includes session and continuation tokens, and the session ID is provided in the `x-eve-session-id` header. ```bash curl -X POST http://127.0.0.1:3000/eve/v1/session \ -H 'content-type: application/json' \ -d '{"message":"Summarize the latest forecast."}' ``` -------------------------------- ### Slack Channel Agent Setup Source: https://eve.dev/docs/channels/slack Configure the Slack channel agent using `connectSlackCredentials` for secure credential management. ```typescript import { connectSlackCredentials } from "@vercel/connect/eve"; import { slackChannel } from "eve/channels/slack"; export default slackChannel({ credentials: connectSlackCredentials("slack/my-agent"), }); ``` -------------------------------- ### Configure Auth Channels Source: https://eve.dev/docs/guides/auth-and-route-protection Set up authentication by defining an array of authentication functions for your Eve channel. This example includes local development, Vercel OIDC, and a placeholder for production. ```typescript import { eveChannel } from "eve/channels/eve"; import { localDev, placeholderAuth, vercelOidc, } from "eve/channels/auth"; export default eveChannel({ auth: [localDev(), vercelOidc(), placeholderAuth()] }); ``` -------------------------------- ### Develop Eve Project Locally Source: https://eve.dev/docs/reference/cli Starts a local development server for the Eve project. Can connect to a remote server using a URL. The interactive UI is disabled in non-TTY terminals. ```bash eve dev [options] eve dev https://your-app.vercel.app ``` -------------------------------- ### Model-Authored Workflow Example Source: https://eve.dev/docs/guides/dynamic-workflows This JavaScript code demonstrates how a model can orchestrate subagents. It fans out calls to the 'analyst' subagent for multiple metrics and then joins their findings. ```javascript const metrics = ["revenue", "signups", "churn"]; const findings = await Promise.all( metrics.map((metric) => tools.analyst({ message: `Summarize last week's ${metric}.` })) ); return findings.join("\n\n"); ``` -------------------------------- ### Deploy Agent to Vercel Production Source: https://eve.dev/docs/reference/cli Deploys the agent to Vercel production, installing dependencies and pulling environment variables. Handles interactive linking for unlinked directories. ```bash eve deploy ``` -------------------------------- ### Start Eve Agent TUI Source: https://eve.dev/docs/guides/dev-tui Launches the local runtime and enters an interactive terminal UI for the Eve agent. Use this to chat, stream, approve tools, and answer questions. ```bash eve dev ``` -------------------------------- ### Run Analysis Prompt Source: https://eve.dev/docs/tutorial/run-analysis Example prompt to ask the analytics assistant to perform an analysis beyond plain SQL, such as plotting total order revenue per customer. This leverages the seeded schema and custom tools like chart_series. ```text Plot total order revenue per customer. ``` -------------------------------- ### Start a Durable Session via HTTP API Source: https://eve.dev/docs/getting-started Initiate a new session with your Eve application by sending a POST request to the session endpoint. This command requires the 'content-type' header and a JSON payload with a message. ```bash curl -X POST http://127.0.0.1:3000/eve/v1/session \ -H 'content-type: application/json' \ -d '{"message":"What is the weather in Brooklyn?"}' ``` -------------------------------- ### Define a Custom HTTP/WebSocket Channel Source: https://eve.dev/docs/channels/custom Defines a custom channel with POST and GET routes, and an event handler. Use POST to send messages and start/resume sessions, and GET to stream session events. The `send` helper starts or resumes a session, while `getSession` retrieves an existing one for streaming. ```typescript import { defineChannel, GET, POST } from "eve/channels"; export default defineChannel({ routes: [ POST("/message", async (req, { send }) => { const body = await req.json(); const session = await send(body.message, { auth: null, continuationToken: body.token, }); return Response.json({ sessionId: session.id }); }), GET("/sessions/:sessionId/stream", async (_req, { getSession, params }) => { const session = getSession(params.sessionId); const stream = await session.getEventStream(); return new Response(stream, { headers: { "content-type": "application/x-ndjson; charset=utf-8" }, }); }), ], events: { "message.completed"(event, channel, ctx) { // deliver completed messages back to the surface that owns this channel }, }, }); ``` -------------------------------- ### Set up Slack Connect Client Source: https://eve.dev/docs/channels/slack Use these commands to set up a Slack Connect client and configure it as a trigger destination for your project. Ensure the Vercel CLI is updated and the FF_CONNECT_ENABLED feature flag is set. The `--triggers` flag is crucial for enabling Slack Event Subscriptions. ```bash npm install -g vercel@latest && export FF_CONNECT_ENABLED=1 vercel connect create slack --triggers vercel connect detach --yes vercel connect attach --triggers --trigger-path /eve/v1/slack --yes ``` -------------------------------- ### Send a Message with Svelte Source: https://eve.dev/docs/guides/frontend/use-eve-agent-svelte Use the `useEveAgent` hook to get an agent instance and send messages from a Svelte component. This example shows a basic form for user input and sending it via `agent.send()`. ```svelte
{ event.preventDefault(); void handleSubmit(); }}>
``` -------------------------------- ### Create a Client Instance Source: https://eve.dev/docs/guides/client/overview Instantiate the `Client` to connect to an Eve host. Configure the host origin, authentication, header policies, and stream reconnection budget. ```typescript import { Client } from "eve/client"; const client = new Client({ host: "http://127.0.0.1:3000", }); ``` -------------------------------- ### Define Agent Instrumentation Source: https://eve.dev/docs/guides/instrumentation Use `defineInstrumentation` to set up your agent's OpenTelemetry configuration. The `setup` callback receives the resolved agent name and is used to register your OpenTelemetry provider, such as `registerOTel` from `@vercel/otel`. This example configures the Braintrust exporter. ```typescript import { BraintrustExporter } from "@braintrust/otel"; import { defineInstrumentation } from "eve/instrumentation"; import { registerOTel } from "@vercel/otel"; export default defineInstrumentation({ setup: ({ agentName }) => registerOTel({ serviceName: agentName, traceExporter: new BraintrustExporter({ parent: `project_name:${agentName}`, filterAISpans: true, }), }), }); ``` -------------------------------- ### Prompt for Setting Up an Eve Agent Source: https://eve.dev/docs/getting-started This prompt is designed for coding agents to set up an Eve agent. It outlines the steps for installation, scaffolding, tool creation, and API interaction. Follow the instructions carefully, especially regarding running and stopping the development server. ```text Set up an Eve agent for the user. Eve is a filesystem-first TypeScript framework for durable agents, published as the npm package eve. Read its docs: once eve is installed they are bundled in the package at node_modules/eve/docs; before eve is installed, read the published Introduction and Getting Started pages. If the project has no Eve app, scaffold one with `npx eve@latest init `; add `--channel-web-nextjs` only when the user wants Web Chat. The init command installs dependencies, initializes Git, and starts the dev server, so run it in a controllable process and stop it with Ctrl+C before editing. To add Eve to an existing app, run `eve init .`, or install the dependencies by hand with `npm install eve@latest ai zod` (init adds ai and zod; the by-hand path needs all three). Make sure agent/agent.ts and agent/instructions.md exist, then add a first typed tool at agent/tools/get_weather.ts using defineTool from eve/tools with a Zod inputSchema and an inline execute. Start the dev server again, then exercise the HTTP API: create a session with POST /eve/v1/session, attach to GET /eve/v1/session/:id/stream, and send a follow-up with the returned continuationToken. Verify with the project's typecheck, adapt model and provider choices to the project, and do not commit unless the user asks. ``` -------------------------------- ### Initialize a new agent project Source: https://eve.dev/docs/reference/cli Use `eve init` to scaffold a new agent project. Specify a target name to create a new directory, or use `.` to initialize in the current directory. The `--channel-web-nextjs` flag adds a Next.js web chat application. ```bash eve init [target] [--channel-web-nextjs] ``` -------------------------------- ### Eval Target Example Source: https://eve.dev/docs/evals/targets This example demonstrates how to use `t.target` within an eval to interact with a running service. It dispatches a schedule, attaches a session, and asserts completion and tool calls. ```typescript import { defineEval } from "eve/evals"; export default defineEval({ async test(t) { const { sessionIds } = await t.target.dispatchSchedule("heartbeat"); await t.target.attachSession(sessionIds[0]!); t.completed(); t.calledTool("send_report"); }, }); ``` -------------------------------- ### Deploy with Experimental Frameworks Enabled Source: https://eve.dev/docs/channels/slack Deploy the Slack channel integration to Vercel, ensuring experimental frameworks are enabled for Eve recognition. ```bash VERCEL_USE_EXPERIMENTAL_FRAMEWORKS=1 vercel deploy --prod ``` -------------------------------- ### Start a Durable Session Source: https://eve.dev/docs/getting-started Initiates a new durable session for interacting with the Eve application via HTTP. ```APIDOC ## Start a Durable Session Initiates a new durable session for interacting with the Eve application. ### Method POST ### Endpoint `/eve/v1/session` ### Request Body - **message** (string) - Required - The initial message to send to the session. ### Request Example ```json { "message": "What is the weather in Brooklyn?" } ``` ### Response #### Success Response (200) - **continuationToken** (string) - A token to resume this conversation. - **x-eve-session-id** (string) - The header that identifies the run to stream. ``` -------------------------------- ### Scaffold the agent Source: https://eve.dev/docs/tutorial/first-agent Use this command to initialize a new agent project with the Eve framework. Navigate into the created directory before proceeding. ```bash npx eve@latest init analytics-assistant cd analytics-assistant ``` -------------------------------- ### Base Agent Identity with instructions.md Source: https://eve.dev/docs/concepts/context-control Use `instructions.md` to define the core contract and stable behavior for your agent. This file is always included in the agent's context. ```markdown You are a careful support assistant. Be concise, verify facts before replying, and explain when you used a tool. ``` -------------------------------- ### Run Eve Binary Directly Source: https://eve.dev/docs/getting-started If your project does not have a 'dev' script, execute the Eve binary directly using npx. This is useful for projects without a package.json script. ```bash npx eve dev ``` -------------------------------- ### Arbitrary GitHub API Calls Source: https://eve.dev/docs/channels/github Make arbitrary GitHub API calls using ctx.github.request, which is authenticated with the installation token. ```typescript ctx.github.request({ method, path, body }) ``` -------------------------------- ### Send a Follow-up Message Source: https://eve.dev/docs/channels/eve Sends a follow-up message within an existing session. Requires the sessionId obtained from starting a session. ```APIDOC ## POST /eve/v1/session/:sessionId ### Description Sends a follow-up message within an existing session. ### Method POST ### Endpoint /eve/v1/session/:sessionId ### Parameters #### Path Parameters - **sessionId** (string) - Required - The ID of the session to send the follow-up to. ### Request Body - **message** (string) - Required - The user's follow-up message. - **continuationToken** (string) - Required - The continuation token obtained from the session start response. ### Response #### Success Response (200) - **continuationToken** (string) - The updated continuation token for the session. - **ok** (boolean) - Indicates if the request was successful. ``` -------------------------------- ### Static Instructions Source: https://eve.dev/docs/instructions Use a markdown file for static instructions that define the agent's identity, tone, and standing rules. ```markdown You are a concise assistant. Use tools when they are available. ``` -------------------------------- ### Ask an initial question Source: https://eve.dev/docs/tutorial/first-agent Interact with the running agent by asking a question. This initial question tests the agent's basic functionality and persona. ```text What's a good way to measure week-over-week retention? ``` -------------------------------- ### Render AgentChat in Page Source: https://eve.dev/docs/tutorial/ship-it The `app/page.tsx` file imports and renders the `AgentChat` component. Ensure this setup is in place to display the chat interface. ```typescript import { AgentChat } from "@/app/_components/agent-chat"; export default function Page() { return ; } ``` -------------------------------- ### Run Eve Binary with Deployment URL Source: https://eve.dev/docs/getting-started Test a deployed Eve application by providing its URL to the 'npx eve dev' command. This is helpful for preview and production smoke tests. ```bash npx eve dev https://your-app.vercel.app ``` -------------------------------- ### Add a Platform Channel Source: https://eve.dev/docs/getting-started After initial setup, use this command to add a platform channel, such as Slack, to your Eve agent from an interactive terminal. ```bash eve channels add slack ``` -------------------------------- ### Get information about the current project Source: https://eve.dev/docs/reference/cli Run `eve info` to quickly check project status, discover files, and view active surfaces without booting the dev server. Use the `--json` flag to output the information in JSON format. ```bash eve info [--json] ``` -------------------------------- ### Get Skill Handle Source: https://eve.dev/docs/guides/session-context Obtain a handle for a named skill visible to the current agent. File content is read lazily from the active sandbox. ```typescript const skill = ctx.getSkill("research"); const notes = await skill.file("references/checklist.md").text(); ``` -------------------------------- ### Define a hook Source: https://eve.dev/docs/guides/hooks Defines a hook that subscribes to session started and message completed events. It logs information to the console for each event. Import `defineHook` from `eve/hooks`. ```typescript import { defineHook } from "eve/hooks"; export default defineHook({ events: { async "session.started"(_event, ctx) { console.info("session started", { sessionId: ctx.session.id }); }, async "message.completed"(event) { console.info("model finished", { length: event.data.message?.length ?? 0 }); }, }, }); ``` -------------------------------- ### Sample In-Memory SQLite Database Source: https://eve.dev/docs/tutorial/query-sample-data Sets up a toy SQLite database in memory for testing purposes. It includes a predefined schema and seed data for orders and customers. This is intended as a temporary stand-in for a real data warehouse. ```typescript import initSqlJs from "sql.js"; const SEED = ` CREATE TABLE orders (id INTEGER, customer_id INTEGER, amount_cents INTEGER, created_at TEXT); INSERT INTO orders VALUES (1, 10, 4200, '2026-05-01'), (2, 10, 1500, '2026-05-03'), (3, 11, 9900, '2026-05-04'), (4, 12, 800, '2026-05-06'); CREATE TABLE customers (id INTEGER, name TEXT, plan TEXT); INSERT INTO customers VALUES (10, 'Acme', 'pro'), (11, 'Globex', 'enterprise'), (12, 'Initech', 'free'); `; let dbPromise: Promise | null = null; async function db() { dbPromise ??= initSqlJs().then((SQL) => { const database = new SQL.Database(); database.run(SEED); return database; }); return dbPromise; } export async function runReadOnlySql(sql: string) { const database = await db(); const [result] = database.exec(sql); if (!result) return { columns: [], rows: [] as unknown[][] }; return { columns: result.columns, rows: result.values }; } ``` -------------------------------- ### Define Custom Eve Authentication Channels Source: https://eve.dev/docs/guides/frontend/sveltekit Create `agent/channels/eve.ts` to define custom authentication policies for your Eve agent. This example uses `localDev` and `vercelOidc`. ```typescript import { eveChannel } from "eve/channels/eve"; import { localDev, vercelOidc } from "eve/channels/auth"; export default eveChannel({ auth: [localDev(), vercelOidc()] }); ``` -------------------------------- ### Define an analyst persona Source: https://eve.dev/docs/tutorial/first-agent Replace the default instructions with a persona for a senior data analyst. This prompt guides the agent's behavior and response style. ```markdown You are a senior data analyst. You answer questions about the team's data. - Prefer exact numbers to hand-waving. If you can compute it, compute it. - State the assumptions behind any number you report (date range, filters, grain). - Use the tools available to you rather than guessing. If you cannot answer from the data, say so plainly. ``` -------------------------------- ### Test Deployment with Eve Dev Source: https://eve.dev/docs/tutorial/ship-it Run this command to smoke-test your deployed web app and Eve runtime using the Vercel CLI. ```bash npx eve dev https://your-analytics-app.vercel.app ``` -------------------------------- ### Matcher for t.calledTool with Input and Error Check Source: https://eve.dev/docs/evals/assertions Assert that a specific tool was called with a command starting with 'pwd' and that it did not result in an error. Ensures the tool was invoked correctly. ```typescript t.calledTool("bash", { input: { command: /^pwd/ }, isError: false, times: 1 }); ``` -------------------------------- ### Restricted Linear Channel Dispatch by Team/Project Source: https://eve.dev/docs/channels/linear This snippet restricts dispatch to Linear issues starting with 'OPS-'. It also adds a contextual note for reversible changes. ```typescript import { defaultLinearAuth, linearChannel } from "eve/channels/linear"; export default linearChannel({ onAgentSession: (_ctx, event) => { if (event.agentSession.issue?.identifier?.startsWith("OPS-") !== true) return null; return { auth: defaultLinearAuth(event), context: ["Only make reversible changes unless the issue says otherwise."], }; }, }); ``` -------------------------------- ### Define Dynamic Instructions Based on Plan Source: https://eve.dev/docs/guides/dynamic-capabilities Implement dynamic instructions that resolve a per-session system prompt based on the caller's subscription plan. This is resolved on `session.started`. ```typescript import { defineDynamic, defineInstructions } from "eve/instructions"; export default defineDynamic({ events: { "session.started": (_event, ctx) => { const plan = ctx.session.auth.current?.attributes.plan ?? "free"; return defineInstructions({ markdown: `The caller is on the ${plan} plan. Match the depth of your answers to it.`, }); }, }, }); ``` -------------------------------- ### Reconnect to a session stream with startIndex Source: https://eve.dev/docs/concepts/sessions-runs-and-streaming Reconnect to a durable session stream by specifying the startIndex to resume from a specific event count. This allows picking up where you left off or rewinding to the start. ```bash curl "http://127.0.0.1:3000/eve/v1/session//stream?startIndex=" ``` -------------------------------- ### Eve Agent TUI Startup Information Source: https://eve.dev/docs/guides/dev-tui Displays agent name and a rotating tip on startup. Also shows error and warning counts if agent discovery reported problems. ```text eve weather-agent Use /channels to add more ways to reach your agent. ``` -------------------------------- ### Override Default Tool Source: https://eve.dev/docs/concepts/default-harness Override a default tool by creating a new tool with the same slug. This example shows how to wrap the default `writeFile` tool to add custom logging. ```typescript import { defineTool } from "eve/tools"; import { writeFile } from "eve/tools/defaults"; export default defineTool({ ...writeFile, // keep the default description, schema, and executor async execute(input, ctx) { console.log("[write_file]", input.path); return writeFile.execute(input, ctx); }, }); ``` -------------------------------- ### Custom Message Handling for Teams Channel Source: https://eve.dev/docs/channels/teams Customize message handling logic for the Teams channel. This example filters for personal messages or channel messages that mention the bot. ```typescript import { defaultTeamsAuth, teamsChannel } from "eve/channels/teams"; export default teamsChannel({ onMessage(ctx, message) { if (message.scope !== "personal" && !message.isBotMentioned) return null; return { auth: defaultTeamsAuth(message) }; }, }); ``` -------------------------------- ### List project channels Source: https://eve.dev/docs/reference/cli Use `eve channels list` to display a list of user-authored channels in the current project. Add the `--json` flag to output the list in JSON format. ```bash eve channels list [--json] ``` -------------------------------- ### Aggregate a Turn's Result Source: https://eve.dev/docs/guides/client/streaming Use `response.result()` to consume the entire event stream for a turn and get the final summary. This is suitable when you only need the completed message and its status. ```typescript const response = await session.send("Summarize the latest forecast."); const result = await response.result(); console.log(result.status); console.log(result.message); console.log(result.events.length); ``` -------------------------------- ### Example Trace Hierarchy Source: https://eve.dev/docs/guides/instrumentation Illustrates the hierarchical structure of traces generated by Eve for a single turn, showing parent spans for turns and child spans for model calls and tool executions. Contextual information like session ID and step index is embedded. ```text ai.eve.turn {eve.session.id} +-- ai.streamText step 1 | +-- ai.streamText.doStream model call | +-- ai.toolCall {toolName: search} tool exec +-- ai.streamText step 2 | +-- ai.streamText.doStream | +-- ai.toolCall {toolName: read} +-- ai.streamText step 3 (final text) ```