News

Cloudflare Workers RPC Now Bridges Python and JavaScript

Cloudflare's Workers RPC now works across Python and JavaScript, letting developers call methods and share objects between languages without schemas, dependencies, or extra config.

August 3, 2026· 2 min read· Source: The Cloudflare Blog
Cloudflare Workers RPC Now Bridges Python and JavaScript

Cloudflare has extended its Workers RPC system to work across Python and JavaScript, eliminating the usual friction of cross-language communication. Previously, Workers RPC was JavaScript-only, built on Cap'n Proto. Now, a Python Worker can call methods on a JavaScript Worker and vice versa, with type conversion handled automatically.

The key enabler is Pyodide's Foreign Function Interface (FFI), which translates between Python and JavaScript types. For standard types like int, float, bool, dict, and list, the mapping is straightforward. For custom objects, Pyodide creates proxies that forward calls across the boundary. Cloudflare added a custom conversion layer via the workers-runtime-sdk Python package to handle Web API objects like Request and Response, which lack direct Python equivalents.

This means you can write a TypeScript Worker with a method like add(a, b) and call it from Python with await rpc.add(42, 144)—no protobuf schemas, no custom APIs, no dependencies. Service bindings are all that's needed to connect the two.

The system supports passing Structured Cloneable types, functions, and even exceptions across the boundary. RPC calls typically run in the same thread, so performance overhead is near zero. The implementation is open source in workerd and workers-runtime-sdk.

One practical use case: using Python packages from JavaScript. For example, you can expose a Pygments syntax highlighting method from a Python Worker and call it from JavaScript, getting the best of both ecosystems without building a separate microservice.

This is a significant step toward polyglot development on the edge, but it's not without tradeoffs. The type conversion layer adds complexity, and developers need to be aware of how their types map across languages. Still, for teams already invested in Cloudflare Workers, this removes a major barrier to mixing languages.

You can now call methods defined in a Python Worker from a JavaScript Worker and vice versa. It all just works.
Manul X Editorial