On October 27, 2026, Microsoft officially announced the Type Server Protocol (TSP). In this architectural evolution, Pyright—which has anchored Python tooling for a decade—was extracted from Pylance into an interchangeable component, while Meta’s open-source type checker, Pyrefly, became the first external backend fully integrated.
This shift establishes a dedicated type-semantic channel layered on top of the Language Server Protocol (LSP). With autocompletion, go-to-definition, and inline hints serving as downstream consumers, the protocol transforms the type system into an independent semantic query engine, broadening its audience to automated analysis tools and AI coding agents.
Decoupling a Decade-Old Core: Pylance Breaks Free from Pyright
In Pylance’s previous design, the extension was tightly coupled with Pyright. Pyright parsed syntax trees and computed type inferences, while Pylance provided the outer layer, handling autocompletion, navigation, and Python environment management inside VS Code. Although this tight coupling guaranteed out-of-the-box stability, it locked down the underlying type analysis implementation.
TSP breaks this monolithic architecture. Pylance continues to handle Python intelligence features and Copilot integration, but diagnostics and type computation are abstracted into independent services. Pyright steps back to become the default checker option, opening the door for any engine complying with the TSP specification.
Crucially, this decoupling allows developers to swap type engines without abandoning their existing workspace setup. Running standalone third-party extensions often breaks deep integration with virtual environment managers and Copilot. By routing through Pylance over TSP, the editor ingests new computing backends while preserving familiar workflows.
Meta Delivers 1.8 Million Lines per Second: Pyrefly Tackles Massive Monorepos
Meta emerged as the first major external partner for TSP, delivering full compliance through Pyrefly. In benchmark runs, Pyrefly reached a type-checking throughput of 1.8 million lines per second. In monorepos spanning millions of lines of code, full-project type checking drops from minutes to seconds, eliminating editor stutter and latency.
This performance reflects Meta’s long-term engineering investments in maintaining large-scale Python codebases like Instagram. Since 2017, Meta has continuously explored static typing strategies for dynamic languages. Pyrefly is no theoretical proof of concept; it enters the ecosystem backed by rigorous production deployment.
To ensure immediate practical utility, Meta thoroughly typed key data science and scientific computing libraries. Reports indicate NumPy’s type completeness approaches 90%, and pandas’ public APIs are fully covered. Dynamic third-party libraries receive highly accurate static inferences, allowing the backend to deduce deterministic types even across unannotated blocks.
Snapshots and Multi-Channel Read: TSP Lays the Groundwork for Automation
From a specification standpoint, TSP builds directly on LSP, sharing the same JSON-RPC communication primitives. The type server maintains workspace state in the background, centrally managing version negotiation, search paths, and module import resolutions. Both the formal specification and TypeScript interface definitions are open-sourced under docs/tsp in the microsoft/pylance-release repository.
The 0.4.1 specification introduces two core capabilities: snapshot-bound type results and multi-connection read-only channels. While editor formatting only requires unidirectional diagnostics, automated analyzers need concurrent access to code states. Multi-channel architecture allows external processes to read type data concurrently without blocking the primary editing UI.
The protocol exposes three primary query categories: computed types, declared types, and expected types. These interfaces flatten the abstract syntax tree into structured data, allowing external tools to inspect variable constraints via lightweight RPC calls. By turning code context into deterministic fields, automated agents query type bounds directly without parsing ASTs themselves.
Smooth, Zero-Cost Transition: Enabling Pyrefly in VS Code
For developers, switching backends is designed to be seamless. The setup requires Pylance version 2026.4.1 or higher and Pyrefly 0.60.0 or above. These baseline versions establish the handshake boundaries required for the read-only multi-channel mechanism to operate reliably across both ends.
When Pyrefly is installed in the workspace or virtual environment, or when a configuration file includes [tool.pyrefly], VS Code automatically detects it and displays a prompt. Confirming the prompt switches the diagnostic backend to Pyrefly immediately.
Figure 1: After Pyrefly is installed in the workspace, VS Code prompts whether to use it as the type diagnostic source. Source: devblogs.microsoft.com
Developers can also configure the backend manually. Under Python › Analysis: Diagnostics Source in Settings, three options are available: Pylance, Pylance + Pyright, and Pylance + Pyrefly. This setup ensures developers can fall back to the default engine at any time.
Figure 2: Configuring Diagnostics Source in Python extension settings to select different checkers inside Pylance. Source: devblogs.microsoft.com
Once configured, the VS Code status bar displays the active diagnostic backend as Diagnostics Source: Pylance + Pyrefly. At this stage, Pyrefly handles type checking, while high-level interaction logic and hotkeys remain natively driven by Pylance.
Figure 3: The status bar reflects the active diagnostic backend, confirming coordination between Pylance and Pyrefly. Source: devblogs.microsoft.com
Reframing the Ecosystem: Type Services as AI Infrastructure
Microsoft did not decouple a decade of Pyright development merely to render squiggly lines under syntax errors. The real impetus comes from LLM-driven coding, which demands precise, deterministic code context. Copilot completions, code chat, and Model Context Protocol (MCP) tools all rely on robust semantic types.
Relying solely on textual matching, large language models struggle with dynamic dispatch in complex architectures. A type server precomputes symbol dependencies into graphs exposed via snapshot APIs. Coding agents can issue structured queries to verify parameter types and bounds, reducing hallucination rates in generated code.
By releasing an open protocol, Microsoft establishes a commanding position across the ecosystem. Standardizing type queries defines the semantic boundary between intelligent agents and codebases. As type analysis transitions to a service model, it actively reshapes the foundation of modern AI developer toolchains.
Reference links:
- Official Microsoft Python Blog announcement
- Pyrefly documentation and benchmark reports