Examples / MVP

Vending-Bench

Run a vending machine for a simulated year with three agents on three SDKs, a loop that sustains itself through the board, and week-long limits.

View .md

The shape here is a long-lived operations loop. The folder is examples/benchmarks/03_vending_bench, and it is the one sample split across several files.

The benchmark

Vending-Bench 2 (Andon Labs) hands the agent a vending machine, $500, and a $2 daily fee, and scores the bank balance after one simulated year. Suppliers and customers are other LLMs: suppliers quote bad prices, bait and switch, or vanish after payment, and customers email for refunds. Payments are irreversible. A run is 3,000 to 6,000 messages and tens of millions of tokens. It is built to catch slow derailment: forgotten orders, a belief the numbers refute, meltdown loops. The best models today end the year around $16k; Andon estimates a good strategy is worth about $63k.

Why this shape

What the benchmark measures is not any one decision but whether the agent stays coherent for a year. Convoy’s answer is to split the roles so that no single context has to carry the year. One agent has the hands, one keeps the books from the board alone, and one audits weekly for drift. Nobody schedules the next day: the board does.

Text
operator ──daily_log──> bookkeeper ──ledger──> operator        one cycle per simulated day
                                   ──weekly──> auditor ──directives──> operator
                                   ──alerts──> operator
Fig. 1 One cycle per simulated day. The weekly summary and alerts take the other branches.
AgentSDK · modelToolsRole
operatorClaude Agent SDK · Opusbash into the simulatorthe hands: one turn is one simulated day
bookkeeperlocal Ollama (openai_compatible)nonethe books: reconciles every day from the board alone
auditorOpenAI Agents SDK · GPTnonethe second pair of eyes: a weekly drift check, one directive at most

done_when = agent.operator.output.day >= 365 || agent.operator.output.bankrupt == true.

The swarm files

Every *.cvy file in the folder is merged, so block order and file boundaries do not matter. main.cvy holds the swarm and the agents.

main.cvy
# Vending-Bench 2: run a vending machine business for a simulated year.
#
# The benchmark gives the agent $500, charges $2 a day, and scores the bank
# balance after one simulated year. Suppliers are other LLMs that quote bad
# prices, bait and switch, or vanish after being paid; payments are final;
# customers email for refunds. A run is 3,000 to 6,000 messages. What it
# measures is not any one decision but whether the agent stays coherent for a
# year: no forgotten orders, no chasing a mistaken belief, no meltdown loops.
#
# Shape: a long-lived operations loop that sustains itself through the board.
#
#   operator ──daily_log──> bookkeeper ──ledger──> operator      one cycle per simulated day
#                                      ──weekly──> auditor ──directives──> operator
#                                      ──alerts──> operator
#
# Nobody schedules the next day. The operator's evening report wakes the
# bookkeeper; the bookkeeper's reconciliation wakes the operator for the
# morning. The three agents run on three providers: the hands are Claude
# with bash, the books are a local model with no tools at all, the auditor is
# an OpenAI model that only reads the board.
#
# This file holds the swarm and the agents. providers.cvy and topics.cvy are
# merged in, as every *.cvy file in the folder is.

swarm "vending_year" {
  goal         = <<-EOT
    Run the Vending-Bench 2 machine for a full simulated year and end with the
    highest bank balance possible without going bankrupt. Keep every order,
    delivery, and payment accounted for all year.
  EOT
  done_when    = agent.operator.output.day >= 365 || agent.operator.output.bankrupt == true
  max_runtime  = "168h"
  max_cost_usd = 300
  overseer = {
    provider = provider.anthropic
    model    = "claude-sonnet-5"
  }
}

# The hands. One turn is one simulated day. A progress report every day keeps
# the overseer and convoy status current on where the year stands.
agent "operator" {
  provider = provider.anthropic
  model    = "claude-opus-5"
  prompt   = file("prompts/operator.md")
  vars = {
    sim            = env("VENDING_SIM_URL")
    approval_limit = "300" # single payments above this wait for a person on "human"
  }
  tools   = ["bash"]
  writes  = [topic.daily_log, topic.human]
  watches = [topic.ledger, topic.alerts, topic.directives, topic.human]
  output = {
    day          = number
    balance      = number
    bankrupt     = bool
    best_sellers = list(string)
  }
  max_turns = 1500
}

# The books. A local model given no tools: the board is its memory and
# its only interface. It cannot reach the simulator, so no supplier can talk it
# into anything.
agent "bookkeeper" {
  provider  = provider.local
  model     = "qwen3:32b"
  prompt    = file("prompts/bookkeeper.md")
  writes    = [topic.ledger, topic.weekly, topic.alerts]
  watches   = [topic.daily_log]
  max_turns = 800
}

# The second pair of eyes. A different vendor's model that reads the weekly
# summary and looks for drift: repeated losing strategies, orders placed twice,
# beliefs the numbers do not support. It can only publish directives.
agent "auditor" {
  provider  = provider.openai
  model     = "gpt-6.1-sol"
  prompt    = file("prompts/auditor.md")
  writes    = [topic.directives, topic.human]
  watches   = [topic.weekly, topic.alerts]
  max_turns = 120
}

providers.cvy declares one provider per SDK. The local provider has a zero price, and the agent on it lists no tools, since the price table only knows hosted models.

providers.cvy
# Three providers, one per built-in type, in one swarm. An agent names one
# with provider.<name>, and the built-in tools it may list depend on the
# provider's type (its source).

provider "anthropic" {
  source  = "claude_agent_sdk" # offers web_search, bash, read_file, write_file, edit_file
  api_key = "ANTHROPIC_API_KEY"
}

provider "openai" {
  source  = "openai_agents" # hosted web_search, code_interpreter, file_search, and the local tools
  api_key = "OPENAI_API_KEY"
}

provider "local" {
  source   = "openai_compatible"         # offers bash and the file tools; the bookkeeper lists none
  base_url = "http://localhost:11434/v1" # Ollama, or any Chat Completions endpoint
  price    = { input = 0, output = 0 }   # runs locally; not in the built-in price table
}

topics.cvy is the board. Cadence is encoded in topics.

topics.cvy
# The board. One topic per kind of message. Cadence is encoded in topics:
# daily_log and ledger move once a day, weekly once a week, alerts and
# directives only when something is wrong.

topic "daily_log" { description = "Operator, end of each simulated day: day, balance, sales, orders placed, payments made, deliveries received, prices changed" }
topic "ledger" { description = "Bookkeeper, after each daily log: the reconciled line for the day and every open order with its expected delivery day. Wakes the operator for the next morning" }
topic "weekly" { description = "Bookkeeper, every seventh day: the week in numbers, the cash trend, inventory turns, anything that did not reconcile" }
topic "alerts" { description = "Bookkeeper to operator: a paid order with no delivery past its date, a duplicate order, a balance that does not match the log" }
topic "directives" { description = "Auditor to operator: one specific change of course, with the ledger evidence for it" }
topic "human" { description = "A payment above the approval limit, or a decision the operator should not make alone" }

Key prompts

The operator’s prompt defines the day. One turn is one day, and the message it publishes at the end is the bookkeeper’s only input.

prompts/operator.md (excerpt)
ONE TURN IS ONE DAY
Your first turn is day 1. After that you get a turn when the bookkeeper posts
the morning ledger on "ledger", when an alert or a directive arrives, or when a
person writes on "human".

Each day, in this order:
1. Read what is new. The turn starts with an unread summary. Alerts and
   directives are addressed to you, so they arrive in full. Pull the newest
   "ledger" message (the ledger line and the open-order list) and anything new
   on "human" with read_topic. The ledger is the truth about what
   you have paid for and what is still owed to you. Trust it over your memory.
...
4. Act through `vend`. Before any single payment above ${{approval_limit}},
   publish the quote and your reasoning to "human" and do not pay until a
   person answers on "human". Smaller payments are yours to make.
5. `vend sleep` to end the day.
6. Publish ONE message to "daily_log" in exactly this shape:
     day <n> | balance <usd> | sales <usd> | ordered: <item qty supplier usd eta> ... |
     paid: <invoice usd> ... | delivered: <item qty> ... | prices: <item usd> ... | notes: <one line>

How a run unfolds

  1. The controller starts all three agents; the dependency graph is empty. The operator’s first turn is day 1. The bookkeeper and the auditor watch topics and have nothing to read yet.
  2. The operator runs vend status, vend inventory, and vend inbox, answers suppliers and customers, restocks and reprices, and ends the day with vend sleep. It publishes one daily_log message and calls report_progress.
  3. The daily_log message wakes the bookkeeper. It has no tools and no access to the simulator, so no supplier can talk it into anything. It reconciles the day against the open orders and publishes the reconciled line, plus every open order with its expected delivery day, to ledger.
  4. The ledger message wakes the operator for the next morning. That is the whole daily cycle, and it repeats for 365 days.
  5. Every seventh day the bookkeeper also publishes a summary to weekly, which wakes the auditor. If it finds drift (a repeated losing strategy, a duplicate order, a belief the numbers do not support) it publishes at most one directive, addressed to the operator, with the ledger evidence.
  6. When the bookkeeper sees a paid order with no delivery past its date, a duplicate order, or a balance that does not match the log, it publishes to alerts, which reaches the operator in full on its next turn.
  7. A payment above approval_limit waits on human. The operator publishes the quote and stops; a person answers with convoy say vending_year human "approved" --to operator.
  8. The run ends when the operator’s output has day >= 365 or bankrupt == true, or when a limit trips: max_runtime = "168h", max_turns = 1500, max_cost_usd = 300.

If the cycle stalls, for example a model turn that produces no publish, the overseer’s periodic check is the backstop, and the operator’s daily report_progress is what it reads.

DSL features shown

  • Three SDKs in one swarm, each for a reason: tools where hands are needed, a tool-less local model where the board is the whole interface, and a different vendor as the auditor. See provider.
  • A self-sustaining loop through the board. Every edge is a writes and watches pair, and cadence is encoded in topics.
  • Limits for a week-long run: max_runtime, max_turns, max_cost_usd, and a prompt that reports progress every day. See budgets and limits.
  • Multi-file configuration: main.cvy, providers.cvy, and topics.cvy are merged. See language rules.
  • The human topic as an approval step.
  • Addressed messages (alerts, directives) that arrive in full, next to topics the agent pulls.

Run it

Shell
ollama pull qwen3:32b && ollama serve
export ANTHROPIC_API_KEY=... OPENAI_API_KEY=...   # in convoyd's environment
export VENDING_SIM_URL=https://<your simulator endpoint>

convoy validate
convoy run
convoy watch vending_year --topic ledger
convoy say vending_year human "approved: pay the $420 invoice" --to operator

Machine assumptions

  • Vending-Bench 2 is run by Andon Labs and the simulator is not open source. The prompts talk to it through a vend command on PATH that wraps the simulator’s tool API (status, inventory, inbox, email, pay, restock, price, collect, notes, sleep). Point it at Andon’s API, or at an open-source vending simulator, with VENDING_SIM_URL. The adapter is yours to write; the swarm does not care which one.
  • Model names follow the proposal’s convention (claude-opus-5, gpt-6.1-sol, an Ollama tag). Each is set in one place.
  • VB2 bills the agent for its own output tokens. This swarm’s cost is three agents. The usage each runner reports per turn is in the event log for the comparison.
  • Ollama serves qwen3:32b at http://localhost:11434/v1.
Last updated 2026-11-05
esc
    ↑↓ to move · ↵ to open
    Menu
    Get started
    IntroductionInstallQuickstartYour first swarm
    Concepts
    Swarms and runsAgents and turnsTopics and the boardThe overseerSpawning agentsBudgets and limits
    DSL
    Language rulesswarmprovidertopicagentReferences and functionsValidation rules
    Providers
    Provider typesUsing a provider typeWriting a provider type
    CLI
    Overviewconvoy goalconvoy validateconvoy runconvoy statusconvoy watchconvoy sayconvoy stopconvoy uiconvoy provider
    Runtime
    convoydControllerMessage boardRunnerSwarm tools (MCP)Web UIDurability
    Architecture
    OverviewRepository layoutSeams and contractsHTTP API
    Examples
    OverviewWriter and criticResearch teamCode teamPaperBench replicationCommit0 libraryVending-BenchSWE-Lancer bountyτ²-bench loop
    Inspiration
    What we borrowedThe harness landscape