Documentation
¶
Overview ¶
Package qwen adapts the Qwen Code CLI (`qwen`) into an inference backend.
The CLI is launched non-interactively in an empty scratch directory with a sanitized environment and a generated settings file that leaves it no tools: agent2api uses it as a plain LLM, never as an agent that touches the machine.
How the tools get turned off, and why it takes this much ¶
The other three adapters disable tools with a flag. Qwen Code has none, and the settings that do the job come with two traps its own documentation names.
An allowlist looks like the answer — `tools.core` is fail-closed over the core tool set — but an *empty* one "is treated as unset and disables nothing", so `tools.core: []` would leave every tool live. A non-empty list of a name that matches nothing is what actually closes it.
That alone is not enough. The tools it removes stay reachable through `tool_search`, which is not a core tool and so survives the allowlist: asked to list a directory under `tools.core` alone, the CLI found `glob` and `run_shell_command` again and read the directory. The non-core tools have to be denied by name as well.
A denylist has the failure mode the project cannot accept — the docs warn it "must be re-audited per release", because a built-in added later registers until explicitly denied. So the deny list is not the guarantee. The guarantee is [parser], which reads the tool list the CLI reports on startup and fails the run if it is not empty. A future release that adds a tool breaks loudly instead of quietly handing the model a shell.
`--safe-mode` is deliberately not passed. It disables customisations, and the settings file below is one: with it the CLI came back with all 23 tools live.
Index ¶
Constants ¶
const ID = "qwen-code"
ID is the adapter id used to namespace this backend's models.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter is the Qwen Code backend.
func (*Adapter) Probe ¶
Probe checks that the CLI is installed and exposes the flags agent2api needs.
It reports no account, and says nothing about why. `qwen auth` describes itself as removed and the CLI offers no equivalent of `claude auth status --json`, so the only way to learn whether it is logged in is to send a prompt — which costs tokens, and probing is meant to be free. An unauthenticated install fails its first real request with the CLI's own explanation instead.
That could be a note, and was one. But Health.Notes is for remarks about a particular install — a flag this version lacks, a sandbox loosened in config — and a note that fires on every healthy run is not a remark, it is a permanent footnote under a table that is otherwise all `ok`. The empty account column carries the same information for anyone who looks.