Skip to content

Build agents

Experimental. Experimental.Memory, Experimental.Eval, Experimental.Scorer and Experimental.Test need { "vibe": { "experimental": ["builtins"] } } in tsconfig.json or vibe.config.json. Both files take the same "vibe" object. Without it, the compiler reports EK3013. A release can change or remove it.

An agent is a program that asks a language model what to do next, runs what the model asks for, and repeats until the model gives an answer. This guide builds one in Vibe. It starts with a complete agent that runs offline, then explains each part: the model, the loop, tools, MCP servers, memory, permissions, secrets and evals.

The other modules on this page (Experimental.Model, Experimental.Agent, Experimental.Tools, Experimental.McpClient, Experimental.Capability and Experimental.Secrets) compile without the switch in this release. A release can change or remove them too. To compile every sample on this page, set the switch once in tsconfig.json:

{
  "vibe": { "experimental": ["builtins"] }
}

Build a complete agent

The following agent answers a question about an order. It has one tool, a memory, and a scripted model, so it runs with no API key and no network.

schema Reply { answer: string }
 
// One tool: its name, what it takes and what it returns.
const OrderStatus = Tool.make("orderStatus", {
  description: "Looks up the status of an order by its number",
  parameters: Schema.Struct({ order: Schema.Number }),
  success: Schema.String
})
const Orders = Toolkit.make(OrderStatus)
const orders = Orders.pipe(Effect.provide(Orders.toLayer({
  orderStatus: ({ order }) => Effect.succeed(order === 41 ? "shipped" : "unknown")
})))
 
// A scripted model: each call answers with the next reply in the list.
export function scripted(replies: ReadonlyArray<string>) {
  let turn = 0
  const next = () => replies[Math.min(turn++, replies.length - 1)]
  return Layer.effect(LanguageModel.LanguageModel, LanguageModel.make({
    generateText: () => Effect.succeed([{ type: "text" as const, text: next() }]),
    streamText: () => Stream.make({ type: "text-delta" as const, id: "t", delta: next() }),
  }))
}
export const cell = (source: string) => "```cell\n" + source + "\n```"
 
const script = [
  cell("const status = await tools.orderStatus({ order: 41 })\nconsole.log(status)"),
  cell("done({ answer: `Order 41 is ${status}.` })"),
]
 
export effect function support(question: string) {
  provide scripted(script), Experimental.Memory.test {
    const known = try Experimental.Memory.recall({ banks: ["agent-support"], query: question })
    const run = try Experimental.Agent.run({
      system: "You answer questions about orders.",
      prompt: `${question}\nKnown facts: ${known.map((row) => row.text).join("; ")}`,
      tools: orders,
      output: Reply,
      maxTurns: 4,
    })
    try Experimental.Memory.remember({ bank: "agent-support", key: "last-answer", text: run.output.answer })
    const kept = try Experimental.Memory.recall({ banks: ["agent-support"], query: "order" })
    return `${run.output.answer} (${run.turns} turns, ${kept.length} fact kept)`
  }
}
// Run in an effect function: try Console.log(try support("Where is order 41?"))
// Output: Order 41 is shipped. (2 turns, 1 fact kept)

The sample has five parts, and each has its own section on this page:

  1. The model. scripted(script) provides the LanguageModel service that Experimental.Agent.run asks. In production, replace it with Experimental.Model.use("anthropic:claude-sonnet-5-5"). Nothing else changes.
  2. The loop. Experimental.Agent.run asks the model, runs the JavaScript the model writes, and repeats until the model calls done(answer). This run takes two turns.
  3. The tool. orderStatus is the only way the model's code reaches your program.
  4. The memory. Experimental.Memory keeps the answer as a fact that a later run can recall.
  5. The typed answer. output: Reply decodes the answer, so run.output.answer is a string.

Choose and call a model

Vibe calls a model through Effect's LanguageModel service. A service is a dependency that a function requests and that a caller supplies with provide. Experimental.Model (VIP-62) supplies that service from a string.

schema Label { type: "bug" | "feature" | "question" | "chore" }
 
export effect function summarize(title: string) {
  const reply = try LanguageModel.generateText({ prompt: `Summarize this issue in one line: ${title}` })
  return reply.text
}
 
export effect function label(title: string) {
  const reply = try LanguageModel.generateObject({ prompt: `Label this issue: ${title}`, schema: Label })
  return reply.value
}
 
export effect function production() {
  provide Experimental.Model.use("anthropic:claude-sonnet-5-5") {
    return try label("Crash on start")
  }
}

A model name is a seat: the text provider:modelId. A seat holds no key and no endpoint, so it is safe in source. generateText returns text. generateObject takes a schema and returns a decoded value, so reply.value.type is one of the four labels. A reply that does not match the schema fails with Effect's AiError.

A seat names one of five providers: anthropic, openai, cerebras, openrouter or vercel. Experimental.Model.use reads the provider's key from Effect's Config when the layer is built: ANTHROPIC_API_KEY, OPENAI_API_KEY, CEREBRAS_API_KEY, OPENROUTER_API_KEY or AI_GATEWAY_API_KEY.

A malformed seat, an unknown provider or a missing key fails the layer with Experimental.Model.ModelUnresolved. Its reason is "Malformed", "UnknownProvider", "MissingKey", "NotInstalled", "Unsupported" or "Unreachable". The failure happens when the layer is built, before any call.

The module has more constructors. The following table lists them.

CallProvides
Experimental.Model.use([seatA, seatB])A LanguageModel that moves to the next seat on a rate limit, an exhausted quota, a provider fault, an unreachable provider or a prompt over the context window
Experimental.Model.compatible({ id, baseUrl, model, apiKey?, protocol? })A LanguageModel from an OpenAI-compatible server
Experimental.Model.decide(seat?)Effect's DecisionModel, which answers typed questions
Experimental.Model.embed(seat, { dimensions? })Effect's EmbeddingModel
Experimental.Model.proxy(options), Experimental.Model.proxied({ url })An HTTP handler that serves a model, and a LanguageModel that calls it
Experimental.Model.contextWindow(modelId), Experimental.Model.cost(usage, modelId)Catalog facts and the cost in US dollars

Test a model call offline

Experimental.Test.replay (VIP-71) is a LanguageModel that answers from a recording. The sample runs label from the previous sample with no key.

const recorded = {
  calls: [{
    request: { prompt: "Label this issue: Crash on start" },
    response: [{ type: "text", text: `{"type":"bug"}` }]
  }]
}
 
export effect function labelCrash() {
  provide Experimental.Test.replay(recorded) {
    const result = try label("Crash on start")
    return result.type
  }
}
// Run in an effect function: try Console.log(try labelCrash())
// Output: bug

Each recorded call answers one request with the same prompt, once. A request with no matching recording stops the program with Experimental.Test.UnrecordedCall. It is never sent to a provider. To make a recording from a real provider, use Experimental.Test.record(path, { live }).

This page uses two test models. Use Experimental.Test.replay when the program writes the prompt, as label does. Use a scripted model, such as scripted in the complete agent, when a library writes the prompt, as the agent loop does. scripted builds a LanguageModel with Effect's LanguageModel.make and ignores the prompt.

Run the agent loop

Experimental.Agent.run (VIP-63) runs a model in a loop until the model gives an answer that output decodes. Experimental.Agent.stream is the same run as a stream of events. The sample reuses orders, scripted, cell and Reply from the complete agent.

const steps = [
  cell("const status = await tools.orderStatus({ order: 41 })\nconsole.log(status)"),
  cell("done({ answer: status })"),
]
 
export effect function watch() {
  provide scripted(steps) {
    const events = Experimental.Agent.stream({
      prompt: "Where is order 41?",
      tools: orders,
      output: Reply,
    })
    for try (const event of events) {
      if (event._tag === "TurnStarted") try Console.log(`turn ${event.turn}`)
      if (event._tag === "ToolCall") try Console.log(`  call ${event.tool}`)
      if (event._tag === "CellEnded") try Console.log(`  ${event.outcome}, printed "${event.prints}"`)
      if (event._tag === "Finished") try Console.log(`answer ${event.result.output.answer}`)
    }
  }
}
// Run in an effect function: try watch()
// Output: turn 1
// Output:   call orderStatus
// Output:   continue, printed "shipped"
// Output: turn 2
// Output:   done, printed ""
// Output: answer shipped

A turn is one request to the model and the run of the cell in its reply. A cell is a JavaScript program in a fenced block tagged cell. The loop works as follows:

  1. The loop sends the task, the tool list and the JSON Schema of output to the model.
  2. The model replies with one cell.
  3. The cell runs in a QuickJS sandbox. The sandbox has no file system, network, timers, Date or Math.random.
  4. The cell acts in three ways. await tools[name](input) calls a tool, console.log prints, and done(answer) ends the run.
  5. The next request shows the model what the cell printed. Top-level variables persist from one cell to the next, which is why status is still defined in turn 2.

A reply with no cell also spends a turn. Experimental.Agent.run returns { output, turns, usage }, where usage holds inputTokens and outputTokens. Experimental.Agent.stream also emits TextDelta, Cell, ToolResult, Correction and Judged events, and Finished is always last.

Set limits

Every run is bounded. In the sample, the model never writes a cell, and maxTurns stops the run after two turns.

export effect function stuck() {
  provide scripted(["Let me think about that."]) {
    return Experimental.Agent.run({ prompt: "Where is order 41?", output: Reply, maxTurns: 2 }) catch (error) =>
      error._tag === "AgentFailed" ? `${error.reason} after ${error.turns} turns` : error._tag
  }
}
// Run in an effect function: try Console.log(try stuck())
// Output: turns_exhausted after 2 turns

The following table lists the options that bound a run.

OptionBoundsDefault
maxTurnsTurns before the run fails with turns_exhausted100
correctionsRequests for another answer after one that output rejects, before the run fails with output_invalid1
limits.callsTool calls in one cell64
limits.timeMsMilliseconds one cell computes, not counting time spent in a tool30,000
limits.callMsMilliseconds one tool call takes120,000
limits.memoryBytesBytes the whole run holds, from 32 MiB to 4 GiB128 MiB
judgeCompletion claims that a DecisionModel checks against the run's evidence0

A run fails with Experimental.Agent.AgentFailed, which holds a reason, a message and the turns taken, or with the model's AiError. An option that is out of range fails with the reason invalid_options before the model is asked. No option turns a limit off.

Experimental.Agent.cli(profile, options) drives a coding-agent command-line program instead of a model, and Experimental.Agent.detect() reports which ones a machine has. This guide does not cover them.

Give an agent tools

Experimental.Tools (VIP-64) is the standard tool set. Pass a toolkit as tools, and each tool becomes a function in the cell.

import * as NodeServices from "@effect/platform-node/NodeServices"
schema Count { lines: number }
 
export effect function countLines() {
  provide NodeServices.layer {
    return try scoped(effect {
      const fs = try FileSystem.FileSystem
      const dir = try fs.makeTempDirectoryScoped()
      try fs.writeFileString(`${dir}/notes.txt`, "one\ntwo\nthree\n")
      const read = cell(`const file = await tools.read({ path: "${dir}/notes.txt" })\ndone({ lines: file.totalLines })`)
      provide scripted([read]) {
        const run = try Experimental.Agent.run({
          prompt: "Count the lines in notes.txt",
          tools: Experimental.Tools.filesystem,
          output: Count,
        })
        return run.output.lines
      }
    })
  }
}
// Run in an effect function: try Console.log(try countLines())
// Output: 3

Experimental.Tools.filesystem needs Effect's FileSystem and Path services, which NodeServices.layer provides. The following table lists the standard toolkits.

ToolkitToolsNeeds
Experimental.Tools.filesystemread, write, edit, applyPatch, ls, glob, grepFileSystem, Path
Experimental.Tools.shellbash, testChildProcessSpawner
Experimental.Tools.httpfetch, postHttpClient
Experimental.Tools.webwebfetch, websearchHttpClient, and Experimental.Tools.layerWebSearch for websearch
Experimental.Tools.lspdefinition, references, hover, diagnostics, symbolsPath, and Experimental.Tools.layerLanguageServer
Experimental.Tools.readOnlyEvery tool in this table that changes nothingThe services of the tools it holds

There is no toolkit of every tool: you choose a set that can run a shell by name. readOnly is a tool set, not a confinement. Each tool is also a function that your program calls directly, such as try Experimental.Tools.read({ path }). A tool failure is an Experimental.Tools.ToolError with a code from a closed list, such as not_found or permission_denied.

Define your own tool

A custom tool is Effect's Tool and Toolkit. Declare the tool with Tool.make, group tools with Toolkit.make, and attach handlers with toLayer.

schema Shouted { text: string; problem: string }
 
const Upper = Tool.make("upper", {
  description: "Converts text to upper case",
  parameters: Schema.Struct({ text: Schema.String }),
  success: Schema.String
})
const Words = Toolkit.make(Upper)
const words = Words.pipe(Effect.provide(Words.toLayer({
  upper: ({ text }) => Effect.succeed(text.toUpperCase())
})))
 
const shoutScript = [cell([
  "const good = await tools.upper({ text: 'hello' })",
  "const bad = await tools.upper({ text: 5 })",
  "done({ text: good, problem: bad.ok === false ? 'the second call failed' : 'none' })",
].join("\n"))]
 
export effect function shout() {
  provide scripted(shoutScript) {
    const run = try Experimental.Agent.run({
      prompt: "Shout hello",
      tools: words,
      output: Shouted,
    })
    return `${run.output.text}, ${run.output.problem}`
  }
}
// Run in an effect function: try Console.log(try shout())
// Output: HELLO, the second call failed

parameters and success are schemas. The loop sends the JSON Schema of parameters to the model and decodes each call's input before your handler runs. A call that fails does not throw in the cell. It resolves to { ok: false, error: { code, message } }, so the model can read the error and try again. A call to a tool that the run was not given fails inside the sandbox and never reaches your program.

Use an MCP server's tools

Experimental.McpClient.toolkit (VIP-65) connects one Model Context Protocol (MCP) server and returns the tools you name as a toolkit. This sample compiles here but was not run, because it needs a server.

export effect function triage(issue: number) {
  return try scoped(effect {
    const github = try Experimental.McpClient.toolkit("github", {
      command: ChildProcess.make("mcp-server-github", []),
      include: ["get_issue", "list_issues"],
      timeout: "30 seconds",
    })
    const run = try Experimental.Agent.run({
      prompt: `Summarize issue ${issue}`,
      tools: github,
      output: Reply,
    })
    return run.output.answer
  })
}

The session, and the child process, end when the enclosing scoped block ends. To reach a server over Streamable HTTP, pass { url, headers?, include } instead of command. The following table lists the rules the client keeps.

RuleConsequence
Tool names are prefixed <server>__<tool>The cell calls tools.github__get_issue(input), and two servers cannot collide
include is requiredA tool you did not name is not offered. include: "all" offers every tool
The tool list is read once, at connectA tool the server adds later is not offered
The child process gets a small environmentProvider keys in your environment do not reach the server
Errors withhold the server's textA failure is an Experimental.McpClient.McpError with a code, such as tool_missing or timeout
A lost reply is not retriedAfter a transport failure, nobody knows whether the tool ran

To serve a toolkit as an MCP server, use Effect's McpServer, which Vibe does not change.

Remember across runs

Experimental.Memory (VIP-66) keeps what a later run needs. It holds three kinds of record: facts, notes and history.

export effect function remembered() {
  provide Experimental.Memory.test {
    // A fact: one value for each key.
    try Experimental.Memory.remember({ bank: "agent-support", key: "tone", text: "Customers prefer short replies" })
    // Notes are append-only. A correction supersedes the note it replaces.
    try Experimental.Memory.note("agent-support", "Refunds take 4 days", { id: "n1" })
    try Experimental.Memory.note("agent-support", "Refunds take 9 days", { id: "n2", supersedes: "n1" })
    // History: the messages of one conversation.
    const thread = Experimental.Memory.thread("ticket-7")
    try thread.append({ id: "m1", role: "user", text: "Where is my refund?" })
    try thread.append({ id: "m2", role: "assistant", text: "It arrives in 9 days." })
    const rows = try Experimental.Memory.recall({ banks: ["agent-support"], query: "refunds replies", maxBytes: 512 })
    for (const row of rows) try Console.log(`${row.key}: ${row.text}`)
    const history = try thread.history({ limit: 10 })
    try Console.log(history.map((message) => message.role).join(", "))
  }
}
// Run in an effect function: try remembered()
// Output: n2: Refunds take 9 days
// Output: tone: Customers prefer short replies
// Output: user, assistant

A bank names a group of facts. Its name is kind-id, where the kind is flow, agent, user or global. recall returns the rows that match the query, best first. By default, a row scores one point for each query word that its key or text contains. The superseded note n1 is not recalled.

Recalled rows become part of a prompt, so every recall has a byte budget. The answer, as JSON, is at most maxBytes UTF-8 bytes, and 2,048 when you do not set it.

Experimental.Memory.test keeps records in this process. To keep them in a database, provide Experimental.Memory.layerSql() over one of Effect's SQL clients. There is no default store.

Give the model its own memory

Experimental.Memory.tools(bank) is a toolkit with a remember tool and a recall tool, both bound to one bank.

const lesson = cell("await tools.remember({ key: 'carrier', text: 'Orders ship with Acme Post' })\ndone({ answer: 'noted' })")
 
export effect function learn() {
  provide scripted([lesson]), Experimental.Memory.test {
    try Experimental.Agent.run({
      prompt: "Remember which carrier ships orders.",
      tools: Experimental.Memory.tools("agent-support"),
      output: Reply,
    })
    const rows = try Experimental.Memory.recall({ banks: ["agent-support"], query: "carrier" })
    return rows[0]?.text
  }
}
// Run in an effect function: try Console.log(try learn())
// Output: Orders ship with Acme Post

Neither tool takes a bank, so the model reaches no other bank. Treat recalled text as data: a fact that a model wrote is an assertion, not an instruction.

Limit what an agent may do

Experimental.Capability (VIP-58) is a permission kernel. A capability names one operation on one resource, written action:resource. A policy lists the patterns you allow and the patterns you deny.

import * as NodeServices from "@effect/platform-node/NodeServices"
schema Attempt { code: string }
const policy = {
  allow: ["fs:read:/workspace/**"],
  deny: ["fs:read:/workspace/secrets/**"],
} satisfies Experimental.Capability.Policy
const decisions = [
  Experimental.Capability.evaluate(policy, "fs:read:/workspace/README.md"),
  Experimental.Capability.evaluate(policy, "fs:read:/workspace/secrets/key"),
  Experimental.Capability.evaluate(policy, "fs:write:/workspace/README.md"),
]
const snoop = cell("const file = await tools.read({ path: '/workspace/secrets/key' })\ndone({ code: file.error.code })")
 
export effect function confined() {
  provide NodeServices.layer, scripted([snoop]), Experimental.Capability.grantStore({ ...policy, attended: false }) {
    const run = try Experimental.Agent.run({
      prompt: "Read the key",
      tools: Experimental.Tools.readOnly,
      output: Attempt,
    })
    return `${decisions.join(", ")}; the agent got ${run.output.code}`
  }
}
// Run in an effect function: try Console.log(try confined())
// Output: allow, deny, ask; the agent got permission_denied

evaluate is a pure function that answers "allow", "deny" or "ask". A deny is a veto, wherever it stands in the policy. A request that no pattern matches is "ask", never "allow". In a pattern, * matches any run of characters, including /.

grantStore installs the policy. Each standard tool asks the store for the resolved resource before it runs: fs:read, fs:write, proc:spawn, net:get or net:post. Experimental.McpClient.toolkit asks for proc:spawn or net:post when it connects. With attended: false, an "ask" fails. With attended: true, the operation waits until your program answers it with Experimental.Capability.reply. With no store and no ceiling installed, nothing is checked.

The following table lists the other ways to apply a policy.

CallDoes
Experimental.Capability.guard(policy)A layer that checks every FileSystem, HttpClient and ChildProcessSpawner operation, so your own handlers are checked too
Experimental.Capability.attenuate(patterns)(effect)Narrows what one Effect may ask for. Nothing inside it widens the ceiling again
Experimental.Capability.check(capability)Asks the store from your own tool handler
static readonly capabilities = [...] on a task or workflowDeclares a ceiling for a durable step. The workflow's plan lists it: see Read the plan

Use a secret without holding it

Experimental.Secrets (VIP-68) gives a step a placeholder instead of a secret's value. The value replaces the placeholder only in a header of an HTTPS request to a host the secret is bound to. The sample puts a fake host in a .ts file, because Vibe code reads no host globals such as Response.

// TypeScript (.ts)
// fake-host.ts
import { Effect, Layer } from "effect"
import { HttpClient, HttpClientResponse } from "effect/http"
 
// Stands in for api.stripe.com: it answers with the header it received.
export const fakeHost = Layer.succeed(HttpClient.HttpClient, HttpClient.make((request) =>
  Effect.succeed(HttpClientResponse.fromWeb(request, new Response(`saw ${request.headers.authorization}`)))))
import { fakeHost } from "./fake-host.js"
 
const audit = Layer.succeed(Experimental.Secrets.Audit, {
  record: (entry) => Console.log(`audit: ${entry.outcome} ${entry.method} ${entry.host} ${entry.secrets.join(",")}`)
})
const vault = Experimental.Secrets.fixtures({ STRIPE_KEY: "sk_test_12345678" })
const egress = Experimental.Secrets.egress([{ name: "STRIPE_KEY", hosts: ["api.stripe.com"] }])
 
export effect function charge() {
  provide egress.pipe(Layer.provide([fakeHost, audit, vault])) {
    const key = try Experimental.Secrets.placeholder("STRIPE_KEY")
    const http = try HttpClient.HttpClient
    const response = try http.get("https://api.stripe.com/v1/charges", { headers: { authorization: `Bearer ${key}` } })
    const body = try response.text
    return `placeholder: ${key.startsWith("vibe-secret-")}, value in the answer: ${body.includes("sk_test")}`
  }
}
// Run in an effect function: try Console.log(try charge())
// Output: audit: forwarded GET api.stripe.com STRIPE_KEY
// Output: placeholder: true, value in the answer: false

egress replaces HttpClient inside the provide block. The code holds key, which is vibe-secret- and 64 hexadecimal characters. The fake host received the real value and echoed it, and the egress scrubbed the echo before the code read the body. A model that sees key or body never sees the value. Code that holds the placeholder can still use it against the bound host.

The following table lists the rules the egress keeps.

RuleConsequence
Exact hosts, HTTPS onlyThe value is sent only to one of the binding's hosts, by one of its methods
Headers onlyA placeholder in a URL or a body reaches the host as the placeholder
Other hosts are refusedA request to a host outside every binding fails unless allow names the host
Every request is audited by nameA request that the Audit service cannot record is not sent. The value is never recorded
The vault is a serviceThe default vault reads Config.Redacted(name). fixtures replaces it in a test

Evaluate an agent

A test asserts that an answer equals a value. A model's answer is better or worse than the last one. Experimental.Eval runs a fixed set of cases against a target, and Experimental.Scorer grades each answer from 0 to 1 (VIP-69). The sample evaluates support from the complete agent.

export const supportSuite = Experimental.Eval.suite("support", {
  target: support,
  cases: [{ name: "order-41", input: ["Where is order 41?"] }],
  scorers: [
    Experimental.Scorer.contains("shipped"),
    Experimental.Scorer.checks([{ words: { max: 20 } }, { excludes: ["sorry"] }]),
  ],
  gate: { min: 1, tolerance: 0 },
})
 
export effect function nightly() {
  const run = try Experimental.Eval.run(supportSuite)
  const committed = Experimental.Eval.write(try Experimental.Eval.baseline(run))
  const report = try Experimental.Eval.compare(try Experimental.Eval.load(committed), run)
  const gate = Experimental.Eval.gate(report, supportSuite.gate)
  return `${gate.summary}, exit code ${gate.exitCode}`
}
// Run in an effect function: try Console.log(try nightly())
// Output: passed, exit code 0

A case's input is the array of the target's arguments. Experimental.Scorer.contains grades whether the answer holds a text, and Experimental.Scorer.checks grades the fraction of its checks that pass. Experimental.Scorer.exact compares with a case's expected, Experimental.Scorer.make wraps your own function, and Experimental.Scorer.rubric asks a model to judge. A baseline is the scores of one run, written as text that you commit. compare reports what moved since the baseline, and gate turns the report into an exit code.

Run evals from the command line

An eval file is named *.eval.vibe, and its default export is one suite or an array of suites (VIP-59). The target in this file is a plain function, so the run needs no model. The output that follows comes from this file saved as src/route.eval.vibe.

// route.eval.vibe
effect function route(question: string) {
  return question.includes("refund") ? "billing" : "orders"
}
 
export default Experimental.Eval.suite("route", {
  target: route,
  cases: [
    { name: "refund", input: ["I want a refund"], expected: "billing" },
    { name: "tracking", input: ["Where is order 41?"], expected: "orders" }
  ],
  scorers: [Experimental.Scorer.exact],
  gate: { min: 1 }
})

To see the suites without running a target, run vibelang eval --list. To write the baseline file beside the eval file, run vibelang eval --update, then review and commit route.eval.baseline.json. After that, a plain vibelang eval compares each run with the baseline:

$ vibelang eval --update
route  refund  exact 1.00  (no baseline)
route  tracking  exact 1.00  (no baseline)
wrote src/route.eval.baseline.json
1 suite, 2 cases, 0 regressed. 0 model calls.

$ vibelang eval
route  refund  exact 1.00  (baseline 1.00)
route  tracking  exact 1.00  (baseline 1.00)
1 suite, 2 cases, 0 regressed. 0 model calls.

When route stops sending refunds to billing, the same command reports the regression and exits with status 1:

route  refund  exact 0.00  (baseline 1.00)
route  tracking  exact 1.00  (baseline 1.00)
route  failed: min_below_threshold: threshold 1, actual 0; regression for refund/exact (0d0094ad)
1 suite, 2 cases, 1 regressed. 0 model calls.

The following table lists the command's arguments.

ArgumentDoes
No flagReplays recorded model calls. A call with no recording is not sent
--listPrints suites and cases, and calls no target
--liveCalls models and writes <name>.eval.recording.json beside the eval file
--updateRewrites each baseline from this run, but not when a case failed or went undecided
--trials NRuns each case N times. N above 1 requires --live
path...Eval files or directories to search. The default is the working directory

The exit status is 0 when every suite passes, 1 when a suite fails or regresses, 5 when a suite cannot be decided, and 2 when the arguments are wrong. A target that calls a model with no recording is undecided:

ask  hello  undecided: a model call has no recording; run vibelang eval --live to record it
ask  inconclusive: 1 case called a model with no recording
1 suite, 1 case, 0 regressed, 1 undecided. 0 model calls.

To record the missing calls, add export const live = Experimental.Model.use("<provider>:<model>") to the eval file and run vibelang eval --live. No environment variable turns a run live.

Next steps

The following pages continue from this guide:

  • To make an agent survive a crash and resume where it stopped, call Experimental.Agent.run inside a task of a durable workflow. The journal then records each call of Experimental.Model and each tool call of the agent as a step of that task. If the process dies inside the task, the resume runs the task from the top. Each call that finished returns its recorded result, and its handler does not run again. The call that the crash interrupted has no recorded result, so it runs again and can reach its destination a second time. Give a tool that changes something outside the program an idempotency key that the destination checks. See Durable workflows.
  • For the list of every experimental module and the complete tables of Experimental.Eval, Experimental.Scorer, Experimental.Test and Experimental.Memory, see Experimental platform APIs.