CLI / MVP

convoy goal

Turn a written goal into a validated set of .cvy and prompt files by asking a model you name, retrying with diagnostics until the files pass. It does not start anything.

View .md
Text
convoy goal --provider <anthropic|openai> --model <id> [flags] "<text>"

goal is the only command that calls a model directly. It needs no running convoyd. The model you name here only writes the swarm. The swarm declares its own providers and models.

What it does

  1. Checks flags. A missing --provider or --model, or an unknown provider, is a usage error (exit 2) before any network call. There are no defaults.

  2. Builds the system prompt (meta prompt 1) from the goal and three inserts: the providers, models, and tools a swarm may declare (all priced, so a generated max_cost_usd passes validation); the embedded DSL reference; and two embedded example swarms.

  3. Calls the model with the goal as the user message. The model returns files as blocks:

    Text
    <file path="main.cvy">
    ...
    </file>
    <file path="prompts/writer.md">
    ...
    </file>

    Paths must be relative, contain no .., and sit under . or prompts/.

  4. Loads the files in memory and runs the same checks as convoy validate.

  5. Writes the files if they pass, and prints a summary.

The retry loop

If validation reports errors and attempts remain, the CLI appends the model’s reply and a new user message to the conversation: convoy validate reported these errors. Return the full corrected set of files., followed by every error in plain text. The model returns a complete corrected set and the loop repeats.

  • Warnings are printed but never trigger a retry.
  • --attempts bounds the loop (default 3).
  • If errors remain after the last attempt, nothing is written. The diagnostics are printed, the last model output is saved to .convoy/goal-failed.txt, and the command exits 3.

Flags

FlagDefaultMeaning
--providerrequiredanthropic or openai. openai also covers OpenAI-compatible servers with --base-url
--modelrequiredModel id, passed through unchanged. Not checked against any price catalog
--base-urlprovider defaultOverride the inference URL for a proxy, gateway, or self-hosted server
--attempts3Total model calls before giving up
--max-retries3Retries of a failed model request (network or API errors)
--overwriteoffReplace main.cvy and any other returned file that already exists
--dry-runoffPrint the files to stdout instead of writing

Global flags such as --dir apply. The key comes from ANTHROPIC_API_KEY or OPENAI_API_KEY in your shell.

Example

Terminal
$ convoy goal --provider anthropic --model claude-opus-5 \
    "Write a sourced 10-page market report on edge inference chips"
  wrote ./main.cvy
  wrote ./prompts/research.md
  wrote ./prompts/writer.md
  wrote ./prompts/critic.md
  validate: ok

  agents   researcher[nvidia, groq, cerebras, tenstorrent] -> writer <-> critic
  edges    researcher -> writer
  topics   findings, drafts, review, human

  review the files, then: convoy run

The summary collapses each count or for_each agent into one line, with its index range (worker[0..3]) or its keys, lists dependency edges as a -> b, and ends by pointing at convoy run.

When a first attempt fails and the second passes, the extra diagnostics go to stderr:

Terminal
$ convoy goal --provider openai --model gpt-6.1-sol "Fix the failing tests in ./repo"
attempt 1: 2 errors, retrying
  main.cvy:14: error: agent "fixer" references undeclared topic "results"
  main.cvy:22: error: swarm "fix_tests" has no done_when
  wrote ./main.cvy
  wrote ./prompts/fixer.md
  validate: ok

Existing files

After validation, if main.cvy or any returned path exists and --overwrite is not set, the command exits 1 with main.cvy exists; pass --overwrite. Nothing is written.

Exit codes

CodeCause
0Files written (or printed with --dry-run)
1A file exists and --overwrite is not set, or the model request failed
2Missing --provider or --model, or an unknown provider
3Errors remain after the last attempt

API endpoint

None. goal talks to the model provider, not to convoyd.

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