DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to run a coding agent in scripts and CI with Qwen Code

Use Qwen Code's headless mode or Python SDK to run agent tasks in batch jobs and pipelines.

Short answer: Install Qwen Code and configure a provider as in the Quick Start; then 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. All steps.

Credentials. CI runs need a provider API key; store it as a secret and scope it to the minimum.

Who it is forA platform engineer who wants an agent to summarise, review or fix code as a CI step.

The problemInteractive agents are hard to use in automation, where there is no one to type prompts.

The outcomeScripted agent runs with qwen -p in CI, or a Python program that streams results from the SDK.

What you need first

  • 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

Steps

  1. Install Qwen Code and configure a provider as in the Quick Start
  2. Run headless with qwen -p "..." in scripts, CI/CD or batch jobs
  3. Or use the Python SDK: call query with a prompt, cwd and path_to_qwen_executable, as in the README example
  4. Print only result messages using is_sdk_result_message
  5. Store provider keys as CI secrets rather than in the repository

Prompt for your agent

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.

Caveat. An agent with write access in CI can change code; start with read-only tasks such as summaries.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for QwenLM/qwen-code and "Run a coding agent in scripts and CI"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer