convoy validate [--dir <path>] [--json] [--graph]validate never contacts a model. It contacts convoyd only when a provider names a type that is not built in, to read that type’s schema. A swarm on the built-in types validates with no server at all.
What it does
- Loads every
*.cvyfile in the folder and merges them into one configuration. - For providers whose type is not built in, asks convoyd (
--server) to resolve the types, in one call. The server fetches a type it does not hold, but never runs provider code for this. - Resolves references, builds the dependency graph, and checks every rule in Validation rules, including each provider’s attributes and each agent’s
tools,settings, andmodelagainst its type. - Prints each diagnostic with its source line, warnings first, then errors, separated by blank lines.
- Exits 3 if there is any error, otherwise prints
validate: ok (N agents, M topics)and exits 0.
When the server is down
validate keeps each type’s manifest it receives in your user cache folder (convoy/providers/ under it), indexed by server, source, and constraint. When convoyd cannot be reached, it checks the swarm against the cached manifest and warns with TS017, naming the version and how old the copy is. With nothing cached, TS017 says the type was not checked, and the swarm still validates. The cache is a convenience: the server’s answer always wins, and convoy run is checked on the server regardless.
$ convoy validate
Warning: Provider type checked against a cached copy (TS017)
on providers.cvy line 2, in provider "fast":
2: source = "acme/acme"
No server could be reached, so provider "fast" was checked against the cached
manifest of acme/acme 1.4.2, cached 3 days ago. convoy run checks it on the server.
validate: ok (6 agents, 4 topics)Some checks need the server and cannot run here: whether convoyd has a default overseer (overseer_missing), whether its environment has the provider keys (missing_env), and the server’s price for the overseer model when it comes from server flags (unpriced_model). Those surface on convoy run.
Flags
| Flag | Meaning |
|---|---|
--json | Print {"valid": bool, "diagnostics": [...]} on stdout |
--graph | Print the dependency graph in DOT format and exit 0 if there are no errors |
Each JSON diagnostic has severity, code, summary, detail, and range (file, start and end with line and column).
Examples
$ convoy validate
validate: ok (6 agents, 4 topics)A warning does not fail validation:
$ convoy validate
main.cvy:31: warning: agent "writer" watches topics and keeps the default max_turns (50)
validate: ok (6 agents, 4 topics)An error does:
$ convoy validate
main.cvy:44: error: agent "critic" watches topic "reviews", which is not declared
did you mean topic "review"?
main.cvy:19: error: references form a cycle: agent.writer -> agent.critic -> agent.writer
$ echo $?
3Render the graph:
$ convoy validate --graph | dot -Tsvg > swarm.svgMachine-readable output:
$ convoy validate --json
{"valid":false,"diagnostics":[{"severity":"error","code":"TS020","summary":"undeclared topic","detail":"agent \"critic\" watches topic \"reviews\"","range":{"file":"main.cvy","start":{"line":44,"column":12},"end":{"line":44,"column":31}}}]}Exit codes
| Code | Cause |
|---|---|
0 | No errors (warnings allowed) |
3 | At least one error |
API endpoint
POST /v1/providers:resolve, only for provider types that are not built in.
Related
- Validation rules is the full list of checks.
- Language rules
- convoy run validates first, then sends.
- convoy goal validates its own output in a loop.