WebAssembly Sandboxes a Million AI Agents on One Kubernetes Pod
AI agent sandboxing has become one of the hottest topics in cloud native computing. Every booth seems to offer a way to isolate agents. Yet not every sandbox offers the same protection or the same performance.
Cosmonic CTO Bailey Hayes examines that challenge with Mike Vizard at KubeCon + CloudNativeCon in Salt Lake City.
A Million Agents on One Pod
Hayes compiled popular agents such as Codex, Goose and Hermes to WebAssembly. Each agent runs in its own sandbox, and so does every tool it calls.
In a live demo, she ran a million agents on a single Kubernetes pod. Arm supplied a 64-core host for the test. CNCF wasmCloud scheduled the workloads and ran them in a multi-tenant host.
The compiled Codex agent weighed in at just 243 kilobytes. The bottleneck turned out to be session storage, not the host itself. The benchmark and its Ansible playbook are open source.
Deny by Default
Hayes sees two classes of agents emerging. General-purpose coding agents need broad resources. Single-purpose agents, like a support bot, should be locked down to a few tasks.
That is where capability-based security comes in. A WebAssembly component declares exactly what it imports and exports. Nothing else is allowed.
Hayes points to the NIST definition of a sandbox. It calls for isolation and deny-by-default controls. Most approaches deliver isolation, she says, but few deny by default. Effective AI agent sandboxing needs both, along with least privilege.
Building on Kubernetes
Hayes warns against reinventing Kubernetes for agentic workloads. Its RBAC, network policy and namespaces are there for good reasons.
wasmCloud uses an operator and custom resources that mirror a standard deployment. The operator pushes events to hosts over NATS instead of polling the Kubernetes API. That matters when workloads start in microseconds.
Cosmonic Desktop helps developers build for WebAssembly with an MCP server and templates. Cosmonic Control adds the high availability, service mesh and workload identity enterprises need.
Her advice for IT teams is simple. Join the community, because open source will solve this faster than any in-house effort.
Transcript
Hey everybody. Welcome back to KubeCon plus CloudNativeCon North America 2026. Boy, that just rolls off the tongue.
It's amazing. Anyway, I'm here with my good friend, Bailey. How you doing?
Hey, Mike. She's the CTO for Cosmonic, and we're going to have a little chat about, well, these guys did an analysis of AI agents and some of the performance attributes. I'm going to let Bailey explain what's going on here.
But I think the gist of this is not all AI agents are created equal. This is a very true fact. So walk us through what the analysis you guys put through, what did you learn and what's the takeaway?
Sure. Walking around on the KubeCon floor, I've seen a ton of different sandboxing technologies for sandboxing AI. I'm a little biased because I work on my own sandboxing technology.
It's called WebAssembly. Mm-hmm. And so what I've done is taken agents and compiled them to WebAssembly.
So I've been able to take things like Codex, Py, Goose, Hermes. Basically, you name it, I've been able to compile it down to WebAssembly, and that puts that agent in its own sandbox. And then the tools that the agent calls, I've also put those in their own WebAssembly sandbox.
And so yesterday, I gave a live demo of running a million agents on one Kubernetes pod. Wow. It was a beefy pod.
I will be totally frank about that. Arm donated a box for me to play around with. It was one of their newer ones.
It had 64 cores, 123 gigs of RAM that I was able to put all dedicated to one host pod. Not something everybody has. Not something everybody has, but if you can do that, you can get some pretty crazy numbers because WebAssembly is also running inside our CNCF project, CNCF WasmCloud.
So CNCF WasmCloud is how we run it inside Kubernetes. So I used WasmCloud to basically provision this host, and schedule a million different workload deployments. And inside each one of those, basically WasmCloud host knows how to run multi-tenanted.
And that's why I'm able to basically safely sandbox a million different agents at this event scale. WebAssembly's also really tiny. So the demo that I did was with Codex.
And I had Codex compiling to 243 kilobytes. Mm-hmm. So very small, and then that's just how much it was in memory when I was running it.
And so all of them kind of woke up. They all made a call out to an OpenAI endpoint. I gave it a fake OpenAI endpoint because I didn't want to spend all those tokens.
Nobody yet has given me that many tokens to try out for these stunt hacks. So, it gave it a valid response back, and then we saved that off into session storage. And so really it was, the limit that I ran into for this was actually with my session storage side of the world than it was with anything to do with this host.
Filled up the memory. 4 milliseconds. All right.
So blazing fast. So are we going to wind up putting different classes of AI agents in different sandboxes based on what attributes or how do you think this is going to play out? Yeah.
I kind of think there's really two major classes of agents. There's the general purpose kind of coding agent. So think about using Claude on your desktop, right?
You're giving it a compiler ability to run integration tests. It's using a lot of resources to be able to write code effectively. But I think there's going to be this whole universe of single purpose agents that people want to deploy and run at scale, and more importantly, run securely at scale.
So you can look at like the mistakes that some companies have made. I hate to pick on them because I actually like their burritos. But Qdoba's support agent was a pretty fun one to see happen.
And what they had is they basically, essentially pointed something like Claude, straight to the open internet, and then people had the support chat coding for them. Yikes. And so you can see why actually maybe it would be a lot more beneficial for that kind of use case to have a single purpose agent that's like, "Actually, no.
You can only search our support docs. " Right? You want to be able to lock that down.
So is the issue-- it seems like it's twofold. One is we definitely need something that puts the agent in a sandbox, but we also need to configure the agent properly because people seem to be just kind of rolling these out there without maybe thinking through all the implications. Yes.
So you want fine grain control, and the way that we do that with our tech is with capability-based security. So with WebAssembly, it is deny by default. But sometimes I say like no function call at all by default because if you actually inspect the binary itself, it has imports and exports that basically decide what does it need to be able to run.
So those are the imports. Like these are the capabilities I have to have. I have to have a web GPU.
I have to have a file system. I have to be able to access HTP. Those are some examples of capabilities that are imports.
And then exports are what capabilities I provide. And another way of saying that is, what's my API, right? What can other people do to call me?
And when you compose basically components this way, where each one has their tight, fine grain capability grants, you know exactly what they're trying to do. And so it's very easy now to safely and securely sandbox them because it's architectural level security. So do you think that maybe AI agents wind up being like a killer app for Wasm?
I think it will be. I really hope so, obviously. That's my bet.
" Right? Like, I saw the substrate talk. I saw them get to hundreds of thousands, and everybody was blown away at that.
And you're over here talking about millions, so on one pod. That's a pretty big difference. Why isn't everybody doing it?
And I think simply I hadn't made this demo yet. com. So, cards on the table, you should be able to totally replicate this just with CNCF WasmCloud, and I think if we just need to get the word out.
I'm counting on you to do that. There you go. So what is your take on how well-suited is Kubernetes for these agentic AI workloads?
Because people are talking about there needs to be some work on the control plane done. There's folks talking about the agents are blocking up too many resources, and we need maybe a little more finer grained approach to this thing. And I can't help but wonder, are we going to reinvent Kubernetes for this?
What's your take? I am a little bit afraid that some folks are going to attempt that, and I feel like it's a bit of folly. Kubernetes gives me so many different things.
The complexity in Kubernetes is there for a reason. And I want to be able to have network policy controls, CNI. I want to be able to use Kubernetes RBAC for who's allowed to schedule work, right?
And so with WasmCloud, I did run up to a lot of different scaling issues inside Kubernetes today. Much like the substrate talk, I also ran into issues with etcd being able to scale. But it's possible to change it out.
So that's one component you can swap out. The other thing that I run into is a lot of people do their own operator scheduler that does polling basically against the k8s API, and that can really just like take you down too if you're doing something at the scale that I was aiming for. So WasmCloud takes a slightly different approach.
We still use an operator, and we use custom resources. So, a workload deployment for us is our custom resource. It is like a mirror image of a deployment YAML.
So just like what you would normally deploy with containers, do it with WebAssembly components, with our operator. And to install our operator, you don't need anything special, just Helm install to get it in. And our operator, what it does is it reconciles against the k8s API.
So I get all of the Kubernetes RBAC control and namespace level multi-tenancy, which is huge. So we use that namespace to kind of determine what resources, different things inside the host are allowed to be granted. But the biggest thing from that is that our operator actually talks over NAT score to our host.
So rather than having our hosts go and fetch the API and figure out what it's supposed to be doing and kind of reconciling itself, we have our own really lightweight protobuf over CoreNats API Pub/Sub. So WebAssembly starts in microseconds. And if you're doing some kind of long polling thing or everything in the system's kind of designed for containers that takes some seconds to come up, that's way too slow for us.
So, basically, you schedule a workload, we decide what host it needs to run on, we push an event, and that host says yes, and it runs. So do you think that we need to set up or define some best practices for deploying AI agents in different types of use cases and scenarios? And it feels like that's still a work in progress, but maybe that's the next thing for the community.
I think there are a lot of different opportunities for the community to solve. The best practices for how to secure AI obviously are huge. I think determining what a definition of sandboxing is is a big thing.
I keep seeing the word sandbox around here, and I don't think we're agreeing on the same term. I adhere to the one from NIST- Mm-hmm ... which is basically everything in your box, your sandbox, is untrusted code, all of it.
And to be able to secure it, it should be isolated. And I feel like everybody here gets the isolation primitive, so kudos on that. But the second part in the NIST standard is that it needs to be denied by default.
And most of the things I'm seeing here, not that. Because if you think about it, containers, you have to layer a lot of things on top to be able to secure it. We can come up with best practices for that.
But WebAssembly takes the opposite approach, where everything is denied by default, and you grant capabilities for exactly what you need and nothing more. And that's the principle of least privilege that is part of the NIST definition of sandboxing. Hmm.
So what is your best advice to your fellow IT professionals out there that are all experimenting with this at this point? But a lot of them don't know what they don't know. So, you've been down the path a little bit further.
I guess I'm asking you, what do you know now that you didn't know a week ago? Yeah. Well, I did learn a lot over the week because I got a lot of it working and how to scale Kubernetes a little bit faster.
I would say that you should be part of a community, right? We're all trying to solve this problem. There's not a single company here that's not actively trying to solve this problem right now.
If you're interested in doing it with WebAssembly and Wasm Cloud, join our Wasm Cloud Slack. Ask questions. I've seen maybe five or six different frameworks right now for ways that people are approaching this on top of Wasm Cloud.
I would like to see us kind of coalesce as a community on one set so that we can really harden that and make best practices and have a really nice ecosystem built around it. But ultimately, the only solution here is going to be community-driven and open source, right? And if you go and try to build your own thing internal in-house, you're going to get left behind.
So that's my answer to most of these professionals. So for those who don't know, explain WebAssembly to folks. Okay.
WebAssembly is a write once, run anywhere technology. Oops. Did that just sound like Java?
JAR is a portable byte code. Mm-hmm. WebAssembly is also a portable byte code.
Wasm. However, different from Java, 17 out of the top 20 languages have support for WebAssembly. So it's a compilation target that all these high-level languages support.
So, my favorite language is Rust, and it's becoming basically the most popular language of the AI era now, where people are really focused on security and performance. wasm. And now that byte code, I can run the exact same one on my laptop as I run in my Kubernetes cluster.
And that's a pretty powerful trait when you think about being able to iterate really quickly when we're kind of all bumping up into not being able to buy RAM, not being able to buy a graphics card. So we're being asked to do more with less, and having something that has this portability property that also matches exactly what you're running in production is pretty important. So- Mm-hmm ...
if you're interested in WebAssembly, I think the only other thing I would say is it is designed as a sandboxing technology. You can guess by the name, WebAssembly. However, we have this fun phrase that we always say, which is it's neither web nor assembly, which really throws people off because it's designed intentionally from the very beginning, yes, by browser vendors, but also designed so that it doesn't have to run in a JavaScript sandbox.
It is meant to be able to be sandboxed by something that wants to run in a dishwasher. Bosch actually runs Wasm in a dishwasher. It runs on plane streams and wherever else you want to run it.
It's in most TVs on the planet. You use it every day, you just don't know it. jars.
Wasm kind of falls into that category sometimes. But we're talking about it now because it's a sandboxing technology. If you think about it, the web runs everybody's code at scale across all this consumer hardware everywhere, right?
And you're shipping untrusted code through the browser to execute on their device. They had to solve that sandboxing problem. So we're running a browser-grade security, which is the most battle-hardened security you can possibly have, and that's the sandboxing tech that we're running server side and using a runtime called Wasmtime.
That's our runtime of choice. So complete the circle. Where does Cosmonic fit in that equation?
Yeah. We give a couple different products that are around this. We have Cosmonic Desktop.
You can kind of think of it sort of like Docker Desktop, as you can probably guess with the name. Did that a bit intentionally, but it's also designed to be an AI-first environment. So we give you an MCP server and skills for how to build directly for WebAssembly, a ton of different templates and golden paths so that you can basically one-shot anything you want to build straight to Wasm and run that sandbox.
And then Cosmonic Desktop outputs a workload deployment that you can run straight in your Kubernetes cluster. And so Cosmonic also gives you Cosmonic Control. Cosmonic Control is basically our enterprise distribution of Wasm Cloud.
That gives you HA, security. We give you XDS service mesh integration, workload identity, essentially all the things that enterprises need to be able to run securely and at scale. All right.
Folks, you heard it here. If you want to deploy AI agents at scale, you got to start looking at Wasm Cloud. Hey, Bailey, thanks a million.
Thank you for having me. All right, and we'll be back in a minute.