Overview

9 The future of Wasm

This chapter closes the SmartCMS journey and looks ahead to where WebAssembly is headed beyond getting a Wasm app running in Kubernetes. It distills the strengths that underpin server-side Wasm—portability across languages and platforms, sandboxed execution, and the component model—and uses them to frame emerging opportunities. The focus shifts to how these traits enable secure collaboration, smarter AI integrations, low‑latency edge logic, and a more capable, ergonomic WASI that is converging on long-term stability.

Confidential computing takes center stage as a way to protect data in use with trusted execution environments, and Wasm fits naturally by keeping the trusted computing base small, enabling multi-tenant isolation, and letting developers target enclaves from many languages. Secure multi-party computation becomes practical when models and sensitive datasets meet inside an enclave without exposing secrets. In AI, the chapter goes beyond wasi:nn to highlight wasi-gfx for secure, portable GPU compute and rendering, and discusses the Model Context Protocol as a promising standard for tool-using agents. Implementing MCP servers with Wasm components and WIT-defined capabilities applies the “only what you need” principle, helping contain risks like prompt injection with precise, sandboxed permissions.

At the edge, Wasm’s compact, secure runtime model makes it ideal for executing dynamic logic close to users—powering scenarios like A/B testing, rate limiting, geo-personalization, and token-aware routing—while acknowledging edge constraints and the continued role of centralized backends. The chapter also outlines the WASI roadmap: 0.3 introduces native asynchrony with futures and streams, simplifying interfaces and enabling cross-language async without glue code, followed by incremental additions like cancellation, stream optimizations, and threads. Together these pave the way to WASI 1.0 and long-term stability, positioning Wasm to power secure, portable, and high-performance systems across enclaves, AI agents, and globally distributed edge platforms.

Final architecture of SmartCMS deployed in Kubernetes. The frontend interacts with a wasmCloud host via an HTTP server. Inside the host, Wasm components use capability providers for storage and machine learning. The ML provider delegates inference to Ollama, while persistent storage is handled by kvnats.
The three states of data: at rest, in transit, and in use. Each state represents a potential point of vulnerability where data can be exposed or compromised if not properly protected.
Secure multi-party computation using a TEE. Sensitive data and proprietary models are loaded into an enclave within an untrusted server. The computation runs securely inside the TEE, keeping both inputs confidential from the hosting environment.
Request flow with edge compute. Incoming requests first hit the edge node, where user-defined Wasm code can perform logic before routing to the centralized cloud backend.

Summary

  • Wasm in confidential computing enables secure, multi-party execution using Trusted Execution Environments (TEEs)—hardware-enforced secure enclaves that protect data even while it's being processed. Wasm's minimal runtime and language-agnostic nature make it ideal for these constrained environments, keeping the Trusted Computing Base small while enabling multiple tenants to run securely side-by-side.
  • AI/ML use cases for Wasm are expanding beyond wasi:nn. The wasi-gfx proposal brings GPU compute capabilities for training and fine-tuning models, while the Model Context Protocol (MCP)—a standard for how AI agents interact with tools and resources—pairs naturally with Wasm's sandboxed execution to create secure environments for autonomous agents.
  • Wasm fits naturally into edge compute environments, where its compact size and sandboxed security match the constraints of CDN-distributed execution across hundreds of global locations. Edge platforms like Fastly Compute compile your code to Wasm for use cases including A/B testing, rate limiting, geo-personalization, and auth filtering—all running milliseconds away from users without managing full servers at each location.
  • WASI 0.3 introduces native async support via built-in future<T> and stream<T> types, eliminating the need for complex state machines and resource juggling. This simplifies interface design, enables cross-language async interoperability, and sets the foundation for WASI 1.0's stability guarantees expected around 2026.

FAQ

What are the three states of data, and why is “data in use” hardest to protect?Data can be exposed at rest, in transit, and in use. Encryption handles data at rest and in transit well (e.g., encrypted disks, TLS). Data in use sits in memory during processing, where traditional encryption doesn’t help—making it the hardest to secure without specialized hardware.
What is a Trusted Execution Environment (TEE), and which CPUs support it?A TEE (enclave) is a hardware-backed isolated region that encrypts memory and shields code/data from the host OS and other processes. Common implementations include Intel SGX, AMD SEV, ARM TrustZone/CCA, and RISC‑V Keystone—widely available in modern clouds.
Why is Wasm a good fit for confidential computing?Wasm runs in small, purpose-built runtimes, minimizing the Trusted Computing Base (TCB) compared to shipping a full OS into an enclave. It’s language-agnostic (compile Rust, Go, etc. to Wasm) and enables safe multi-tenancy via sandboxing and capability scoping.
How does secure multi‑party computation work with TEEs, and what’s an example?Multiple parties load sensitive inputs (e.g., proprietary models and private datasets) into an enclave, run the computation there, and only authorized consumers receive outputs. Cocos AI (https://cocos.ai/) demonstrates this pattern by orchestrating data providers, computation, and result access inside TEEs.
How can Wasm help secure AI agents built with the Model Context Protocol (MCP)?Implement MCP servers as Wasm components with WIT-defined capabilities to apply “only what you need” access. The Wasm sandbox limits tool/resource exposure, reducing risks like prompt injection. Example: wassette (https://github.com/microsoft/wassette).
What is wasi-gfx, and when would I use it instead of wasi:nn?wasi-gfx unifies GPU/graphics interfaces (e.g., wasi:webgpu) to bring secure, portable GPU compute and rendering to Wasm. Use it for low-level GPU access, backends not covered by wasi:nn, or workloads like training/fine‑tuning. Try the playground: https://wasi-gfx.github.io/playground/.
Why run code at the edge with Wasm, and what are common use cases and limits?Edge runtimes execute logic near users for low latency and global reach. Common patterns include A/B testing, rate limiting, geo‑personalization, and auth filtering. Constraints remain (short execute times, limited memory, restricted data access). Platforms like Fastly Compute run Wasm (e.g., via Wasmtime) across hundreds of locations.
What’s new in WASI 0.3 for async, and how does it simplify interfaces?WASI 0.3 adds native future and stream types and host-managed “waitables” for in‑progress ops. Async becomes portable across languages without custom glue code, letting interfaces like wasi:http shrink from many resources to a few types and a single handler.
What’s on the path from WASI 0.3 to 1.0?Planned 0.3.x updates include cancellation (e.g., AbortSignal/CancellationToken integration), stream optimizations (splicing, caller-provided buffers), and threads (cooperative first, then preemptive via shared‑everything threads). WASI 1.0 could arrive as early as 2026 with long‑term stability.
How can I extend SmartCMS or keep up with the Wasm ecosystem?Extend SmartCMS by adding capability providers (e.g., logging, swap key‑value store) or deeper Kubernetes integrations (Prometheus, Grafana, Jaeger, ArgoCD, Gatekeeper). Scaffold providers with “wash new provider <name>”. Stay informed via the Bytecode Alliance blog (https://bytecodealliance.org/articles/), GitHub org, Zulip chat, and conferences like WasmCon and Wasm I/O.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Server-Side WebAssembly ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Server-Side WebAssembly ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Server-Side WebAssembly ebook for free