← Back
AI Engineer October 10, 2026 22m

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

Read full transcript 18 segments
  1. Greetings to everyone. Thank you for Greetings to everyone. Thank you for joining my joining my joining my talk. In the talk. In the talk. In the next 20 minutes, I next 20 minutes, I next 20 minutes, I want to show you want to show you want to show you how to build how to build how to build ultra-fast agents and ultra-fast agents and ultra-fast agents and MCPs with Spin and MCPs with Spin and MCPs with Spin and run them in a run them in a run them in a globally globally globally distributed distributed distributed environment. So, environment. So, environment. So, my name is Thorsten. I my name is Thorsten. I my name is Thorsten. I work as a senior work as a senior developer attorney at Akamai. I think many of I think many of you have already created MCPs you have already created MCPs you have already created MCPs or agents, and they are or agents, and they are or agents, and they are no no no different from different from different from any other any other any other application. They, application. They, application. They, of course, require of course, require of course, require super-fast super-fast super-fast response times so that we can response times so that we can response times so that we can provide the provide the provide the best best best user experience. However, user experience. However, user experience. However, traditional traditional traditional regionally limited regionally limited regionally limited architectures or architectures or architectures or infrastructures don't infrastructures don't infrastructures don't work when you work when you work when you want to serve a want to serve a want to serve a global audience. global audience. They have certain They have certain drawbacks, which drawbacks, which drawbacks, which led to the emergence of led to the emergence of edge-native edge-native architectures. Of course, architectures. Of course, architectures. Of course, latency is one of the latency is one of the latency is one of the biggest problems. biggest problems. Depending on where Depending on where you deploy your you deploy your you deploy your MCPs or agents, this may MCPs or agents, this may MCPs or agents, this may work quickly for a work quickly for a work quickly for a portion of the global portion of the global portion of the global audience, but others audience, but others audience, but others may experience may experience may experience significantly higher significantly higher significantly higher latency, latency, latency, resulting in a significantly resulting in a significantly resulting in a significantly worse worse worse user user user experience. Depending on the experience. Depending on the experience. Depending on the deployment unit, deployment unit, deployment unit, right? If you right? If you right? If you choose containers choose containers choose containers or virtual or virtual or virtual machines, you may machines, you may machines, you may encounter encounter encounter cold cold cold start latency ranging from a few start latency ranging from a few start latency ranging from a few seconds to a few seconds to a few seconds to a few minutes, especially when you minutes, especially when you minutes, especially when you need need need to scale very to scale very to scale very quickly to quickly to quickly to meet meet meet unexpected unexpected unexpected user demand. We

  2. user demand. We user demand. We can overcome this, can overcome this, can overcome this, of course, by of course, by of course, by over-allocating over-allocating infrastructure resources. However, maintaining However, maintaining many containers many containers many containers or servers without or servers without or servers without actually using them actually using them results in results in significant significant significant cloud costs and is environmentally cloud costs and is environmentally cloud costs and is environmentally unsound. unsound. There are There are higher-level solutions for higher-level solutions for higher-level solutions for running MCPs or agents, running MCPs or agents, running MCPs or agents, but they often but they often but they often come with come with come with proprietary SDKs or proprietary SDKs or proprietary SDKs or proprietary proprietary proprietary deployment methods that deployment methods that deployment methods that need to be considered need to be considered need to be considered for operation in an for operation in an for operation in an industrial industrial industrial environment. Once you environment. Once you environment. Once you learn about these learn about these learn about these limitations, migrating limitations, migrating limitations, migrating your your your workloads or workloads or workloads or agents to another agents to another agents to another hyperscaler or hyperscaler or hyperscaler or other infrastructure other infrastructure other infrastructure becomes quite difficult becomes quite difficult becomes quite difficult and expensive. But there is a and expensive. But there is a and expensive. But there is a solution, and it solution, and it solution, and it involves a new involves a new involves a new way for us way for us way for us engineers to engineers to engineers to build backend or build backend or build backend or server-side applications.

  3. server-side applications. This is achieved This is achieved by implementing by implementing by implementing WebAssembly on the WebAssembly on the WebAssembly on the server side. You can server side. You can server side. You can think of WebAssembly as think of WebAssembly as think of WebAssembly as something similar to how something similar to how something similar to how containers containers containers are to are to are to virtual machines. These are virtual machines. These are virtual machines. These are binary files, binary files, binary files, extremely small in extremely small in extremely small in size, easy to size, easy to size, easy to distribute, very distribute, very distribute, very fast to execute, and fast to execute, and fast to execute, and portable. What I portable. What I portable. What I call the Edge Native AI call the Edge Native AI call the Edge Native AI stack is a combination of a stack is a combination of a stack is a combination of a CNCF project called CNCF project called CNCF project called Spin and Akamai Functions. A single Spin and Akamai Functions. A single Spin and Akamai Functions. A single runtime runtime where you can where you can where you can run these WebAssembly run these WebAssembly run these WebAssembly applications. So, applications. So, applications. So, let's let's let's dive into Spin for a minute. Spin, dive into Spin for a minute. Spin, dive into Spin for a minute. Spin, as I said, is a as I said, is a vendor-agnostic CNCF project that vendor-agnostic CNCF project that allows you to create allows you to create allows you to create WebAssembly applications to WebAssembly applications to WebAssembly applications to run on the server run on the server run on the server or in the cloud. Spin itself or in the cloud. Spin itself or in the cloud. Spin itself consists of three consists of three consists of three main pillars. main pillars. main pillars. So, this is the CLI that we as So, this is the CLI that we as So, this is the CLI that we as developers developers developers use to use to use to solve all our solve all our solve all our day-to-day tasks day-to-day tasks . That is, everything . That is, everything . That is, everything related to the related to the related to the internal internal internal development cycle. This is a development cycle. This is a Wasmtime-based runtime that Wasmtime-based runtime that allows us allows us allows us to run such to run such to run such applications locally, applications locally, applications locally, on microcontrollers, on microcontrollers, on microcontrollers, or in constrained or in constrained or in constrained environments.

  4. environments. environments. Last but not least, Last but not least, Last but not least, Spin provides Spin provides Spin provides language-specific SDKs language-specific SDKs language-specific SDKs to improve to improve developer productivity in developer productivity in everyday tasks everyday tasks , such as interacting with HTTP , such as interacting with HTTP services, services, services, databases, etc. While we databases, etc. While we databases, etc. While we have language-specific SDKs, have language-specific SDKs, have language-specific SDKs, Spin itself is agnostic Spin itself is agnostic Spin itself is agnostic to programming languages, to programming languages, to programming languages, and you can choose and you can choose and you can choose any language that any language that any language that compiles to WebAssembly compiles to WebAssembly , including WebAssembly System , including WebAssembly System , including WebAssembly System Interface, or WASI for short Interface, or WASI for short Interface, or WASI for short . You can . You can . You can learn more about learn more about learn more about Spin at spinframework.dev. Spin at spinframework.dev. Spin at spinframework.dev. Scan this QR code Scan this QR code and you will be taken to the and you will be taken to the and you will be taken to the Spin documentation. So Spin documentation. So , Spin is the , Spin is the , Spin is the developer tool we developer tool we developer tool we use to use to use to build these kinds of build these kinds of build these kinds of applications. Akamai applications. Akamai applications. Akamai Functions is the first Functions is the first Functions is the first truly serverless truly serverless truly serverless computing computing computing platform that is platform that is platform that is globally globally globally distributed and distributed and distributed and has no has no cold start at all. cold start at all. Every application Every application you deploy in you deploy in you deploy in Akamai Functions is Akamai Functions is cold-launched on every cold-launched on every request to your request to your request to your endpoint, and on endpoint, and on endpoint, and on average we do average we do average we do this in less than half a this in less than half a this in less than half a millisecond. It is millisecond. It is millisecond. It is fully managed and, fully managed and, fully managed and, again, again, developer-focused. Your developer-focused. Your developers developers developers deploy deploy deploy workloads without workloads without workloads without configuring or configuring or configuring or writing Terraform— writing Terraform— just one line of just one line of just one line of code, and your code, and your code, and your application application application is distributed globally at no is distributed globally at no is distributed globally at no additional cost.

  5. additional cost. Security Security is provided by the is provided by the WebAssembly sandbox, WebAssembly sandbox, WebAssembly sandbox, so the so the so the workload cannot workload cannot workload cannot interact with interact with interact with external resources external resources unless we as unless we as unless we as developers explicitly developers explicitly developers explicitly grant it such grant it such grant it such rights. And to be a rights. And to be a rights. And to be a full-fledged full-fledged full-fledged serverless serverless serverless computing computing computing platform at the platform at the platform at the edge, we edge, we edge, we need a layer of need a layer of need a layer of persistent persistent persistent data storage. data storage. data storage. Therefore, Akamai Functions Therefore, Akamai Functions Therefore, Akamai Functions comes with a comes with a comes with a built-in built-in built-in key-value store that key-value store that key-value store that is also is also is also multi-tenant multi-tenant . You don't need to . You don't need to . You don't need to create and create and create and manage manage manage credentials. It credentials. It credentials. It automatically automatically automatically links to your links to your links to your application if you application if you application if you plan to plan to plan to use it. use it. use it. Again, here's the QR Again, here's the QR code. Scan it code. Scan it to learn to learn to learn more about Akamai Functions, more about Akamai Functions, more about Akamai Functions, sign up for a sign up for a sign up for a trial or trial or trial or free version, free version, free version, and explore its and explore its and explore its capabilities. This is the capabilities. This is the capabilities. This is the technical foundation technical foundation technical foundation I want to I want to I want to use to use to use to create the first MCP create the first MCP servers. So, servers. So, servers. So, instead of instead of instead of creating a creating a creating a new MCP server yourself, i.e.

  6. new MCP server yourself, i.e. new MCP server yourself, i.e. implementing the HTTP implementing the HTTP protocol or a protocol or a protocol or a specific API on top of specific API on top of specific API on top of HTTP to build the MCP, HTTP to build the MCP, HTTP to build the MCP, there is a smarter there is a smarter there is a smarter way to do it. And way to do it. And way to do it. And this smarter this smarter this smarter way—WasmCP. WasmCP is a way—WasmCP. WasmCP is a way—WasmCP. WasmCP is a CLI that CLI that CLI that integrates seamlessly with Spin. integrates seamlessly with Spin. So what this gives us is the ability is the ability is the ability to focus to focus to focus solely on business solely on business logic. And in the MCP world, logic. And in the MCP world, logic. And in the MCP world, business logic business logic business logic means we means we means we implement our implement our implement our tools, resources, tools, resources, tools, resources, or prompts, and we're or prompts, and we're or prompts, and we're ready to go. Everything ready to go. Everything ready to go. Everything else, all these else, all these else, all these non-functional non-functional non-functional requirements that we have to requirements that we have to deal with, right? For example, user authentication via user authentication via OAuth 2 and OIDC—WasmCP does this OAuth 2 and OIDC—WasmCP does this OAuth 2 and OIDC—WasmCP does this , and we can take , and we can take , and we can take ready-made components and ready-made components and ready-made components and assemble the final MCP assemble the final MCP server to run server to run server to run it on Spin or Akamai it on Spin or Akamai it on Spin or Akamai Functions. And that's exactly what we're going to Functions. And that's exactly what we're going to Functions. And that's exactly what we're going to do now. So, do now. So, do now. So, I installed WasmCP on I installed WasmCP on I installed WasmCP on my computer. This is my computer. This is my computer. This is github.com/wasMCP/wasMCP. And it github.com/wasMCP/wasMCP. And it github.com/wasMCP/wasMCP. And it provides a great provides a great provides a great little little little command line interface. So command line interface. So command line interface. So we can run we can run we can run wasm-cli new. We can wasm-cli new. We can wasm-cli new. We can choose a language: Rust, choose a language: Rust, choose a language: Rust, TypeScript, Python, and also TypeScript, Python, and also TypeScript, Python, and also choose a template. The choose a template. The choose a template. The standard template standard template is when I'm is when I'm is when I'm only interested in only interested in only interested in tools for now. And tools for now. And tools for now. And let's call this new MCP let's call this new MCP server "hello". We server "hello". We server "hello". We get instructions get instructions : "Hey, go to hello." Uh : "Hey, go to hello." Uh , hello. Then we'll open a

  7. , hello. Then we'll open a , hello. Then we'll open a new terminal on new terminal on new terminal on this side. this side. this side. Let's also go to "hello" here and Let's also go to "hello" here and Let's also go to "hello" here and run npm install, run npm install, run npm install, as this takes as this takes as this takes a few seconds. And a few seconds. And a few seconds. And let's open this in let's open this in let's open this in the editor, the editor, the editor, expand it to full expand it to full expand it to full screen. So what do we screen. So what do we screen. So what do we see here? We get a see here? We get a see here? We get a template that is ready template that is ready template that is ready to use. And those to use. And those to use. And those wavy lines wavy lines wavy lines will disappear once npm will disappear once npm will disappear once npm install completes. install completes. So, all we So, all we need to do is need to do is need to do is describe the pattern of describe the pattern of describe the pattern of expected input expected input expected input data. We obviously data. We obviously data. We obviously need to provide a need to provide a need to provide a list of our list of our list of our tools. Again tools. Again tools. Again , we need to be , we need to be , we need to be responsible here responsible here responsible here and provide accurate and provide accurate and provide accurate descriptions so that people and LLMs descriptions so that people and LLMs descriptions so that people and LLMs know how to work with know how to work with know how to work with these types of these types of these types of tools. We tools. We tools. We list them in a list them in a list them in a simple array, and simple array, and simple array, and then there is one then there is one then there is one processing function called call processing function called call processing function called call tool. And depending on the tool. And depending on the payload we payload we get, we have to get, we have to get, we have to decide which decide which decide which tool to execute.

  8. tool to execute. If we go to the If we go to the handle example tool here, we handle example tool here, we handle example tool here, we see that all see that all see that all input arguments input arguments input arguments are validated. And if are validated. And if are validated. And if everything is fine, we simply everything is fine, we simply everything is fine, we simply concatenate the concatenate the concatenate the received data with the received data with the received data with the prefix and prefix and prefix and return the result to return the result to return the result to the user. Nothing the user. Nothing the user. Nothing complicated. So, complicated. So, complicated. So, let's close let's close let's close the editor here and the editor here and the editor here and follow follow follow the instructions. the instructions. the instructions. Next on the list is Next on the list is Next on the list is make. Make takes JavaScript code make. Make takes JavaScript code make. Make takes JavaScript code and compiles it into and compiles it into and compiles it into WebAssembly. As a result, WebAssembly. As a result, WebAssembly. As a result, we get a we get a we get a tool web tool web tool web assembly component that assembly component that assembly component that is not yet a full-fledged MCP is not yet a full-fledged MCP server. The next server. The next server. The next step will be wasm CP compose. step will be wasm CP compose. step will be wasm CP compose. Let's create a Let's create a Let's create a full-fledged MCP full-fledged MCP full-fledged MCP by taking our by taking our by taking our tools and tools and tools and saying, "Hey, saying, "Hey, saying, "Hey, please give me an MCP." please give me an MCP." please give me an MCP." For this For this For this demonstration, I'm not demonstration, I'm not demonstration, I'm not interested in interested in interested in authentication. authentication. Okay, he pulls up Okay, he pulls up all the necessary all the necessary all the necessary components and assembles the components and assembles the components and assembles the MCP server. He gives MCP server. He gives MCP server. He gives me instructions on how to me instructions on how to me instructions on how to run it. I can run it. I can run it. I can execute spin up -f server.wasm.

  9. execute spin up -f server.wasm. And we should see And we should see that it's running on localhost that it's running on localhost that it's running on localhost 3000. Okay, let's bring back 3000. Okay, let's bring back 3000. Okay, let's bring back another terminal. And another terminal. And another terminal. And let's run NP NPX MCP inspector let's run NP NPX MCP inspector let's run NP NPX MCP inspector here. It should here. It should here. It should open in open in open in the browser. That's all. the browser. That's all. the browser. That's all. It's already pointing to It's already pointing to It's already pointing to localhost 3000 right here. localhost 3000 right here. localhost 3000 right here. So, let's connect. So, let's connect. So, let's connect. Let's review the list of Let's review the list of Let's review the list of tools. Here is our tools. Here is our tools. Here is our example tool. example tool. example tool. We provide foo as an We provide foo as an We provide foo as an input parameter. input parameter. input parameter. We run We run We run the tool and should the tool and should the tool and should get back foo. get back foo. get back foo. Perfectly. Nothing Perfectly. Nothing Perfectly. Nothing special. Cool, it special. Cool, it special. Cool, it works. But this is a works. But this is a works. But this is a local experience. So local experience. So local experience. So how do we turn this how do we turn this how do we turn this into a global or into a global or into a global or globally globally globally distributed MCP distributed MCP server? Well, instead of a server? Well, instead of a server? Well, instead of a global global global hello world MCP hello world MCP server, I have a solution server, I have a solution log MCP server log MCP server log MCP server . And let me . And let me . And let me open this one first open this one first open this one first . So, this one . So, this one . So, this one is implemented in Rust, is implemented in Rust, is implemented in Rust, just for the sake of just for the sake of just for the sake of implementing in Rust. implementing in Rust. So, let's go into lib RS So, let's go into lib RS here. There is an here. There is an here. There is an equivalent class equivalent class equivalent class or structure in Rust. As or structure in Rust. As or structure in Rust. As you can see, we are you can see, we are you can see, we are looking at a looking at a looking at a tool call function tool call function tool call function where we branch out where we branch out where we branch out and use and use and use one of the CRUD APIs or one of the CRUD APIs or one of the CRUD APIs or tools tools tools provided by my MCP provided by my MCP server. If we server. If we server. If we delve into the delve into the delve into the implementation itself, um, implementation itself, um, implementation itself, um, let me...no, that's not let me...no, that's not let me...no, that's not it. I want this, and then it. I want this, and then it. I want this, and then I want to do that.

  10. I want to do that. I want to do that. Er, decision.rs. If we Er, decision.rs. If we Er, decision.rs. If we go to the end of go to the end of go to the end of the file, you'll see that the file, you'll see that the syntax is a little different, but the the syntax is a little different, but the content is the same, right? I content is the same, right? I content is the same, right? I have to define my have to define my have to define my tools. And if tools. And if tools. And if we go to we go to we go to about about about line 15, yes, the list of line 15, yes, the list of line 15, yes, the list of solutions, you see here solutions, you see here solutions, you see here that I'm using that I'm using that I'm using storage. So, on storage. So, on storage. So, on my local my local my local machine, Spin machine, Spin machine, Spin recognizes, "Hey, recognizes, "Hey, recognizes, "Hey, Thorsten wants Thorsten wants Thorsten wants to use a to use a to use a key- key- value store." So it value store." So it value store." So it automatically creates a automatically creates a automatically creates a key-value store key-value store using SQLite on using SQLite on my computer for my computer for my computer for development purposes. And in development purposes. And in development purposes. And in Akamai Functions, we Akamai Functions, we Akamai Functions, we use a use a use a globally globally globally distributed distributed distributed key-value store without key-value store without key-value store without configuring anything configuring anything configuring anything manually. Everything else is the manually. Everything else is the manually. Everything else is the same, right? I same, right? I same, right? I need to use need to use need to use this makefile and build the this makefile and build the this makefile and build the server. However, I server. However, I server. However, I think it's smarter think it's smarter think it's smarter to update the to update the to update the application manifest and application manifest and application manifest and merge these tasks merge these tasks to stay to stay to stay within the Spin development framework and within the Spin development framework and within the Spin development framework and just run a Spin just run a Spin just run a Spin build to compile build to compile build to compile my MCP server. However, my MCP server. However, my MCP server. However, I can also combine I can also combine I can also combine this with a Spin Akamai deploy. So this with a Spin Akamai deploy. So this with a Spin Akamai deploy. So now he's building a now he's building a now he's building a server and he asks me, server and he asks me, "Hey, what do you want to "Hey, what do you want to "Hey, what do you want to call this MCP server call this MCP server call this MCP server in Akamai Functions?" I call in Akamai Functions?" I call in Akamai Functions?" I call it ADR MCP. I allow it ADR MCP. I allow it ADR MCP. I allow my terminal my terminal

  11. my terminal to interact with the to interact with the to interact with the service registry. service registry. Now it takes my WASM file and file and file and application manifest, generates application manifest, generates application manifest, generates OCI layers from those files, and OCI layers from those files, and OCI layers from those files, and uploads them to Akamai uploads them to Akamai uploads them to Akamai Functions. On the Functions. On the Functions. On the server or service side, we server or service side, we server or service side, we receive these two receive these two receive these two files and distribute files and distribute files and distribute them worldwide them worldwide them worldwide across all across all across all service regions. service regions. Each region must Each region must confirm that it confirm that it confirm that it has received the has received the has received the workload and workload and workload and is able to is able to is able to run it. Then we run it. Then we initialize initialize the load once and the load once and the load once and perform an internal perform an internal perform an internal state check. And once an state check. And once an HTTP 200 response is received from all regions, we HTTP 200 response is received from all regions, we create a shared subdomain for you create a shared subdomain for you so that your MCP server is so that your MCP server is accessible on the accessible on the accessible on the public internet public internet . Of course, you can . Of course, you can . Of course, you can protect it with protect it with protect it with other products and other products and other products and services, such as services, such as services, such as Property Manager, to Property Manager, to Property Manager, to provide provide any protection before any protection before any protection before redirecting redirecting redirecting users to the MCP users to the MCP server. So, we server. So, we server. So, we got this URL.

  12. got this URL. got this URL. So we are globally So we are globally So we are globally distributed in distributed in distributed in about 60 seconds about 60 seconds . Let's move on to . Let's move on to . Let's move on to the client. I the client. I the client. I use Z, but this use Z, but this use Z, but this works with any works with any works with any client that client that client that supports MCP. I'm adding a supports MCP. I'm adding a supports MCP. I'm adding a server. I go to the server. I go to the server. I go to the remote section and replace remote section and replace remote section and replace this line with the received this line with the received this line with the received URL. I add a URL. I add a URL. I add a server, and we see server, and we see server, and we see that I already have five that I already have five that I already have five tools. I can tools. I can tools. I can go here and select go here and select go here and select "view "view "view tools"—these are the CRUD tools"—these are the CRUD tools tools tools defined by my MCP. So defined by my MCP. So defined by my MCP. So I can go back to I can go back to I can go back to the chat in my IDE in the the chat in my IDE in the the chat in my IDE in the context of the project context of the project context of the project so that it can so that it can so that it can use my MCP use my MCP server to server to server to track the decision track the decision track the decision to use OAuth to use OAuth to use OAuth 2.0. 2.0 for OAuth. OK. 2.0. 2.0 for OAuth. OK. 2.0. 2.0 for OAuth. OK. Now it should Now it should Now it should recognize my intent recognize my intent recognize my intent and ask for permission to and ask for permission to and ask for permission to run the run the run the solution insertion tool. We solution insertion tool. We solution insertion tool. We can see that the input can see that the input can see that the input data looks data looks data looks good. We allow good. We allow good. We allow this. Now it this. Now it this. Now it calls my calls my calls my function, which has already function, which has already function, which has already tracked my tracked my tracked my solution, and I can solution, and I can solution, and I can ask: show ask: show ask: show me all the solutions, me all the solutions, me all the solutions, please. So the goal please. So the goal please. So the goal is to is to is to use the use the solution list tool, and again , we, uh, yeah, maybe , we, uh, yeah, maybe , we, uh, yeah, maybe he'll want to read the he'll want to read the he'll want to read the details to give details to give details to give me everything he's me everything he's me everything he's tracked. Or, along tracked. Or, along tracked. Or, along with that, we have a with that, we have a with that, we have a globally

  13. globally globally distributed MCP distributed MCP server that server that server that routes all requests routes all requests routes all requests to the nearest to the nearest service region, service region, no matter no matter no matter where your users are located where your users are located where your users are located . And . And . And again, you can again, you can again, you can write these write these write these tools, tools, tools, prompts, or resources prompts, or resources prompts, or resources using using using TypeScript, Python, TypeScript, Python, TypeScript, Python, or Rust templates. Class. or Rust templates. Class. or Rust templates. Class. Let's move on to agents. Let's move on to agents. Let's move on to agents. Um, yes, oh, no, not this one. Um, yes, oh, no, not this one. So So the situation is no the situation is no the situation is no different for AI agents. However, different for AI agents. However, different for AI agents. However, instead of instead of instead of using using using another CLI, we can another CLI, we can another CLI, we can simply choose simply choose any SDK that is any SDK that is any SDK that is available and available and available and popular. I think the popular. I think the popular. I think the Vercel AI SDK is quite Vercel AI SDK is quite Vercel AI SDK is quite easy to easy to easy to use. So use. So use. So this allows us to this allows us to this allows us to essentially create a new essentially create a new essentially create a new Spin application in TypeScript. Spin application in TypeScript. Simply add Simply add Vercel AI dependencies to Vercel AI dependencies to Vercel AI dependencies to create your own create your own create your own agents. Let's agents. Let's agents. Let's go back to go back to go back to the terminal again to the terminal again to the terminal again to see what it see what it see what it looks like. So, let looks like. So, let looks like. So, let 's go up a 's go up a 's go up a level and level and level and move on to a move on to a move on to a simple game simple game simple game agent. And what is agent. And what is agent. And what is happening here?

  14. happening here? happening here? Obviously, I created a Obviously, I created a Obviously, I created a new Spin app new Spin app new Spin app using a using a using a template to get template to get template to get started quickly. I am started quickly. I am started quickly. I am using a large using a large using a large language model language model language model deployed on a deployed on a deployed on a Linode instance with a Linode instance with a Linode instance with a dedicated dedicated dedicated GPU. And all GPU. And all GPU. And all my Spin app does my Spin app does is identify the is identify the is identify the tools. This is a tools. This is a tools. This is a simple game simple game simple game agent for agent for agent for demonstration demonstration demonstration purposes that can purposes that can purposes that can flip coins or flip coins or flip coins or roll a die where you roll a die where you roll a die where you can specify can specify can specify the number of its the number of its the number of its faces. And here, in the faces. And here, in the faces. And here, in the HTTP handler itself, HTTP handler itself, HTTP handler itself, we load we load we load the configuration and the configuration and the configuration and define our define our define our agent, pointing to the agent, pointing to the agent, pointing to the Llama instance Llama instance Llama instance running on the node. We running on the node. We running on the node. We give our agent an give our agent an give our agent an identity and identity and identity and instruction as to what instruction as to what instruction as to what their their their true intent is. We true intent is. We true intent is. We register our register our register our tools and tools and tools and set limits set limits set limits on how many on how many on how many steps it can steps it can steps it can take. We generate take. We generate take. We generate a response and a response and a response and return it back to return it back to return it back to the client. Okay, the client. Okay, the client. Okay, let's get out let's get out let's get out of here and run of here and run of here and run the command "spin akker deploy no the command "spin akker deploy no the command "spin akker deploy no confirm build". It asks for confirm build". It asks for confirm build". It asks for a name, it's game agent. While a name, it's game agent. While a name, it's game agent. While it's loading, it's loading, it's loading, let me explain let me explain let me explain what happens when what happens when what happens when we compile an we compile an we compile an interpreted language.

  15. interpreted language. interpreted language. So, during So, during So, during compilation, we compilation, we compilation, we load load load the interpreter, the interpreter, the interpreter, load your load your load your own JavaScript, and own JavaScript, and own JavaScript, and then evaluate the then evaluate the then evaluate the global scope global scope global scope . This has . This has . This has one advantage: not one advantage: not one advantage: not only is the only is the only is the runtime ready to runtime ready to runtime ready to go, but all go, but all go, but all dependencies are already dependencies are already dependencies are already loaded. We then loaded. We then loaded. We then take a memory snapshot take a memory snapshot , write it to WASM, , write it to WASM, , write it to WASM, and save it to disk, and save it to disk, and save it to disk, which means that any which means that any WebAssembly application written in WebAssembly application written in JavaScript is faster than a JavaScript is faster than a JavaScript is faster than a native JavaScript native JavaScript application in terms of application in terms of application in terms of cold start and cold start and execution performance. The only execution performance. The only tradeoff is tradeoff is tradeoff is that we that we that we have to ship a have to ship a JavaScript runtime along with our, JavaScript runtime along with our, uh, uh, uh, user code, but we user code, but we user code, but we use an use an use an optimized optimized optimized JavaScript runtime JavaScript runtime JavaScript runtime called Starling Monkey, called Starling Monkey, called Starling Monkey, which is which is which is about about about 10 megabytes in size. So, we 10 megabytes in size. So, we 10 megabytes in size. So, we get back the get back the URL. Let me URL. Let me URL. Let me replace this URL replace this URL replace this URL right here and, let's say, right here and, let's say, right here and, let's say, flip a coin. And flip a coin. And flip a coin. And we see, uh, we we see, uh, we we see, uh, we see the response, and see the response, and see the response, and if we look at if we look at if we look at these headers, we these headers, we these headers, we see, uh, the point of see, uh, the point of see, uh, the point of presence where we presence where we presence where we enter the Akamai network enter the Akamai network is Santa Clara, and the is Santa Clara, and the is Santa Clara, and the closest closest closest service region for service region for service region for our AI agent is LAX.

  16. our AI agent is LAX. Another interesting Another interesting header is header is X-Envoy-Upstream-Service-Time. And that X-Envoy-Upstream-Service-Time. And that X-Envoy-Upstream-Service-Time. And that tells me and you right tells me and you right tells me and you right now that it now that it now that it took 33, uh, 34 took 33, uh, 34 took 33, uh, 34 milliseconds to milliseconds to milliseconds to get the request, get the request, get the request, execute the business execute the business logic, call the logic, call the logic, call the big language big language big language model, generate model, generate model, generate the response, and the response, and the response, and return it back to return it back to return it back to the user. Oh, the user. Oh, the user. Oh, internal internal internal server error. Perfectly. server error. Perfectly. server error. Perfectly. Fantastically. Fantastically. Fantastically. Let's try again. Oh, Let's try again. Oh, Let's try again. Oh, yes. This was yes. This was yes. This was user error. Sorry. user error. Sorry. user error. Sorry. So, the error was So, the error was So, the error was 30 cm from the screen. Uh, 30 cm from the screen. Uh, 30 cm from the screen. Uh, looking at this now looking at this now , we have 866 ms. Er, that's , we have 866 ms. Er, that's , we have 866 ms. Er, that's more realistic, more realistic, more realistic, since we since we since we need to go need to go need to go through LLM to essentially through LLM to essentially through LLM to essentially see that our see that our see that our toss came up heads. Let's toss came up heads. Let's toss came up heads. Let's do it again. do it again. do it again. Tails, tails, tails. Tails, tails, tails. Tails, tails, tails. Tails. Ah, here is the eagle. Tails. Ah, here is the eagle. Tails. Ah, here is the eagle. Class. So, approximately Class. So, approximately Class. So, approximately 820 ms—that's what we 820 ms—that's what we 820 ms—that's what we can achieve in a can achieve in a can achieve in a full cycle through LLM full cycle through LLM full cycle through LLM by taking our agent by taking our agent by taking our agent and deploying it in and deploying it in and deploying it in Akamai functions. OK.

  17. Akamai functions. OK. Akamai functions. OK. So, the So, the So, the developer workflow is always developer workflow is always developer workflow is always the same, whether the same, whether the same, whether you are building you are building you are building any any any business application, business application, business application, creating an MCP, or an creating an MCP, or an creating an MCP, or an agent: you implement agent: you implement agent: you implement your application your application your application using using any language that can be any language that can be any language that can be compiled to WebAssembly compiled to WebAssembly . Rust, TypeScript, Python, Go— . Rust, TypeScript, Python, Go— the most popular of them the most popular of them the most popular of them today. You can today. You can today. You can test this test this test this locally locally locally using the Spin CLI. You using the Spin CLI. You using the Spin CLI. You deploy it deploy it deploy it with a single with a single with a single command called " command called " spin akamai deploy". And finally, spin akamai deploy". And finally, spin akamai deploy". And finally, you refer your you refer your you refer your clients to your MCP clients to your MCP clients to your MCP or to your agent. or to your agent. So, the final or So, the final or key takeaways from key takeaways from key takeaways from my side are my side are my side are portability. You portability. You portability. You can take these Spin can take these Spin applications and applications and applications and run them on run them on any Wasm- any Wasm- any Wasm- compatible runtime environment compatible runtime environment compatible runtime environment . Akamai is one . Akamai is one . Akamai is one such environment, and such environment, and such environment, and it is globally it is globally it is globally distributed. Everything distributed. Everything distributed. Everything is based on is based on is based on open standards open standards . So, Spin and CNCF, WASI, . So, Spin and CNCF, WASI, . So, Spin and CNCF, WASI, WebAssembly are governed by the WebAssembly are governed by the WebAssembly are governed by the Bytecode Bytecode Bytecode Alliance. But in the end, you Alliance. But in the end, you Alliance. But in the end, you win in speed, win in speed, win in speed, right? You right? You right? You get fast get fast get fast response times, even response times, even response times, even the time to market the time to market the time to market for your for your for your developers to developers to developers to build MCPs and build MCPs and build MCPs and agents is reduced agents is reduced , because you don't , because you don't , because you don't have to deploy have to deploy have to deploy infrastructure, you infrastructure, you infrastructure, you don't have to don't have to don't have to implement implement implement non-functional non-functional non-functional requirements. That's already requirements. That's already requirements. That's already been taken care of. As for been taken care of. As for been taken care of. As for infrastructure, there are infrastructure, there are infrastructure, there are no operational no operational no operational tasks. This is Spin, Akamai tasks. This is Spin, Akamai tasks. This is Spin, Akamai Deploy—that's all you Deploy—that's all you Deploy—that's all you need. There are other commands in the set that allow you to need. There are other commands in the set that allow you to collect collect metrics, get metrics, get metrics, get logs, update, logs, update, logs, update, etc. But

  18. etc. But etc. But developer experience is our developer experience is our developer experience is our most important most important most important metric, which is what we metric, which is what we metric, which is what we started Spin with, and that's why we started Spin with, and that's why we started Spin with, and that's why we continue to move continue to move continue to move in that direction. in that direction. in that direction. We have a new website We have a new website We have a new website called Akamai Developer called Akamai Developer called Akamai Developer Hub, where we share Hub, where we share Hub, where we share our stories, our stories, our stories, experiments, and experiments, and experiments, and similar experiences. similar experiences. similar experiences. So visit So visit So visit developers.akamai.com. And if developers.akamai.com. And if developers.akamai.com. And if you have any you have any you have any additional questions, additional questions, additional questions, find me at the find me at the find me at the Akamai booth. That's Akamai booth. That's Akamai booth. That's all, thank you very much.

Summary

This talk introduces a new approach to building ultra-fast, globally distributed agents and MCPs by leveraging edge-native architectures and WebAssembly. Key subjects include overcoming latency issues with traditional regional infrastructures, the drawbacks of containers and VMs, and the benefits of WebAssembly for its small size, portability, and speed. The practical takeaway is to use the Spin CNCF project and Akamai Functions as an edge-native AI stack to run WebAssembly applications efficiently in a distributed environment, offering a superior alternative to proprietary SDKs and expensive hyperscaler migrations.

View original episode ↗