# Zero Cold Starts: Serverless AI Agents on Akamai Functions — Thorsten Hans

Thorsten Hans, Akamai

[Talk page](https://ai.engineer/talks/Zf_e45GiNCE-zero-cold-starts-serverless-ai-agents-on) · [Video](https://www.youtube.com/watch?v=Zf_e45GiNCE)

## Zero Cold Starts: Serverless AI Agents on Akamai Functions

Thorsten Hans builds a WebAssembly MCP server, deploys a persistent decision log across service regions, and runs a tool-using agent. The walkthrough explains component composition, deployment health checks and JavaScript memory snapshots—and separates fast startup from the time spent calling a model.

### A global audience exposes two different delays

[0:12](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=12s)

An MCP server or AI agent still has the basic obligations of an application: receive a request, do useful work and respond quickly. Thorsten Hans, a senior developer advocate at Akamai, opens with two infrastructure problems that can slow that exchange. A deployment in one region leaves some users farther from the application. Separately, scaling containers or virtual machines can require starting new instances before they can handle requests.

![Selected presentation frame from Zero Cold Starts: Serverless AI Agents on Akamai Functions — Thorsten Hans at 77 seconds](https://ai.engineer/api/talk-essay-media/45df20a44380405f5050e606b5afe7b2ff82e5f1d52fdfa4347f9681373569d9)

The slide names latency as a challenge for globally distributed MCPs and agents.

Keeping spare instances running can absorb sudden demand, but it makes idle capacity part of the cloud bill. Hans also points to its environmental cost. Higher-level platforms can remove some infrastructure work, yet introduce their own SDKs, packaging formats and production conventions. Once an application depends on those choices, moving it to another provider becomes harder.

Server-side WebAssembly is the proposed alternative deployment unit: a small, portable binary that is cheap to distribute and quick to start. This addresses startup and packaging; distributing those binaries across regions addresses where requests run. The talk develops both parts through Spin and Akamai Functions.

### Spin builds the application; Akamai Functions runs it

[3:10](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=190s)

Spin is the vendor-agnostic CNCF project used throughout the demos. Its three pieces serve different parts of development:

- **CLI:** Build and run applications during the local development loop.
- **Runtime:** Execute WebAssembly using Wasmtime, including locally and in constrained environments.
- **Language SDKs:** Give application code convenient ways to call HTTP services, interact with databases and perform other common tasks.

Language-specific SDKs sit above a shared target: WebAssembly with the WebAssembly System Interface, or WASI.

![Selected presentation frame from Zero Cold Starts: Serverless AI Agents on Akamai Functions — Thorsten Hans at 232 seconds](https://ai.engineer/api/talk-essay-media/713fe295ffd242b3ee301005969fef6e08e22e584e42a0aa24377e481da2cea4)

Spin’s slide presents its CLI, runtime and language SDKs as three parts of the developer toolkit.

Akamai Functions supplies the managed, globally distributed runtime. The title’s “zero cold starts” needs a precise reading: Hans says an application is actually cold-started for every request, with average startup below half a millisecond. That is a platform claim about startup overhead, rather than a claim that the entire request—including a model call—finishes in that time.

Two supporting mechanisms make the runtime useful beyond stateless computation. WebAssembly’s sandbox requires developers to grant access to external resources explicitly. A built-in, multi-tenant key-value store supplies persistence and is associated with applications that use it, without application developers arranging separate credentials. The decision-log demo later puts that storage path to work.

### A tools component becomes an MCP server through composition

[6:11](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=371s)

Implementing MCP directly would mean handling its API over HTTP as well as the useful operations exposed to clients. WasmCP separates those concerns. Its CLI scaffolds tools, resources and prompts, then combines application components with ready-made server components. Hans also describes OAuth2 and OIDC support; the local demonstration deliberately omits authentication, so its successful tool call demonstrates composition rather than an authenticated deployment.

The first project is a TypeScript tools template called Hello. WasmCP also offers Rust and Python templates. After installing dependencies, the application work has three concrete parts:

- **Describe inputs:** Define the schema of arguments a tool accepts.
- **Describe tools:** List tools with precise descriptions so people and language models can choose and use them.
- **Dispatch calls:** Implement `callTool`, which examines the request and sends it to the appropriate handler.

The example handler validates incoming arguments, combines the input with a prefix and returns a result.

The build has an important intermediate state. Running `make` produces a WebAssembly tools component, which is not yet a complete MCP server. `wasmcp compose` brings in the other required components and produces the server artifact. Spin then runs `server.wasm` locally on port 3000. In MCP Inspector, Hans connects, lists the example tool and submits `foo` as its input. The small test checks that the client can discover and invoke the tool through the composed server.

### Deploy a persistent decision log only after every region is ready

[10:39](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=639s)

The next application gives the workflow something worth persisting: a Rust decision-log MCP server. Its structure matches the TypeScript example. `callTool` dispatches to tools for creating, reading, updating and deleting decisions, and the tool implementations use a store. Locally, Spin provides that key-value store through SQLite. On Akamai Functions, the application uses the platform’s globally distributed key-value store. The demo establishes this change of backing store, but does not explain its consistency or concurrent-update semantics.

The application manifest combines compilation and composition into the Spin build workflow. That keeps the developer from manually repeating the separate steps used for Hello. Hans deploys with `spin aka deploy`, names the application ADR MCP and authorizes registry access. The command packages the WebAssembly artifact and application manifest into OCI layers and uploads them.

What has to happen before a globally distributed server gets a public address? The deployment flow below makes the readiness condition visible. Each service region must receive the workload, confirm it can run it, instantiate it and pass an internal health check. Only after every region returns HTTP 200 does the platform issue a public subdomain. Hans reports roughly 60 seconds for this deployment.

![Selected presentation frame from Zero Cold Starts: Serverless AI Agents on Akamai Functions — Thorsten Hans at 852 seconds](https://ai.engineer/api/talk-essay-media/f9699783fe4ab3405267632efc423ef8171c8ecbe074c3111b49a47f7d4f484c)

The terminal displays the generated endpoint after the deployment completes.

The public endpoint is also a deployment decision. Hans notes that another service, such as Property Manager, can enforce controls before forwarding traffic to the MCP server. Component-level authentication and controls in front of an endpoint are therefore separate choices developers still need to make, even when packaging and regional rollout are managed.

Regional readiness gates the public endpoint
The artifact is distributed first. The public subdomain follows successful health checks across all service regions.
- Package the application — Create OCI layers from the WebAssembly file and application manifest.
- Distribute to all service regions — Each region confirms receipt and its ability to run the workload.
- Instantiate and check — Run an internal health check in every region.
- Issue the public subdomain — Publish the endpoint after all regional checks return HTTP 200.
- Package the application → Distribute to all service regions (Upload and distribute)
- Distribute to all service regions → Instantiate and check (Confirm the workload can run)
- Instantiate and check → Issue the public subdomain (Every region returns HTTP 200)

### An IDE request becomes a stored decision

[14:29](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=869s)

The decision log now changes from deployed infrastructure into a usable project tool. Hans adds the remote endpoint to Zed, which discovers five tools. In the project’s chat, he asks it to record a decision about using OAuth2 with Auth0. The client identifies the insert-decision operation and presents the raw tool input for approval. Once approved, the call reaches Akamai Functions and the decision is stored.

![Selected presentation frame from Zero Cold Starts: Serverless AI Agents on Akamai Functions — Thorsten Hans at 930 seconds](https://ai.engineer/api/talk-essay-media/a5327ad48eeba962131695b266ade8f02fc31c887e40ba7601ba7f7a63d66c31)

Zed displays the decision-log exchange, including the request to track an OAuth2 decision.

A follow-up request—“Give me all the decisions, please”—selects the list-decisions tool. The observable change is that a decision introduced through conversation can now be retrieved through another tool call. Tool descriptions help the client select an operation; the approval step lets the user inspect the proposed write; the server’s storage gives the next request something to read. Akamai Functions routes calls to the closest service region, while the MCP interface lets clients use the server without depending on the language in which its tools were written.

### Run the agent at the edge, and prepare JavaScript before requests arrive

[16:01](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=961s)

The agent demo keeps the same deployment workflow but changes the application code. A TypeScript Spin app uses the Vercel AI SDK and calls an Ollama instance on a Linode server with a dedicated GPU. Its tools can flip a coin or roll a die with a requested number of sides. The HTTP handler loads configuration, selects the model endpoint, gives the agent an identity and instructions, registers its tools, limits the number of steps and returns the generated response.

This topology matters: deploying the agent globally does not deploy the model globally. The request handler and tool orchestration run on Akamai Functions; model inference remains on the GPU-backed Linode instance. A fast-starting agent still has to reach that model and wait for its work.

While the game agent uploads, Hans explains how interpreted JavaScript becomes a WebAssembly artifact. At build time, the toolchain loads the interpreter and application code, then evaluates the global scope. With the runtime initialized and dependencies loaded, it takes a memory snapshot and writes that state into the WebAssembly artifact. Initialization work has moved earlier in the application’s lifecycle.

Which work moves out of request startup, and what must travel with the application? The diagram follows the snapshot’s contents into the deployable artifact. The benefit is already-initialized runtime and dependency state; the cost is carrying the JavaScript runtime with the user code. Hans gives its size as roughly ten megabytes. This mechanism explains the startup benefit, but does not establish his broader claim that every JavaScript WebAssembly application will also execute faster than native JavaScript.

JavaScript initialization becomes part of the artifact
The build evaluates global scope and captures initialized memory. The deployed artifact carries the runtime as well as the application.
- Load interpreter and code — Prepare the JavaScript runtime and custom application code during compilation.
- Evaluate global scope — Initialize the runtime and load dependencies before deployment.
- Capture memory — Take a snapshot of the initialized state.
- Write the WebAssembly artifact — Store the snapshot with the application; include the roughly ten-megabyte JavaScript runtime.
- Load interpreter and code → Evaluate global scope (Evaluate the loaded application)
- Evaluate global scope → Capture memory (Capture initialized runtime and dependencies)
- Capture memory → Write the WebAssembly artifact (Write memory state to Wasm)

### A fast startup still leaves a model round trip

[19:02](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=1142s)

The deployed game agent receives “Toss a coin.” Response headers identify Santa Clara as the entry point into Akamai’s network and LAX as the closest service region. Hans initially reads a value of about 34 milliseconds from `x-envoy-upstream-service-time` as the complete interaction, then notices an internal server error. That failed request cannot stand as the successful agent timing.

On retry, the reported time is 866 milliseconds and the coin result is tails. Further calls eventually produce heads, with Hans reporting roughly 820 milliseconds for a full loop through the model. These are demonstration timings rather than a latency distribution or an independently established end-to-end measurement. They still expose the useful distinction: removing substantial startup overhead leaves model inference and communication as real parts of an agent request.

![Selected presentation frame from Zero Cold Starts: Serverless AI Agents on Akamai Functions — Thorsten Hans at 1205 seconds](https://ai.engineer/api/talk-essay-media/8b9ff67735d2e5429f69960dfef1fbdaeeea7bae2e2df80240a9f9790028e86c)

The terminal displays the coin-toss response during the deployed agent demo.

The ending returns to a common developer loop: implement in a language targeting WebAssembly, test locally with Spin, deploy with `spin aka deploy`, then point clients at the endpoint. Rust, TypeScript, Python and Go are the examples named. MCP servers add component composition; agents bring their SDK, model configuration and tools. Both remain applications built and deployed through the same framework.

Portability is the closing reason to keep the application in WebAssembly and WASI rather than tie its packaging to one cloud. Hans presents Akamai Functions as one runtime for Spin applications, with global distribution as its particular offering. Moving the executable is only part of moving the application: the decision log also uses platform-provided persistence, and the game agent uses an external model endpoint.

The operational promise is less infrastructure to assemble and maintain. It does not end at the deploy command: Hans points to commands for metrics, logs and upgrades, and closes by directing developers to the Akamai Developer Hub for further experiments and experiences. The workflow gives application developers a shorter path from local tools to a remote service while retaining ways to inspect and update what they have shipped.

## Key takeaways

- “Zero cold starts” describes negligible claimed startup overhead: Akamai Functions still starts the application per request, with Hans reporting an average below half a millisecond.
- WasmCP separates tool implementation from server assembly. A compiled tools component becomes an MCP server through composition with the required supporting components.
- The decision-log example connects intent, approval, a remote tool call and persistence: an IDE request inserts a decision that a later list operation can retrieve.
- JavaScript memory snapshots move runtime and dependency initialization into the build. The artifact must also carry the JavaScript runtime, given as roughly ten megabytes.
- A globally deployed agent can still call a model in one location. The successful coin-toss demo reports roughly 820–866 milliseconds for the model loop, separate from application startup.

## Slides

### Edge-Native AI: Building Ultra-Fast Agents and MCP Servers with Spin

Thorsten Hans introduces building agents and MCP servers with Spin and running them globally distributed.

[0:17](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=17s) [Title slide for a talk on edge-native AI, agents, MCP servers, and Spin.](https://assets.ai.engineer/sites/aiecode2025/sha256/7550cb360f98f911285e2aa399a8f9cf5b4fd9e5c7fdc6808f7ec7970e2224bc.webp)

Edge-Native AI: Building Ultra-Fast Agents and MCP Servers with Spin

Akamai

2026

### Thorsten Hans

Thorsten Hans is a senior developer advocate at Akamai. He introduces a talk on building globally distributed agents and MCPs with Spin.

[0:23](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=23s) [Speaker introduction with a portrait, role, and professional contact details.](https://assets.ai.engineer/sites/aiecode2025/sha256/80241a0c7937d4a649b4337ec22e1cec4e1145ba9a2d59d2f3fbaaade25f3a73.webp)

Thorsten Hans

Sr. Developer Advocate
[redacted]

github.com/ThorstenHans
linkedin.com/in/ThorstenHans

Akamai

### MCPs and AI Agents: Infrastructure Frictions

MCPs and AI agents need fast responses, but region-bound infrastructure can struggle to serve a global audience.

[0:30](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=30s) [Slide states that MCPs and AI agents need fast responses and that region-bound architectures create infrastructure frictions.](https://assets.ai.engineer/sites/aiecode2025/sha256/cbd5d111bd91176b097a58bc4cf4ac806564ca6501d9b30bc7ff3e181ac4b87e.webp)

MCPs & AI Agents Infrastructure Frictions

MCPs and AI agents demand fast response times.

Traditional, region-bound architectures fall short, creating critical infrastructure frictions:

Akamai

### Latency

The slide argues that MCPs, agents and their origin need the same cloud region to prevent a dramatic latency increase; centralized deployments are fast for only part of a global audience.

[1:03](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=63s) [Slide describes latency concerns for centralized deployments serving a global audience.](https://assets.ai.engineer/sites/aiecode2025/sha256/23956a4c1b26c9345f30d39fda7498b0a4ba49232c44404c8c9c97446f8c23a1.webp)

Latency

MCPs, Agents and their origin must be in the same cloud-region to prevent a dramatic latency increase. Centralized deployments are fast - but only for a subset of a global audience.

Akamai

### Cold Starts

Containers and VMs can take seconds to minutes to start, delaying rapid scaling when demand arrives unexpectedly.

[1:24](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=84s) [Slide states that containers and virtual machines can take seconds to minutes to start.](https://assets.ai.engineer/sites/aiecode2025/sha256/b10eb66e2377888a96cd72cce5907d12c5984ee0ab2c6237e0787ef0a363744c.webp)

Cold Starts

Containers and VMs take a long time to bootstrap. Ranging all the way from seconds up to minutes.

Akamai

### Overprovisioning

Keeping containers and servers ready can avoid cold-start delays, but unused capacity raises cloud spending and environmental costs.

[1:47](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=107s) [Slide describes the financial and energy costs of keeping agent infrastructure pre-warmed.](https://assets.ai.engineer/sites/aiecode2025/sha256/568d0ee826b1276006b7386dea459b379b429ffa3dbb63a19aa69c20c6a4f742.webp)

Overprovisioning

Keeping MCP or Agent infrastructure pre-warmed results in significant financial spending and excessive energy waste, making it environmentally unsustainable

Akamai

### Vendor Lock-in

Proprietary SDKs and deployment conventions can tie agents to a provider, making migration to another infrastructure complex and costly.

[2:05](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=125s) [Proprietary runtimes can make migration between providers complex and costly.](https://assets.ai.engineer/sites/aiecode2025/sha256/2a5c7915db95355a6d93efc4fd8547ce6c66ee7de4633c31c8a0af42a3e1ef17.webp)

Vendor Lock-in

Proprietary runtimes tie you to a single provider, making workload migration complex and costly.

Akamai

### The Edge-Native AI Stack

Spin builds WebAssembly serverless applications; Akamai Functions runs those workloads on a globally distributed platform. Hans presents the combination as his edge-native AI stack.

[2:53](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=173s) [Spin is presented as the developer tool and Akamai Functions as the distributed runtime for WebAssembly applications.](https://assets.ai.engineer/sites/aiecode2025/sha256/576542a6499424711e564f6644740a6ede0a72b30f6a7c1432eed0104d0adb52.webp)

The Edge-Native AI Stack

CNCF Spin and Akamai Functions to provide best in class DX and fastest possible time to market for building Edge-Native AI applications

Spin
The developer tool for building WASM-based serverless applications with the Component Model.

Akamai Functions
The fully-managed and globally distributed serverless compute platform for running WebAssembly workloads

Akamai

### CNCF Spin

Spin combines a CLI for the developer inner loop, a local WASI runtime, and language-specific SDKs. Developers can use languages that compile to WebAssembly with WASI.

[3:25](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=205s) [Spin provides a CLI, a WASI runtime and language-specific SDKs for server-side WebAssembly applications.](https://assets.ai.engineer/sites/aiecode2025/sha256/c75993233e071d0eb46f38c5fbca06b4043c034e0135c36d40228eb82709ead5.webp)

CNCF Spin

The developer tool for building server-side Wasm apps

• CLI: Address all inner-loop concerns
• Runtime: WASI conform runtime, allowing to run apps locally
• SDKs: Language specific SDKs to boost developer productivity

Code your apps in any language that could be compiled to WebAssembly (WASI)

### Akamai Functions

Akamai Functions cold-starts each request in 0.4ms on average, distributes deployments globally, and provides a managed key-value store. WebAssembly sandboxes workloads and controls access to external resources.

[4:51](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=291s) [Akamai Functions is described as a globally distributed, managed serverless platform with a WebAssembly sandbox and key-value store.](https://assets.ai.engineer/sites/aiecode2025/sha256/ad5808891f9c4e1b1f6f06ce8d4fe69a4788e03896b74c360628008a16099b04.webp)

Akamai Functions

Truly Serverless Edge Computing Platform

0
Cold Start
(0.4ms average)

- Globally-Distributed: Deploy once, available across the globe
- Fully-Managed: No knobs to turn, no cloud-infrastructure to manage
- Security: Zero-trust & shared nothing execution within the WebAssembly sandbox.
- Built-In Key-Value Store: Also globally distributed and fully managed

### Edge-Native MCPs

Hans introduces edge-native MCP servers and points to WasmCP as an alternative to hand-rolling one over HTTP.

[6:20](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=380s) [Edge-Native MCPs section title beside a photograph of a person using a phone.](https://assets.ai.engineer/sites/aiecode2025/sha256/5fbc747e027cd1ff59a0c3107642582720df58586e4c9db0766597e9a5e13d6e.webp)

Edge-Native MCPs

Akamai

### The Edge-Native AI Stack with wasmcp

wasmcp composes MCP server components, Spin provides the development tooling, and Akamai Functions runs WebAssembly workloads on a globally distributed platform.

[6:24](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=384s) [The stack combines wasmcp for composing MCP servers, Spin for development, and Akamai Functions for running WebAssembly workloads.](https://assets.ai.engineer/sites/aiecode2025/sha256/e3c087e3088c9ddd30fa6469be1a55b2e6fd5fb62bbcae584aeb51e0352fc9ac.webp)

The Edge-Native AI Stack

Combining wasmcp, Spin and Akamai Functions to provide best in class DX and fastest possible time to market

wasmcp
A polyglot framework for composing MCP servers into standalone WebAssembly components

Spin
The developer tool for building WASM-based serverless applications with the Component Model.

Akamai Functions
The fully-managed and globally distributed serverless compute platform for running WebAssembly workloads

Akamai

### WasmCP repository

Hans shows the wasmcp repository and introduces its CLI, which he has installed to compose an MCP server from ready-to-use components.

[7:32](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=452s) [GitHub repository page describing WasmCP as a way to build MCP servers with WebAssembly components.](https://assets.ai.engineer/sites/aiecode2025/sha256/4b4908a3b7924f0b6045d91da847bd77591d233daf8f2eed65e4bde9abb35927.webp)

wasmcp / wasmcp

Code
Issues 4
Pull requests 2
Discussions
Actions
Projects
Security and quality
Insights

wasmcp Public
Watch 0
Fork 6
Starred 87

main
Go to file
Code

DevOpsDali  Update CLI and versions to new 202...  9fbce02 · 4 months ago
.cargo  feat: Add auth and kv-store crates ...  8 months ago
.github  feat: Filter Middleware on URL path...  8 months ago
cli  Update CLI and versions to new 20...  4 months ago
crates  mcp spec 2025 11 25 crate and exa...  4 months ago
docs  feat: Replace http-notifications wit...  9 months ago

About
Build MCP servers with WebAssembly components
rust  mcp  webassembly  wasm  modelcontextprotocol
Readme
Apache-2.0 license
Code of conduct
Contributing

Interface text:
Chrome  File  Edit  View  History  Bookmarks  Profiles  Tab  Window  Help
Wed 2:02
github.com/wasmcp/wasmcp
Ask Gemini
Work

### Creating a TypeScript project

Hans starts a TypeScript project called hello with WasmCP. The CLI fetches WIT dependencies for the default tools template.

[7:37](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=457s) [Terminal shows a WasmCP project creation command fetching and downloading dependencies.](https://assets.ai.engineer/sites/aiecode2025/sha256/3195d1be1e058ff4717a074ba8b478d5aa2175a0d3757600cc67234ac1f3797f.webp)

aiewf-2026 ❯ wasmcp new --language typescript hello
📦 Fetching WIT dependencies...
📦 Downloading WIT dependencies...

Interface text:
Ghostty  File  Edit  View  Window  Help
Wed 2:02
main  1  zsh  1
thans

### Project creation complete

WasmCP creates the TypeScript tools component, then prints commands to build it and compose an MCP server. The demo moves into the new hello directory.

[7:54](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=474s) [Terminal reports that the TypeScript component was created and lists commands to build and compose it.](https://assets.ai.engineer/sites/aiecode2025/sha256/e5ce37b2c944b89ddb081b08fe2d982c0f2a62a49fc11d664b1c16c3584e51cf.webp)

aiewf-2026 ❯ wasmcp new --language typescript hello
📦 Fetching WIT dependencies...
📦 Downloading WIT dependencies...
   WIT dependencies resolved
Created typescript tools component in hello

Next steps:
  cd hello
  make          # Build the component
  wasmcp compose server dist/hello.wasm -o server.wasm

aiewf-2026 ❯ cd hello
hello ❯                                      via 26.4.0

Interface text:
Ghostty  File  Edit  View  Window  Help
Wed 2:02
main  1 zsh 1
thans

### Preparing the project

Hans opens the new hello project in an editor while npm install runs in a second terminal.

[8:04](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=484s) [Split terminal shows a dependency installation command alongside an editor launch command.](https://assets.ai.engineer/sites/aiecode2025/sha256/9c8af5028ca4c73d0d55586f574f859d88f6ae6adcac16155d4b6bad76742b48.webp)

Fetching WIT dependencies...
Downloading WIT dependencies...
WIT dependencies resolved
Created typescript tools component in hello

Next steps:
  cd hello
  make          # Build the component
  wasmcp compose server dist/hello.wasm -o server.wasm

aiewf-2026 ❯ cd hello
hello ❯ nvim .                         via 26.4.0

Second terminal:
~ ❯ cd hello
hello ❯ npm install                    via 26.4.0

Interface text:
Ghostty  File  Edit  View  Window  Help
main  1  zsh  1
thans
Wed 2:02

## Full transcript

[0:12](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=12s) Welcome, everybody. Thanks for joining my talk. In the upcoming twenty minutes, I want to give you an introduction on how you can build ultra-fast agents and MCPs with Spin and run them globally distributed. So my name is Thorsten. I work as a senior developer advocate with Akamai. And, um, I guess all of you have already built either MCPs or agents, and they are no different than any other kind of application, so they obviously demand super fast response times so that

[0:42](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=42s) we can deliver the best possible user experience. However, traditional region-bound architectures or infrastructures fall short when you wanna address a global audience. And they, they come with some frictions which lead to the inception of edge-native architectures. So obviously, latency is one of the biggest concerns. Depending on where you deploy your MCPs or your agents,

[1:12](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=72s) it might be fast for a subset of your global audience, but others might experience a way lower latency and resulting in a way worse user experience. Um, depending on your distributable unit, right, even-- So if you even, uh, either choose containers or VMs, you may experience a cold start delay that might range from several seconds up to multiple minutes, especially when you have to scale

[1:42](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=102s) dramatically fast to meet unexpected user demand. However, we can overcome that, obviously, uh, by overprovisioning the infrastructure. However, keeping around many, many containers or servers and actually not utilizing them results in obviously higher cloud spendings and is not sustainable from an environmental footprint. So there are higher level solutions, uh, that we can use to run

[2:12](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=132s) MCPs or agents, but they usually or often come with proprietary SDKs or, uh, deployable units or have their own way on how you should treat them in order to make them work in a production-grade environment. Once you figured out about those constraints, moving away or migrating your workloads, your agents to another hyperscaler, to another kinda infrastructure, it's often rather complex and

[2:41](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=161s) extremely costly. So... But there's a solution to that, and that solution involves a new way of how we as engineers could build back-end or server-side applications. And this is done by adopting WebAssembly on the server side. You can think of WebAssembly as, um, as containers relate to virtual machines. So they are binaries, super tiny in size, easy to distribute, super fast to run, and

[3:10](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=190s) portable. What I refer to as the edge-native AI stack is a combination of a CNCF project called Spin and Akamai Functions, one runtime where you can run those WebAssembly applications. So let's dive into Spin for a minute. Uh, Spin, as I said, is a CNCF project that is vendor agnostic, and it allows you to build WebAssembly applications that are meant to be executed on the server or in the cloud.

[3:41](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=221s) Spin itself consists of three major pillars. So it is a CLI that we as developers use to address all our day-to-day concerns, so everything, you know, in the realm of the inner loop. It is a runtime, so it's based on Wasmtime, um, that allows us to run these kinds of applications either locally or on microcontrollers or constrained environments. Last but not least, Spin gives us language-specific SDKs to boost the developer productivity

[4:11](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=251s) when it comes to day-to-day jobs like, for example, interacting with HTTP services, integra-- interacting with databases or different kind of things. Although we have language-specific SDKs, Spin itself is language agnostic, and you can choose from all the languages that are able to be compiled down to WebAssembly, including the WebAssembly System Interface, or short, WASI. And you can learn more about Spin on spinframework.dev, so

[4:41](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=281s) scan this QR code, and you will end up on the Spin documentation. So Spin is the developer tool that we use for building these kinds of applications. Akamai Functions is the first truly serverless computing platform that is globally distributed and has zero cold start at all. So every application that you deploy to Akamai Functions is cold started per request that hits your endpoint, and on average, we can

[5:11](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=311s) cold start in less than half a millisecond. It's fully managed, and it's, again, developer centric. Your developers deploy the workload, no knobs to turn, no Terraform to write, just a simple one-liner, and your app is globally distributed at no extra cost. Security is, um, is observed by WebAssembly's sandbox, so there's no way a workload could interact with external resources without us as developers explicitly

[5:41](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=341s) granting those permissions to our workloads. And to be a full-fledged serverless computing platform at the edge, we need some kind of persistence layer, so Akamai Functions comes with a built-in key value store that is, again, multi-tenant. You don't have to roll credentials. It is automatically associated to your app if your intent is to use it. Again, there is a QR code, scan that, and you can find out more about Akamai functions, sign up for

[6:11](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=371s) a trial or a free, a free account there and, you know, explore it. So these are the technical underpinnings that I wanna use in order to build first MCP servers. So instead of hand-rolling a new MCP server, I mean we can implement the HTTP protocol or the, uh, the specified API on top of HTTP to build an MCP. There is a smarter way of doing that, and the smarter way is WasmCP.

[6:40](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=400s) WasmCP, again, is a CLI that integrates seamlessly with Spin. So what is-- what this allows us to do is basically to focus just on the business logic. And in, in the, in the realm of an MCP, business logic basically means we implement our tools, we implement our resources, our prompts, and we are good to go. Everything else, all those non-functional requirements that we have to tackle, right? Like for example, authenticating users using OAuth2 and

[7:10](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=430s) OIDC, that's done by WasmCP, and we can take ready-to-use components off the shelf and compose a final MCP server component together and run that on Spin or on Akamai functions. And that's what we are going to do right now. So I have installed WasmCP on my machine. It's github.com/wasmcp/wasmcp, and it gives you a nice little

[7:40](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=460s) CLI. So we can do WasmCP New. We can choose a language, Rust, TypeScript, uh, Python, and we can choose from templates. The default template is me only caring about tools for now, and let's call this new MCP server Hello. We get instructions, "Hey, move into Hello." Uh, Hello. Then let's open up a new terminal on this side, CD into Hello over here as well, and let's run NPM

[8:10](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=490s) install because that takes a few seconds, and let's open this one in the editor, and let's do this full screen. So what do we get over here? Uh, we get a boilerplate that's, uh, ready to use, and those squirrel lines will go away once MP- NPM install is done. So all we have to do have-- is we have to express the scheme on which inputs we expect. We have, obviously, to provide the list of our

[8:40](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=520s) tools, so again, we have to be good citizen over here and have to provide precise descriptions so that humans and LLMs know how to handle these kind of tools. So we list them in a simple array, and then there's one ingestion function that's called callTool, and depending on, uh, the, the payload that we receive, we have to decide which tool we have to execute. If we jump into handleExampleTool over here, we can see, uh, all

[9:09](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=549s) incoming arguments are validated, and if everything's fine, then we basically, uh, concac- concatenate the i- received input with a prefix and return that back to the user. Nothing fancy. So let's close the editor over here and follow the instructions. Next on list is Make. Make goes on and takes the JavaScript code, compiles that down to WebAssembly. So we end up with a tools WebAssembly component,

[9:39](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=579s) which is not yet a full-fledged, uh, MCP server. Next in line would be WasmCP compose. Let's compose a full-fledged MCP by taking our tools and saying, "Hey, please give me an MCP. For the sake of this demo, I don't care about authentication." Okay. It pulls all the necessary, uh, other components and composes together an MCP server and gives me instructions on how to run it. I can do a spin up-f

[10:09](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=609s) server.wasm, and we should see that running on localhost three thousand. Okay, let's bring back the other terminal, and let's run NP- npx, the, uh, MCP inspector over here. That should fire up in the browser. There we go. Uh, it's already pointing to localhost three thousand right here, so let's connect. Let's list tools. There's our example tool. We provide foo as an input parameter. We run the tool, and we should get back foo.

[10:39](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=639s) Great. Nothing fancy. Cool. Works. But that's the local experience. So how can we take that to become a glo... or how can we turn that into a globally distributed MCP server? Well, instead of globally distributing, uh, the Hello World MCP server, I have a decision log MCP server, and let me open up this one first. So there is-- This one is implemented in Rust for the sake of implementing it in Rust. Um, so let's

[11:09](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=669s) go into lib.rs over here. There is an equivalent class or structure in Rust. As you can see, we're looking at the callTool function where we branch out and either use one of the crud APIs or tools that is provided by my MCP server. If we dive into the actual implementation, um, let me... No, this is wrong. I want this, and then I wanna do that. Uh, decision.rs. If we go to

[11:39](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=699s) the bottom of the file, you can see this is slightly different syntax, but the same meaning, right? I have to define my tools, and if we go to line fifteen or so, yes, list decisions, you can see over here that I use a store. So on my local machine, Spin recognizes, "Hey, Thorsten wants to use the key value store," so it automatically creates a key value store using SQLite on my machine for development time

[12:09](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=729s) purposes. And on Akamai functions, it's leveraging the globally distributed, um, key value store without me having to configure anything. From here, it's actually the same story, right? I have to use that make file and compose the server. However, I think it's smarter to update the application manifest and concatenate those tasks so that I can remain in the Spin developer experience and basically do a Spin

[12:39](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=759s) build to compile, compose and compile my MCP server. However, I can also combine this one with spin aka deploy. So this right now composes the server, asks me, "Hey, how do you wanna call that MCP server on Akamai functions?" I call it ADR MCP. I allow, um, my terminal to interact with the service registry.

[13:09](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=789s) Now it's taken my Wasm file and my application, uh, manifest, tr- generating OCI layers from those files, uploading them to Akamai functions. On the server side or on the service side, we receive those two files, and we distribute them across the globe through all the service regions. Every region has to confirm, A, that it received the workload, that it's capable of running the workload. Then we

[13:38](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=818s) instantiate the workload once and do a internal health check. And once that came back for all the service regions with an HTTP two hundred, then we roll a d- generic subdomain on your behalf so that you, that your MCP server will be on the public internet. Obviously, you can shield that with other products and services, uh, like the property manager, to shield it behind whatever you wanna enforce before, uh,

[14:09](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=849s) forwarding users to the MCP server. So we get that URL, so we are globally distributed in roughly sixty seconds. Let's move over to an, uh, to a client. I use Zed over here, but that works with any client that basically supports MCP. I add a server.

[14:29](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=869s) I go to remote over here, and let me replace this one with the URL that we received, add the server, and we can see I have five tools already. I can go here and say View Tools, and these are the crud tools that my MCP defined. So I can go back and chat with my IDE in the context of my project so that it could leverage, uh, my MCP server. Track, uh, decision to use OAuth two dot,

[15:01](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=901s) two dot O for Auth0. Okay, so it should now identify my intent and ask permission to run the insert decision tool. We can see the raw input. Looks good. We allow it. It now calls out to Akamai functions, have already, has already tracked my decision, and I can say, "Give me all the decisions, please." Now the intent is to use the list decisions tool, and again, we

[15:31](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=931s) are, uh, yes, it w- might wanna read, uh, details to give me everything that it tracked. Or, and, uh, with that, we have a globally distributed, um, MCP server that's routing all the requests to the closest service region, no matter where your users are. And again, you can write those tools or prompts or resources using TypeScript, Python or Rust templates. Cool. Uh, let's move

[16:01](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=961s) on with agents. Um, so... Oops, nope, this one. So for AI agents, the story is no different. However, instead of using another CLI, uh, we can simply pick any kind of SDK that's out there and that's popular. Um, I, I think the Vercel AI SDK is pretty nice to use. So this allows us basically to create a new Spin app using TypeScript, just bring in the Vercel AI dependencies

[16:32](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=992s) and to build custom agents. Again, let's move back to the terminal to see how that looks like. Uh, so let's move one up, and let's CD into a simple game agent over here. And

[16:47](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=1007s) what's going on over here, obviously I have created a new Spin app using a template so that I can get started pretty quickly. I'm leveraging a large language model deployed to a Linode instance with a dedicated GPU. And all my Spin app does, it defines the tools. So this is a simple game agent for the sake of demonstration purposes that can flip co- uh, f- uh, flip coins, that can roll a dice, where you can specify how many sides that dice should have. And over here in the

[17:17](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=1037s) actual HTTP handler, we load the config, and we define our agent, you know, pointing it to the Ollama instance running on Linode. We give our agent an identity and an instruction on what its intent actually is. We register our tools, and we give it some constraints o- of how many steps it might take. We generate a response and return it back to the callee. Okay, let's, uh, go,

[17:47](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=1067s) let's do a quit all over here, and let's do another spin aka deploy, no confirm build. And it asks for the name. That's the game agent. So while it is uploading, let me explain what happens when we compile a lang- an interpreted language. So during compilation time, we load the interpreter, we load your custom JavaScript, and then we evaluate the global scope. This has one

[18:17](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=1097s) advantage, that not just the runtime is hot, also all the dependencies are loaded. And then we take a memory snapshot, write that to Wasm, store that on disk, meaning that every WebAssembly application written in JavaScript is faster than a native JavaScript application when it comes to cold starts and runtime performance. The only trade-off though is that we have to ship the JavaScript runtime along with our, um, with our user code, but we use an

[18:47](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=1127s) optimized JavaScript runtime called Starling Monkey, which is roughly ten megabytes in size. So we get back an URL. Let me replace this URL over here, and let's say, "Toss a coin."

[19:02](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=1142s) And we see, um, we see a response back, and if we look at these headers, we can see, uh, the point of presence where we enter the Akamai network is Santa Clara, and the closest service region for our AI agent is LAX. Another interesting header is x-envoy-upstream-service-time, and this tells me, and you right now as well, that it took thirty-three, uh, thirty-four milliseconds to receive the request, to run

[19:32](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=1172s) through the business logic, to reach out to the large language model, to generate a response, and to go all the way back to the user. Oh, there's an internal server error. Great. Awesome. Let's try this again. Oh yeah, that was an user error, sorry. So the error was staying thirty centimeters in front of the screen. Um, looking at it now, we are eight hundred sixty-six milliseconds. Um, that is more realistic because we have to go through the LLM to basically see that, uh, our to-- our

[20:02](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=1202s) toss resulted in tails. Let's do that again. Tails, tails, tails, tails. Ah, there's the heads. Nice. So roughly eight hundred twenty milliseconds is what we could achieve with a full loop through the LLM by taking our agent and deploying it to Akamai functions. Okay, so the developer workflow is always the same, no matter if you build any kind of line of business application, if you build an MCP or if you build an agent, you

[20:32](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=1232s) implement your application using any language that you could compile down to WebAssembly, Rust, TypeScript, Python, Go are the most prominent ones these days. You can test it locally with the Spin CLI. You deploy it using a single command called spin aka deploy, and finally, your, you point your clients to your MCP or to your agent. So final or key takeaways from my, from my point are portability. You

[21:02](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=1262s) can take those Spin apps and run them on any WASI-compliant runtime. Akamai Functions is one runtime, and it's the globally distributed runtime. Everything is based on open standards, so Spin as CNCF, WASI, WebAssembly are governed by the Bytecode Alliance. But ultimately, you gain speed, right? You have fast response times. Even the time to market for your developers to build MCPs and to build agent goes down because you don't have to roll the infrastructure. You don't have to

[21:32](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=1292s) implement non-functional requirements. That's all taken care of. And in terms of infrastructure, there's no ops. It's spin aka deploy is all you need. There are other commands in the box so that you can ge- gather metrics, that you can retrieve logs, that you can upgrade, and so on and so forth, but developer experience is our, our highest metric when we started Spin and why we continue in that direction. Um, we have a

[22:02](https://www.youtube.com/watch?v=Zf_e45GiNCE&t=1322s) new website that's called the Akamai Developer Hub, where we share stories and experiments and, and experiences like these. So go check out developers.akamai.com. And if you have any further question, find me at the Akamai booth. And with that, thank you very much.
