### Quick Start Example Source: https://qwenlm.github.io/qwen-code-docs/en/developers/sdk-python A basic example demonstrating how to use the `query` function from the SDK to get information about a repository structure. It shows how to handle asynchronous message streams and identify SDK result messages. ```APIDOC ## Quick Start ```python import asyncio from qwen_code_sdk import is_sdk_result_message, query async def main() -> None: result = query( "Explain the repository structure.", { "cwd": "/path/to/project", "path_to_qwen_executable": "qwen", }, ) async for message in result: if is_sdk_result_message(message): print(message["result"]) asyncio.run(main()) ``` ``` -------------------------------- ### Installing Qwen Code Extensions from npm Source: https://qwenlm.github.io/qwen-code-docs/en/users/extension/extension-releasing These commands illustrate how users can install Qwen Code extensions published on npm. Examples include installing the latest version, a specific version, and installing from a custom registry. ```bash # Install latest version qwen extensions install @your-org/my-extension # Install a specific version qwen extensions install @your-org/my-extension@1.2.0 # Install from a custom registry qwen extensions install @your-org/my-extension --registry https://your-registry.com ``` -------------------------------- ### Start Qwen Code CLI Source: https://qwenlm.github.io/qwen-code-docs/en/users/integration-github-action Initiate the Qwen Code CLI in your terminal to begin the setup process. ```bash qwen ``` -------------------------------- ### Install and Use oss-styles Skill Source: https://qwenlm.github.io/qwen-code-docs/en/blog/feat-skills-oss-styles Instructions for installing and using the 'oss-styles' skill within Qwen Code. This involves navigating to your project directory, starting Qwen Code, and then providing the prompt to generate a video. ```shell # Enter project directory cd your-project # Start Qwen Code qwen # Then directly tell Qwen Code Based on this skill https://github.com/QwenLM/qwen-code-examples/blob/main/skills/oss-styles/SKILL.md Help me generate a demo video for the repository: ``` -------------------------------- ### Launching Interactive `qwen auth` Source: https://qwenlm.github.io/qwen-code-docs/en/users/configuration/auth Run `qwen auth` without arguments to start an interactive menu for authentication setup. ```shell qwen auth ``` -------------------------------- ### Source Code Installation of Qwen Cowork Source: https://qwenlm.github.io/qwen-code-docs/en/blog/how-to-use-qwencode-cowork Advanced installation method for building Qwen Cowork from source. Requires installing Bun first, then cloning the repository, installing dependencies, and launching the project. ```shell # Install Bun curl -fsSL https://bun.sh/install | bash exec /bin/zsh # Clone repository git clone https://github.com/QwenLM/qwen-code-examples # Enter directory and install cd qwen-code-examples/apps/qwen-cowork bun install # Launch bun run dev ``` -------------------------------- ### Install and Launch Qwen Cowork Project Source: https://qwenlm.github.io/qwen-code-docs/en/blog/how-to-use-qwencode-cowork Use this command to install the Qwen Cowork project and launch it directly via Qwen Code. This is the recommended installation method. ```shell Help me install the cowork project and launch it, the repository address is: https://github.com/QwenLM/qwen-code-examples ``` -------------------------------- ### Simple Query Example Source: https://qwenlm.github.io/qwen-code-docs/en/developers/sdk-java This example demonstrates the simplest way to use the SDK by performing a basic query. ```java public static void runSimpleExample() { List result = QwenCodeCli.simpleQuery("hello world"); result.forEach(logger::info); } ``` -------------------------------- ### Install qwen-code-sdk Source: https://qwenlm.github.io/qwen-code-docs/en/developers/sdk-python Install the SDK using pip. If the 'qwen' executable is not in your PATH, you can specify its location. ```bash pip install qwen-code-sdk ``` -------------------------------- ### Ask Qwen Code about your project Source: https://qwenlm.github.io/qwen-code-docs/en/users/overview After starting Qwen Code, you can ask questions about your project. This example shows how to inquire about the project's purpose. ```bash what does this project do? ``` -------------------------------- ### Start Qwen Code Session Source: https://qwenlm.github.io/qwen-code-docs/en/users/quickstart Navigate to your project directory and run this command to start an interactive Qwen Code session. ```bash cd /path/to/your/project qwen ``` -------------------------------- ### Install an Extension Source: https://qwenlm.github.io/qwen-code-docs/en/developers/extensions/extension Installs an extension from a GitHub URL. The extension is copied to the local installation directory. ```bash qwen extensions install https://github.com/qwen-cli-extensions/security ``` -------------------------------- ### PostCompact Example Configuration Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/hooks An example configuration for the PostCompact hook, demonstrating how to set up a command to save the compact summary. ```json { "hooks": { "PostCompact": [ { "matcher": "manual", "hooks": [ { "type": "command", "command": "/path/to/save-compact-summary.sh", "name": "save-summary" } ] } ] } } ``` -------------------------------- ### Start All Channels Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/channels/overview Starts all configured channels. Ensure your bot tokens and configurations are set up correctly in `settings.json`. ```bash qwen channel start ``` -------------------------------- ### Start All Configured Channels Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/channels/dingtalk Start all channels configured in your settings.json file simultaneously. This is useful for managing multiple integrations. ```bash # Or start all configured channels together qwen channel start ``` -------------------------------- ### Install TypeScript SDK Source: https://qwenlm.github.io/qwen-code-docs/en/developers/sdk-typescript Install the @qwen-code/sdk package using npm. ```bash npm install @qwen-code/sdk ``` -------------------------------- ### Install Extension Dependencies Source: https://qwenlm.github.io/qwen-code-docs/en/developers/extensions/getting-started-extensions Navigate to your extension's directory and run 'npm install' to install all necessary Node.js dependencies. ```bash cd my-first-extension npm install ``` -------------------------------- ### Install Writing Polish Skills Source: https://qwenlm.github.io/qwen-code-docs/en/blog/obsidian Installs 'writing polish' related Skills for Qwen Code. It first checks for the existence of 'find-skills' and installs it if necessary, then proceeds to find and install writing-related Skills. ```bash First check if `find-skills` exists; if not, install it using `npx skills add https://github.com/vercel-labs/skills --skill find-skills`. Then help me find and install Skills related to "writing polish". ``` -------------------------------- ### Install Beta Channel Extension Source: https://qwenlm.github.io/qwen-code-docs/en/users/extension/extension-releasing Instructs users on how to install a beta version of an extension using the specified tag. ```bash qwen extensions install @your-org/my-extension@beta ``` -------------------------------- ### SessionStart Hook Example Output Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/hooks This example demonstrates the output for the SessionStart hook, providing additional context to be available throughout the session. ```json { "hookSpecificOutput": { "additionalContext": "Session started with security policies enabled." } } ``` -------------------------------- ### Install Qwen Code Source: https://qwenlm.github.io/qwen-code-docs/en/showcase Quickly install Qwen Code using a one-line command for immediate use. ```bash Install Now ``` -------------------------------- ### Start Qwen Code Application Source: https://qwenlm.github.io/qwen-code-docs/en/developers/contributing Run the Qwen Code application from the source code after building. This command starts the CLI utility. ```bash npm start ``` -------------------------------- ### Start Custom Channel Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/channels/plugins Use these commands to start channels. You can start all channels, including custom ones, or specify a particular custom channel by its name. ```bash qwen channel start ``` ```bash qwen channel start my-bot ``` -------------------------------- ### Install Dependencies and Build Project Source: https://qwenlm.github.io/qwen-code-docs/en/users/support/troubleshooting Run these commands to ensure all project dependencies are installed and the project is compiled, resolving MODULE_NOT_FOUND or import errors. ```bash npm install ``` ```bash npm run build ``` -------------------------------- ### Install Qwen Code on Windows Source: https://qwenlm.github.io/qwen-code-docs/en/blog/weekly-update-2026-02-09 Run this command as an Administrator in CMD to install Qwen Code on Windows. ```batch curl -fsSL -o %TEMP%\install-qwen.bat https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.bat && %TEMP%\install-qwen.bat ``` -------------------------------- ### Install Project Dependencies Source: https://qwenlm.github.io/qwen-code-docs/en/developers/contributing Install all project dependencies, including those defined in package.json and root dependencies. Run this after cloning the repository. ```bash npm install ``` -------------------------------- ### Start Background Server with '&' Source: https://qwenlm.github.io/qwen-code-docs/en/developers/tools/shell Starts a development server in the background by appending `&` to the command. Note that `is_background` must still be specified. ```python run_shell_command(command="npm run dev &", description="Start development server in background", is_background=false) ``` -------------------------------- ### Install Qwen Code IDE Extension via CLI Source: https://qwenlm.github.io/qwen-code-docs/en/users/ide-integration/ide-integration Use this command to manually install the Qwen Code companion extension if you previously dismissed the automatic prompt or prefer manual installation. ```bash /ide install ``` -------------------------------- ### Install to Local Repository with Maven Source: https://qwenlm.github.io/qwen-code-docs/en/developers/sdk-java Run this command to install the project artifact to your local Maven repository. ```bash mvn install ``` -------------------------------- ### Non-interactive Coding Plan Setup Source: https://qwenlm.github.io/qwen-code-docs/en/users/configuration/auth Use the `qwen auth coding-plan` subcommand with arguments for non-interactive setup, suitable for CI/scripting. ```shell qwen auth coding-plan --region china --key sk-sp-xxxxxxxxx ``` -------------------------------- ### SubagentStart Hook Example Output Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/hooks Shows an example output for the SubagentStart hook, which is executed when a subagent begins. It can provide additional context for the subagent. ```json { "hookSpecificOutput": { "additionalContext": "Subagent initialized with restricted permissions." } } ``` -------------------------------- ### Start All Configured Channels Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/channels/overview Starts all channels defined in the configuration, sharing a single agent process. The bot runs in the foreground. ```bash # Start all configured channels (shared agent process) qwen channel start ``` -------------------------------- ### Streaming Example with Custom Consumers Source: https://qwenlm.github.io/qwen-code-docs/en/developers/sdk-java This example demonstrates handling streaming content by providing custom consumers for different content types. ```java public static void runStreamingExample() { QwenCodeCli.simpleQuery("who are you, what are your capabilities?", new TransportOptions().setMessageTimeout(new Timeout(10L, TimeUnit.SECONDS)), new AssistantContentSimpleConsumers() { @Override public void onText(Session session, TextAssistantContent textAssistantContent) { logger.info("Text content received: {}", textAssistantContent.getText()); } @Override public void onThinking(Session session, ThinkingAssistantContent thinkingAssistantContent) { logger.info("Thinking content received: {}", thinkingAssistantContent.getThinking()); } @Override public void onToolUse(Session session, ToolUseAssistantContent toolUseContent) { logger.info("Tool use content received: {} with arguments: {}", toolUseContent, toolUseContent.getInput()); } @Override public void onToolResult(Session session, ToolResultAssistantContent toolResultContent) { logger.info("Tool result content received: {}", toolResultContent.getContent()); } @Override public void onOtherContent(Session session, AssistantContent other) { logger.info("Other content received: {}", other); } @Override public void onUsage(Session session, AssistantUsage assistantUsage) { logger.info("Usage information received: Input tokens: {}, Output tokens: {}", assistantUsage.getUsage().getInputTokens(), assistantUsage.getUsage().getOutputTokens()); } }.setDefaultPermissionOperation(Operation.allow)); logger.info("Streaming example completed."); } ``` -------------------------------- ### Install Qwen Code NPM Packages Source: https://qwenlm.github.io/qwen-code-docs/en/developers/development/npm Use these commands to install the stable, preview, or nightly versions of the Qwen Code package. ```bash # Stable (default) npm install -g @qwen-code/qwen-code # Preview npm install -g @qwen-code/qwen-code@preview # Nightly npm install -g @qwen-code/qwen-code@nightly ``` -------------------------------- ### Start Documentation Development Server Source: https://qwenlm.github.io/qwen-code-docs/en/developers/contributing Launch the local development server for the documentation site, enabling live previews. ```bash npm run dev ``` -------------------------------- ### Setting up Qwen Code with FIFO pipes Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/dual-output This example shows how to create FIFO special files and run Qwen Code with both `--json-file` and `--input-file` flags for event streaming. ```bash mkfifo /tmp/qwen-events.jsonl /tmp/qwen-input.jsonl qwen \ --json-file /tmp/qwen-events.jsonl \ --input-file /tmp/qwen-input.jsonl ``` -------------------------------- ### Start using Qwen Code in a project Source: https://qwenlm.github.io/qwen-code-docs/en/users/overview Navigate to your project directory and run the 'qwen' command to start using Qwen Code. You will be prompted to choose an authentication method. ```bash cd your-project qwen ``` -------------------------------- ### Install Qwen Code Preview Version Source: https://qwenlm.github.io/qwen-code-docs/en/blog/channels-weixin-launch-announcement Install the preview version of Qwen Code globally. This is a prerequisite for using the WeChat channel feature. ```bash npm i @qwen-code/qwen-code@0.14.0-preview.0 -g ``` -------------------------------- ### Execute MCP Command Source: https://qwenlm.github.io/qwen-code-docs/en/developers/tools/mcp-server Use the /mcp command in the terminal to get information about your MCP server setup. ```bash /mcp ``` -------------------------------- ### Example settings.json Configuration Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/followup-suggestions This example demonstrates how to configure both the fast model and UI-related settings for followup suggestions in `settings.json`. It enables followup suggestions and cache sharing. ```json { "fastModel": "qwen3-coder-flash", "ui": { "enableFollowupSuggestions": true, "enableCacheSharing": true } } ``` -------------------------------- ### Summarize a Single Article Source: https://qwenlm.github.io/qwen-code-docs/en/developers/tools/web-fetch A straightforward example of using web_fetch to get a summary of an article from a given URL. ```python web_fetch(url="https://example.com/news/latest", prompt="Can you summarize the main points of this article?") ``` -------------------------------- ### Extend Docker Sandbox Image with Java Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/sandbox Create a custom sandbox.Dockerfile to extend the base Qwen Code Docker image and install necessary runtimes like Java. This example installs OpenJDK 17 JRE. ```dockerfile FROM ghcr.io/qwenlm/qwen-code:latest RUN apt-get update && \ apt-get install -y openjdk-17-jre && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* ``` -------------------------------- ### Example Context File Content Source: https://qwenlm.github.io/qwen-code-docs/en/users/configuration/settings This Markdown file provides a conceptual example of how to structure project-specific instructions, coding style guidelines, and component-specific notes for the Qwen AI model. ```markdown # Project: My Awesome TypeScript Library ## General Instructions: - When generating new TypeScript code, please follow the existing coding style. - Ensure all new functions and classes have JSDoc comments. - Prefer functional programming paradigms where appropriate. - All code should be compatible with TypeScript 5.0 and Node.js 20+. ## Coding Style: - Use 2 spaces for indentation. - Interface names should be prefixed with `I` (e.g., `IUserService`). - Private class members should be prefixed with an underscore (`_`). - Always use strict equality (`===` and `!==`). ## Specific Component: `src/api/client.ts` - This file handles all outbound API requests. - When adding new API call functions, ensure they include robust error handling and logging. - Use the existing `fetchWithRetry` utility for all GET requests. ## Regarding Dependencies: - Avoid introducing new external dependencies unless absolutely necessary. - If a new dependency is required, please state the reason. ``` -------------------------------- ### Per-Server Trust Override Configuration Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/lsp Example configuration to override trust requirements for a specific language server. Set `trustRequired` to `false` to allow servers to start in untrusted workspaces. ```json { "safe-server": { "command": "safe-language-server", "args": ["--stdio"], "trustRequired": false, "extensionToLanguage": { ".safe": "safe" } } } ``` -------------------------------- ### Java (jdtls) LSP Configuration Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/lsp Configure the JDTLS language server for Java development. Ensure a JDK and JDTLS are installed and available in your PATH. This example specifies the command and arguments for jdtls. ```json { "java": { "command": "jdtls", "args": ["-configuration", ".jdtls-config", "-data", ".jdtls-workspace"] } } ``` -------------------------------- ### Install Extension from Local Path Source: https://qwenlm.github.io/qwen-code-docs/en/users/extension/introduction Install an extension from a local directory on your machine. A copy of the extension is created, so updates require running `qwen extensions update`. ```bash qwen extensions install /path/to/your/extension ``` -------------------------------- ### Refactoring Plan Example with exit_plan_mode Source: https://qwenlm.github.io/qwen-code-docs/en/developers/tools/exit-plan-mode Outlines a plan for refactoring a database layer using TypeORM, detailing setup, configuration, and migration steps. Use this when planning code modifications or upgrades. ```python exit_plan_mode(plan="## Database Layer Refactoring Plan ### Phase 1: Setup and Configuration - Install and configure TypeORM dependencies - Create database connection configuration - Set up entity definitions for existing models ### Phase 2: Migration - Create migration scripts for existing data - Implement new repository pattern using TypeORM - Replace raw SQL queries with TypeORM query builder ### Phase 3: Testing and Validation - Write unit tests for new repositories - Perform integration tests to ensure data integrity - Validate existing functionalities against the new layer This refactoring is estimated to take 1-2 days and will impact the data access layer significantly.") ``` -------------------------------- ### Start WeChat Channel Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/channels/weixin Use this command to start only the configured WeChat channel. Alternatively, 'qwen channel start' can be used to start all configured channels. ```bash # Start only the WeChat channel qwen channel start my-weixin ``` ```bash # Or start all configured channels together qwen channel start ``` -------------------------------- ### Start Telegram Channel Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/channels/telegram Start the configured Telegram channel using the `qwen channel start` command. You can start a specific channel or all configured channels. ```bash # Start only the Telegram channel qwen channel start my-telegram ``` ```bash # Or start all configured channels together qwen channel start ``` -------------------------------- ### Example Permissions Configuration Source: https://qwenlm.github.io/qwen-code-docs/en/users/configuration/settings This JSON object demonstrates how to configure allow, ask, and deny rules for various tools and path patterns. Ensure correct syntax for tool names and path specifiers. ```json { "permissions": { "allow": ["Bash(git *)", "Bash(npm run *)", "Read(//Users/alice/code/**)"], "ask": ["Bash(git push *)", "Edit"], "deny": ["Bash(rm -rf *)", "Read(.env)", "WebFetch(malicious.com)"] } } ``` -------------------------------- ### Uninstall Globally Installed npm Package Source: https://qwenlm.github.io/qwen-code-docs/en/users/support/Uninstall Removes a package that was installed globally using npm. Use this command if you installed the CLI with `npm install -g @qwen-code/qwen-code`. ```bash npm uninstall -g @qwen-code/qwen-code ``` -------------------------------- ### Interactive Alibaba Cloud Coding Plan Setup Source: https://qwenlm.github.io/qwen-code-docs/en/users/configuration/auth Sets up Alibaba Cloud Coding Plan authentication interactively by prompting for the region and API key. Recommended for first-time setup. ```bash # Interactive — prompts for region and API key qwen auth coding-plan # Or non-interactive — pass region and key directly qwen auth coding-plan --region china --key sk-sp-xxxxxxxxx ``` -------------------------------- ### Verify Qwen Code Installation Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/sandbox Check the installed version of Qwen Code to confirm successful installation. ```bash qwen --version ``` -------------------------------- ### Example settings.json Configuration Source: https://qwenlm.github.io/qwen-code-docs/en/users/configuration/settings This snippet shows a comprehensive example of a settings.json file, demonstrating various configuration options for Qwen Code, including proxy, general settings, UI preferences, tool configurations, MCP server connections, telemetry, privacy, model parameters, context settings, and advanced environment variable exclusions. ```json { "proxy": "http://localhost:7890", "general": { "vimMode": true, "preferredEditor": "code" }, "ui": { "theme": "GitHub", "hideTips": false, "customWittyPhrases": [ "You forget a thousand things every day. Make sure this is one of 'em", "Connecting to AGI" ] }, "tools": { "approvalMode": "yolo", "sandbox": "docker", "sandboxImage": "ghcr.io/qwenlm/qwen-code:0.14.1", "discoveryCommand": "bin/get_tools", "callCommand": "bin/call_tool", "exclude": ["write_file"] }, "mcpServers": { "mainServer": { "command": "bin/mcp_server.py" }, "anotherServer": { "command": "node", "args": ["mcp_server.js", "--verbose"] } }, "telemetry": { "enabled": true, "target": "local", "otlpEndpoint": "http://localhost:4317", "logPrompts": true }, "privacy": { "usageStatisticsEnabled": true }, "model": { "name": "qwen3-coder-plus", "maxSessionTurns": 10, "enableOpenAILogging": false, "openAILoggingDir": "~/qwen-logs", }, "context": { "fileName": ["CONTEXT.md", "QWEN.md"], "includeDirectories": ["path/to/dir1", "~/path/to/dir2", "../path/to/dir3"], "loadFromIncludeDirectories": true, "fileFiltering": { "respectGitIgnore": false } }, "advanced": { "excludedEnvVars": ["DEBUG", "DEBUG_MODE", "NODE_ENV"] } } ``` -------------------------------- ### Example: Safely implementing a feature Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/approval-mode This example demonstrates initiating a feature implementation in Default Mode. Qwen Code will analyze the codebase, propose a plan, and seek approval before making changes or running commands. ```bash /approval-mode default ``` ```plaintext I need to add user profile pictures to our application. The pictures should be stored in an S3 bucket and the URLs saved in the database. ``` -------------------------------- ### Query with MCP Server Example Source: https://qwenlm.github.io/qwen-code-docs/en/developers/sdk-typescript Demonstrates how to define a tool, create an MCP server with that tool, and then use the server within a query. ```typescript import { z } from 'zod'; import { query, tool, createSdkMcpServer } from '@qwen-code/sdk'; // Define a tool with Zod schema const calculatorTool = tool( 'calculate_sum', 'Add two numbers', { a: z.number(), b: z.number() }, async (args) => ({ content: [{ type: 'text', text: String(args.a + args.b) }], }) ); // Create the MCP server const server = createSdkMcpServer({ name: 'calculator', tools: [calculatorTool], }); // Use the server in a query const result = query({ prompt: 'What is 42 + 17?', options: { permissionMode: 'yolo', mcpServers: { calculator: server, }, }, }); for await (const message of result) { console.log(message); } ``` -------------------------------- ### Install Extension from Git Repository Source: https://qwenlm.github.io/qwen-code-docs/en/users/extension/introduction Install an extension directly from a Git repository URL. This is useful for installing extensions that are not published to a registry. ```bash qwen extensions install https://github.com/github/github-mcp-server ``` -------------------------------- ### Install Qwen Code on Windows Source: https://qwenlm.github.io/qwen-code-docs/en/users/overview Run this PowerShell command as an administrator to install Qwen Code on Windows. It downloads and executes the installation script. ```powershell powershell -Command "Invoke-WebRequest 'https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.bat' -OutFile (Join-Path $env:TEMP 'install-qwen.bat'); & (Join-Path $env:TEMP 'install-qwen.bat')" ``` -------------------------------- ### Quick Start: Using the /review Command Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/code-review Demonstrates various ways to invoke the /review command for different code review scenarios, including local changes, pull requests, and specific files. Ensure you have uncommitted changes or a valid pull request reference for the command to execute. ```bash # Review local uncommitted changes /review # Review a pull request (by number or URL) /review 123 /review https://github.com/org/repo/pull/123 # Review and post inline comments on the PR /review 123 --comment # Review a specific file /review src/utils/auth.ts ``` -------------------------------- ### Install qwen-code-sdk Source: https://qwenlm.github.io/qwen-code-docs/en/developers/sdk-python Install the qwen-code-sdk package using pip. If the 'qwen' executable is not in your PATH, you can specify its location during installation or when calling SDK functions. ```APIDOC ## Install ```bash pip install qwen-code-sdk ``` If `qwen` is not on `PATH`, pass `path_to_qwen_executable` explicitly. ``` -------------------------------- ### Start a new session in Default Mode Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/approval-mode Use this command to explicitly start a new session in Default Mode. This is the initial mode when Qwen Code starts. ```bash /approval-mode default ``` -------------------------------- ### Install Qwen Code CLI Source: https://qwenlm.github.io/qwen-code-docs/en/blog/thinks-like-a-programmer Install the Qwen Code command-line interface globally using npm. Ensure Node.js version 20 or higher is installed. ```bash npm install -g @qwen-code/qwen-code@latest ``` -------------------------------- ### Qwen CLI Conversation Management Examples Source: https://qwenlm.github.io/qwen-code-docs/en/users/common-workflow A collection of examples demonstrating how to manage Qwen Code conversations using the CLI, including continuing the most recent session, providing prompts, and selecting from past conversations. ```bash # Continue most recent conversation qwen --continue # Continue most recent conversation with a specific prompt qwen --continue --p "Show me our progress" # Show conversation picker qwen --resume # Continue most recent conversation in non-interactive mode qwen --continue --p "Run the tests again" ``` -------------------------------- ### Install Preview Version of Qwen Code Source: https://qwenlm.github.io/qwen-code-docs/en/blog/weekly-update-2026-03-20 Install the preview version of Qwen Code to try out the latest features before the official release. This command installs version v0.13.0-preview.1 globally. ```bash npm i @qwen-code/qwen-code@v0.13.0-preview.1 -g ``` -------------------------------- ### Running a Helper Script Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/skills Example of how to execute a Python utility script from the command line. ```bash python scripts/helper.py input.txt ``` -------------------------------- ### Install Extension from Git Repository URI Source: https://qwenlm.github.io/qwen-code-docs/en/users/extension/extension-releasing Users can install an extension directly from a Git repository URI. This command allows for specifying a particular ref (branch, tag, or commit) for the installation. ```bash qwen extensions install ``` -------------------------------- ### Start WeChat Channel Source: https://qwenlm.github.io/qwen-code-docs/en/blog/channels-weixin-launch-announcement Start the configured WeChat channel using the `qwen channel start` command followed by the channel name. This command initiates the connection and makes the bot available in WeChat. ```bash qwen channel start my-weixin ``` -------------------------------- ### Install Dependencies and Build Qwen Code Project Source: https://qwenlm.github.io/qwen-code-docs/en/developers/tools/sandbox Steps to install project dependencies, build the Qwen Code project, and verify the generated dist directory. This is a prerequisite for linking the CLI package. ```bash # 1. First, install the dependencies of the project npm install # 2. Build the Qwen Code project npm run build # 3. Verify that the dist directory has been generated ls -la packages/cli/dist/ ``` -------------------------------- ### Start a Single Channel Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/channels/overview Starts a specific channel by its name. The bot runs in the foreground. ```bash # Start a single channel qwen channel start my-channel ``` -------------------------------- ### Navigate to Docs Site Directory Source: https://qwenlm.github.io/qwen-code-docs/en/developers/contributing Change the current directory to the 'docs-site' folder to set up the documentation site locally. ```bash cd docs-site ``` -------------------------------- ### Run Status Line Setup Agent with Specific Instructions Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/status-line Provide specific instructions to the `/statusline` command to configure the status line to display desired information, such as model name and context usage percentage. ```shell /statusline show model name and context usage percentage ``` -------------------------------- ### Start a Specific Channel Source: https://qwenlm.github.io/qwen-code-docs/en/users/features/channels/overview Starts a single, named channel. Useful for testing or managing specific integrations. ```bash qwen channel start ``` -------------------------------- ### Perform Manual Publish Source: https://qwenlm.github.io/qwen-code-docs/en/developers/contributing Execute a sequence of commands to clean the project, install dependencies, authenticate, and publish a local build artifact. ```bash npm run clean npm install npm run auth npm run prerelease:dev npm publish --workspaces ```