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
- 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
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
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer