{
 "schema_version": 1,
 "generated": "2026-11-09",
 "id": "qwenlm-qwen-code--use-qwen-code-headless-in-ci",
 "repo": "QwenLM/qwen-code",
 "repo_url": "https://github.com/QwenLM/qwen-code",
 "repo_slug": "qwenlm-qwen-code",
 "title": "Run a coding agent in scripts and CI",
 "page_title": "How to run a coding agent in scripts and CI with Qwen Code",
 "summary": "Use Qwen Code's headless mode or Python SDK to run agent tasks in batch jobs and pipelines.",
 "who": "A platform engineer who wants an agent to summarise, review or fix code as a CI step.",
 "problem": "Interactive agents are hard to use in automation, where there is no one to type prompts.",
 "outcome": "Scripted agent runs with qwen -p in CI, or a Python program that streams results from the SDK.",
 "steps": [
  "Install Qwen Code and configure a provider as in the Quick Start",
  "Run headless with `qwen -p \"...\"` in scripts, CI/CD or batch jobs",
  "Or use the Python SDK: call query with a prompt, cwd and path_to_qwen_executable, as in the README example",
  "Print only result messages using is_sdk_result_message",
  "Store provider keys as CI secrets rather than in the repository"
 ],
 "agent_prompt": "Add a CI step that runs QwenLM/qwen-code headless with `qwen -p \"...\"` to <task, for example summarise changed files>. Use the provider key from the CI secret <name> and fail the job if the agent reports errors.",
 "agents": [
  "any"
 ],
 "difficulty": "Intermediate",
 "time": "30 minutes",
 "basis": "readme",
 "caveat": "An agent with write access in CI can change code; start with read-only tasks such as summaries.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "typescript",
 "requirements": [
  "Linux, macOS or Windows",
  "The standalone installer, or Node.js 22 or later for npm, or Homebrew",
  "An API key for a supported provider, or a local model via Ollama or vLLM",
  "Optional: VS Code, Zed or JetBrains for editor integration"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [
  {
   "tag": "credentials",
   "notice": "CI runs need a provider API key; store it as a secret and scope it to the minimum."
  }
 ],
 "best": false,
 "score": 0.9,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/qwenlm-qwen-code/use-qwen-code-headless-in-ci/",
 "md": "https://dedupedai.com/use-cases/qwenlm-qwen-code/use-qwen-code-headless-in-ci/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/qwenlm-qwen-code--use-qwen-code-headless-in-ci.json",
 "api_version": "v1"
}
