Automation with Qwen Code¶
Running little-loops orchestration on the Qwen Code CLI via QwenRunner (scripts/little_loops/host_runner.py, ENH-3156). Flag behavior on this page was live-verified on qwen 0.21.6 by the FEAT-3155 spike (thoughts/research/qwen-code-surface.md).
Running orchestration CLIs¶
All orchestration tools (ll-auto, ll-parallel, ll-action, ll-harness, ll-loop, ll-sprint, plus the FSM evaluators and handoff) support qwen as the backing host CLI. Set LL_HOST_CLI=qwen to select it explicitly:
LL_HOST_CLI=qwen ll-auto
LL_HOST_CLI=qwen ll-parallel --workers 3
LL_HOST_CLI=qwen ll-action manage-issue --json
LL_HOST_CLI=qwen ll-loop run my-loop
LL_HOST_CLI=qwen ll-sprint run v2-launch
Auto-detection¶
You do not need to set LL_HOST_CLI explicitly if qwen is on PATH. resolve_host() in host_runner.py probes available binaries and selects QwenRunner when qwen is found and no override is set.
Detection order (first match wins):
LL_HOST_CLIenvironment variableLL_HOOK_HOSTenvironment variable- Binary probe:
claude→codex→pi→gemini→omp→kimi→qwen→ error
You can also set the host permanently in .ll/ll-config.json (or .qwen/ll-config.json):
What the runner emits¶
QwenRunner.build_streaming assembles argv as:
qwen --yolo --output-format stream-json [--continue] [--include-directories <dir>] [--model <alias>] -p "<prompt>"
with LL_NON_INTERACTIVE=1, DANGEROUSLY_SKIP_PERMISSIONS=1, and QWEN_CODE_SUPPRESS_YOLO_WARNING=1 (keeps stderr clean for error diagnostics) in the child environment. Qwen-specific facts:
--yolo(alias of--approval-mode yolo) is hidden from--helpbut live — the permission-skip path for headless runs.-p <prompt>always terminates the argv (Claude/Kimi convention).--continueresumes the most recent session in the project (requiresgeneral.chatRecording, default on).--include-directoriesis additive, not a jail —workspace_rootwidens access rather than confining it (workspace_sandboxed=False).
Structured output — the headline capability¶
Qwen is the second host after Claude Code with structured_output=True:
- The FSM evaluators append the inline
--json-schema <json>flag whenHostCapabilities.structured_outputis true. The schema is Ajv-validated through a syntheticstructured_outputtool; the verdict arrives as a JSON string in the final envelope'sresultfield (there is no claude-stylestructured_outputenvelope key), and the evaluators' existingjson.loads(result)path handles it. - Session persistence for these one-shot evaluator calls is opted out via
--chat-recording false— qwen rejects claude's--no-session-persistenceflag (argv parse error), so_structured_output_args()keys the persistence opt-out oninvocation.binary. - Hosts without the capability fall back to prompt-and-parse (BUG-2626 tag recovery) — nothing changes for them.
This re-enables the schema-constrained verdict path for ll-loop FSM evaluators on a non-Claude host for the first time.
Output shapes¶
- Streaming (
--output-format stream-json): JSONL —system/init→ interleavedstream_eventdeltas (Qwen-internal, ignorable) →assistantmessages (message.content[],message.usage) → final{"type":"result","subtype":"success","result":"…","usage":{…},"is_error":false}. - Blocking:
build_blocking_jsonalso streams (qwen's--output-format jsonbuffers a JSON array that breaks single-envelope consumers — Kimi posture); consumers take the lastresultenvelope. - Token reporting:
usage(includingtotal_tokens) is present on assistant messages and on the final result envelope.
Capability limitations (warn-and-drop)¶
| Parameter | Behavior |
|---|---|
agent= |
Dropped with a CapabilityNotSupported warning — qwen has no --agent CLI flag (documented upstream as planned future work) |
tools= |
Dropped with a warning — --exclude-tools is a denylist, not allowlist semantics |
disable_background_tasks= |
Accepted, no-op (Protocol conformance; no qwen equivalent) |
Current limitations¶
agent_selectandtool_allowlistare ✗ (see above).SessionEndhooks do not fire under-p— session cleanup in headless runs rides theStoplegacy scripts (see Hook Events).- Qwen chat-file wire format is not parsed by
ll-session backfillextraction yet (folder resolution works; ENH-3161 follow-up). --include-directorieswidens rather than confines — treatworkspace_rootas access expansion.
See also¶
- Getting Started — install and verification
- Hook Events — event → intent mapping
- Host Compatibility Matrix — authoritative parity reference