Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Why Qwen Code Uses TypeScript, Not Python


title: Why Qwen Code Uses TypeScript, Not Python authors:


Why Qwen Code Uses TypeScript, Not Python

Implementation Language Decision

Qwen Code is pure TypeScript — it uses Node.js built-in modules for all file operations:

No shell-outs, no exec, no spawn, no OS tools like cat/head/tail.


Why TypeScript, Not Python?

1. Inherited from Gemini CLI

The project explicitly states it’s “based on Google Gemini CLI with adaptations to better support Qwen-Coder models.” Google Gemini CLI was already written in TypeScript. Rewriting it in Python would have been a massive undertaking with little upside.

2. Node.js is the standard runtime for CLIs in the JS ecosystem

If you’re building a CLI tool in the JavaScript/TypeScript world, Node.js (or Bun/Deno) is the runtime. It ships with built-in modules for filesystem access, process management, streams, etc. — no need for a separate language.

3. TypeScript gives you compile-time safety for a complex codebase

This isn’t a simple script — it’s a full agentic framework with:

TypeScript’s type system catches bugs early, which matters when the codebase spans many packages and hundreds of files.

4. The terminal UI uses Ink (React for CLI)

Ink lets you build interactive terminal UIs with React components. That’s a React/JS ecosystem thing. Python has alternatives (like textual or rich), but they wouldn’t integrate with the existing codebase.

5. Node.js performance is fine for this use case

The bottleneck in an agentic CLI isn’t the language — it’s:

Node.js’s event loop actually handles this well. Python would be similar in practice.

Why not Python?

Python is popular for CLI tools and AI/ML work, but:

In short: it’s TypeScript because the project it forks from was TypeScript, and there was no compelling reason to rewrite it.


Building Your Own Agent: Python vs TypeScript

You can absolutely write your own agent in Python. In fact, Python is one of the most popular languages for building AI agents.

Python’s strengths for agents:

When to pick Python vs TypeScript:

PythonTypeScript
Data/ML-heavy agent✅ Better—
CLI terminal toolGood (Rich, Textual)✅ Better (Ink, oclif)
Web-based agentGood (FastAPI)✅ Better (Next.js, Express)
Team’s primary languagePython teamJS/TS team

For your own agent, consider:

If you’re starting from scratch with no existing codebase, Python is a great choice. The reason Qwen Code uses TypeScript is purely inheritance from Gemini CLI, not because TS is objectively better for agents.