Video: Build Smarter: Why AI Agents Need Computers, Not Containers | Duration: 5092s | Summary: Build Smarter: Why AI Agents Need Computers, Not Containers | Chapters: Welcome & Introduction (54.75s), Why Agents Need Computers (166.49s), CloudFlare Architecture (332.4s), Durable Workspace (447.67s), Isolate vs Container (565s), Dynamic Compute Selection (700.51s), Site Doctor Demo (793.685s), Live Demo Walkthrough (1026.435s), Project Setup (1486.65s), Installing Dependencies (1993.975s), Installing Dependencies (2092.92s), AI Binding Setup (2199.155s), Configuration Setup (2375.925s), Backend Import Setup (2531.665s), Q&A Session (2698.8s), Bindings and Imports (2898.995s), Code Implementation Setup (3007.58s), Workspace Container Setup (3193.45s), Agent Loop Implementation (3388.655s), Debugging Docker Issues (3647.2s), Frontend Demo Setup (3989.885s), Tool Implementation (4138.445s), Tool Customization Overview (4374.12s), Demo Wrap-Up (4608.38s), Q&A and Closing (4713.21s), Closing Remarks (5054.38s)
Transcript for "Build Smarter: Why AI Agents Need Computers, Not Containers":
Hey, everyone. Welcome back. Welcome to the webinar. Super glad to have you all here. Thank you all for joining again. Also, like, please drop a message in the chat, where you're from. Right now, I'm in, like, the lovely Singapore city, which is amazing. The weather is amazing. And, yeah, I know. So today, we are actually talking about cloudflarecom computer. Hello? Okay. Sterling from California. Hey, man. How are you? That's cool. I'll share, start sharing my screen. Alright. Let me just, like, do a quick check if I'm sharing the right one. Yeah. Okay. So, hello, everyone. Welcome to another webinar. I know we have been doing these every month, and every month something new gets launched. And this month, this version two also has a very exciting new feature called Computer. I am personally very excited about it, and I just wanted to share it with all everyone else. Because ever since it was launched and I read the blog, I've been super hooked into it. So yeah. So I'm Fayaz. I work as a senior developer educator here at Cloudflare. So today, we are building something with Cloudflare computer. It's an open source runtime, but disclaimer, it's in an early preview, but I just wanted to, like, share this with everyone so that everyone will just, like, use it and build super cool, amazing things on it. So yeah. So what exactly is computer? So the promise is very simple. If you give an agent some files, a git, a shell, and a safe place for it to run code. So the idea is that the argument is basically that you don't always need a container. A container is not always necessary for the agent. So before we write any code, I just wanted to show you, like, what exact why does an agent need a computer at all? So okay. So a model can reason, it can produce text, it can think, but that does not alone give it the ability to complete a task, which is a very common use case these days given how agentic applications are. In the norm, they're all the rage. So, basically, an agent is the brain. It understands the goal, and it also chooses the next action. So and the run time also. A run time is basically its hands. It reads and edits code and then reports what changed. And one of the important part of the agent is its loop so that it can act, inspect the result, and decide again whether it needs to take an action again or no. So the obvious solution is using in container, for every single agent. But it creates a problem, which I think we did not anticipate, which was scaling. So imagine giving every single agent a new computer. So basically an agent as in, let's say you're using Cloud Code, Open Code, or Codex. Every single agent has a container of its own, which could turn out very expensive. So that's a problem. Right? So that's exactly what CloudFlare computer is trying to solve. So why exactly we don't try to give every single agent a computer? So containers are, like, very excellent. Then the work, needs Linux. If you want to, let's say, run native binaries. Let's say you want to, like, run a PDF parser that's on trust. Let's say you want to do NPM run, or NPM install or do some sort of, run some test run out like retest or just. But it's kind of an oracle if you think about it very rationally. Let's say you're trying to edit or read a file. It does not need a full blown Linux environment. So things like searching text or editing a file or managing a git repository because it's just a bunch of commands, it does not always need a full blown compute, sorry, container. And that's exactly, what we're trying to do. So starting every action in a full container, it actually spends heavier compute on for a very lightweight work. So CloudFlare has isolate, like, a very good coincidence. It feels like we are just heading towards it. And, yeah, that have this ability to start extremely quickly, and they can scale horizontally, and you can spin them as many as you want in a very cheap way. So this suggest a very different architecture. So if we keep the agent separate from the execution environment, your agent will immediately become very, very efficient. So okay. So let okay. I'll talk about, like, how exactly the computer works. Basically, the agent loop can live in a durable object, which is a very special primitive, from CloudFlare. So there, it has some identity, it has some state, and so that it can store, messages, etcetera. It has its own tool. It has its own real time capabilities, and it also persists. So if it crashes, it can start, like, right from where it started. Okay. The next step is the workspace. It sits between the agent and the execution run time. So it exposes one consistent set of files, get and execution tools. So the actual command can run-in a very fast isolate or fill Linux container. So the workspace is, like, a very key abstraction that makes these run times feel like one single computer. And that's exactly what, CloudFlare computers, does behind the scenes. So there's an agent loop, a workspace, and a runtime. And combine all of this, you have this very specially efficient way to, like, run and manage agents without, like, blowing up your bills. So okay. Let's talk a bit about our durable workspace. I just wanted to talk about computers since it's, like, very new. I want to explain how it works, before I show you the demo and what exactly we are building and how to build it as well using computer. So a workspace gives the agent, a durable object file system, which is backed by SQLite. Like, durable objects are can use either KV or SQLite. Now this computer primitive use SQLite. And then we can actually populate the durable object, workspace, from its source control. It could be cloud storage or, if you just want to, like, create the files yourself, it uses that. So we are actually using platform mix, VFS package, which is a virtual file system for node environment, which also works on workers. And once the agent gets familiar with these files, it will have tools like read, write, execute, and get commands. So this covers the git side of, operations or transactions, you could say, that the agent gets. And then every run time sees the same file. So work can move between run times without changing context, which is extremely important. And then operations can be gated and observed instead of giving the model understood access. So if you're running some sort of very, some code that you want it to be, like, in a very safe environment, these are all isolated. They're gated, so it, like, cannot randomly go ahead and read environment variables out of nowhere. So now, to do all this, we can choose the smallest run time, that can complete each, complete, each operation. Okay? The next one is the isolate. Okay. The isolate is actually, like, a very ideal for routine manipulation, get operations and data processing. By data processing, I mean, if you want to, like, find something, replace something, change files as well. And the container actually provides a complete Linux environment. Let's say you want to do npm install react, once you have, your code, you can use container for that. But if it's, like, something very simple, like, let's say, changing, some file in your workspace, that's where the isolate will come into picture. So this is what exactly what, computer is trying to do. It's not always required for the agent to use the container. Let's say, a file manipulation does not always require a container. So, if we can be, like, very smart when it comes to, building agents. Let's say you want to use some sort of rust binary. You want to use a PDF parser or PDF manipulation. We can use container for that, but the rest of the things, it can automatically and intelligently use a worker isolate. So I'll also tell you, like, how exactly this decision making happens. Basically, it's just a LLM making decisions based on how you have written your system files, etcetera, on the agent. And so both of these are by the way, both of these operate on the same workspace. So, basically, when you create a workspace, which is basically like a file system, think of it as an environment the computer is running. So it can automatically pick the worker isolate or container based on how you have written your prompts. So both they both work on the same workspace. So switching run time does not mean, copying copying your project in your workspace from worker isolate to container. It actually just uses the same workspace. So, the switching happens instantaneously, and you don't need to, like, do anything manually. So this decision making, and efficient way of using compute, It actually like, once you combine this, it creates a very fast horizontal scale. And when heavier compute is required on demand, it'll just pick a container. So the developer does not need to hard code every runtime decision. Okay. Now how exactly is the is, the agent can choose, like, let's say, isolate for, like, very mundane task, routine task, but a full container when needed. So there are actually, like, tools that describe what each, what each back end is good at. So the model can select and isolate work and a container when it needs Linux capabilities. So if it's a very lightweight option, and if it's let's say a lightweight option is very insufficient, the you can actually, like, set fallbacks as well. Let's say something does not run on the worker isolate. You can just add a fallback for it to use a container as it's retrying. So the goal is actually not to get rid of containers completely. Rather, it is to use them only when they add value. So let's say, I mean, let us make this, like, very concrete, with the application we're about to build. So I want to show you how, I mean, what exactly I'm building. I built a thing called site doctor. If you guys had joined the, agent building workshop where we wrote a PR code reviewing agent. So I took the same idea behind it, but I extended beyond it. So instead of just, like, doing a PR review, what if, it gave an agent capabilities to read a GitHub repository, follow some instructions, and then clone it. Like, literally clone, the whole repository, in a workspace. Inspect the files. I mean, literally go through every single one, edit and make changes, verify changes, and then create a report and create a get diff of the changes that the original focused in, instruction, I gave it. So let me give you a demo of what exactly I built. Okay. This is what I had built. It's called side doctor. I know it's a very cheesy name, but it is what it is. Okay. So I wrote a little application. It's just a color palette. So it just does this, generates color palette. So nothing nothing special happening over here. So I gave the URL, and it's actually open source. So if you head over not this. Let me go. It's github.com//sitedemo, doctor demo. So nothing special happening over here. It's just a simple index of HTML file. And let me open the app. Js. So it just, like, generates, some swatches, based on the, color palette that we have. Now what I want is I want to add a dark mode inside this website, application or whatever it is. So it you're not just limited to public repositories. I have happened to meet a public repository. Again, like, enhance this application, and have some sort of git authentication and include private repository as well. So, yeah, let's just do this. I have this site doctor demo, the GitHub repository that it is supposed to clone, inside the computer, and, I just gave it the live site URL as well. So my instruction is add a dark mode toggle that clearly transforms the page colors, palette framing, buttons, and footer. Keep the existing value, visual style, and remember the selected theme, across reloads. So, ideally, what I wanted to do is use either local storage or some sort of session storage or cookie or something. And if I change the top mode, it should, like, persist if I reload the page. So let's just do this. But before this, I just wanted to, like, explain how this would work in a very traditional way. So this requires a lot of things. For example, it needs the ability to run git commands. It needs a file system since we are having I mean, we want the agent to generate a diff, so that it can read the files. It can edit edit these files and also, like, save the newer version. So let's just run this and see what happens. So I've created, what all the surfaces that we are touching, over here, a live demo of how it was supposed to work. So the durable object got spawned, and it created a new computer. You can see over here what's exactly is happening. The computer is created, and it created an isolate, and it gave the agent or the computer its own unique ID. And then it created a virtual file system. Like I mentioned, we are using platform mix VFS, package to create this file system. So in the in our database, we have created a new workspace with all these files. And once it's ready, so it make so, basically, it in inspects that, it's ready behind the scenes. And you can see actually see what's happening and which computer's surface it is hitting. So, initially, while creating a computer, it was just the simp simple durable object. Then it created the file system, etcetera. And then when the cloning was happening, it's using, it switched the decision that it does not just need need a specific environment, and it switched to workers' AI. I mean, that's what the loop is doing, by the way. So the repository is cloned. It listed the files. So now it has its own virtual lightweight workspace where all of this is happening, by the way. So it's listing the files and then the isolate, ransom commands, which is exit, and it's also running its own commands. For example, exceeding into the workspace, listing down the package, Wrangler JSON file because my demo actually has Wrangler JSON file. And you can see, like, a bunch of operations are happening. So it file this is not a com container at all, by the way. All of this is happening in a very lightweight isolate, that the computer has created. So then it's editing its file as well. So like I mentioned, any file operations or data processing that's the work of an isolate, it does not need a container at all. So this way, you're never hitting a container at all, which means, you have a very efficient a very efficient and intelligent tool system given to your agent. So it wrote some files. It actually generates somebody as well. I'll I'll show you that too. It wrote some files. It edited the app dot g s, which you'll find over here, which is actually just a forge. And the editing file completed, it updated the HTML file because, I mean, since the toggle button needs some markup. And once the file, completed, it's running its own sandbox command. Okay? Again, it took the LLM took the decision that it does not need a container to, like, check something. So no check public slash app dot j s. All of this will is possible in the isolated cell. So that's what it get got picked. So a bunch of commands. And once it identified that whatever instruction I had given originally, add a dark mode toggle, it completed the loop, and it generated a patch. So, basically, I did not want it to run the git push itself. I just wanted it to create a diff. That's what. So but first, I actually asked it to, like, generate a report because I have this in the, system prompt. So it said that I understand the site. It's a very small static site called palette pocket, color tool, and it has a bunch of files, which is, like, which is, like, basically a web dev like, website. HTML, CSS, and JavaScript files are static asset. And they are served from Cloudflare. I because it detected that we're using the Wrangler file, and it automatically knew what's happening. And then it took the decision, I mean, the LLM, that we have used the model, that we are adding a theme toggle, and it's using local storage. I was, thinking that it might use a cookie, but local storage is still fine. I mean, it gets the job done. And then in line in its script, so CSS variable for both themes and a style toggle button. So it realized that it needs to edit all three files. HTML says in JavaScript, the local storage part is happening on the JavaScript file. The CSS variables, which is the dot CSS file that's being edited, and the markup for the button. So it verified that the files look good and the syntax is fine. And since no no run time is available in this sandbox, it just did the NPM run check script cannot run. Let's do the static verification instead. And once it did all of this, so it generated its own summary and generated all the files that need change. Okay. So it created a bunch of things, and then it created the notes for this is this is basically a report I just asked it to generate, what you are doing and what is, what the diff will be. Okay. Let's see what the diff, changes, it mentioned. By the way, this is, this diff is actually an open source package called defs.com from this company called DPA Computer Company, an amazing open source project. I love their product. Check them out as well. So this is the diff, that I mean, the code that it generated. I mean, I specifically had instructed it to not, run the git push command. But, yeah, it did exactly what I wanted it to do. So it added a root document dot create element, and then it added an event listener and, basically, a bunch of, the manipulation logic. And the markup is over here, which is, which is good enough for me, and then it has a script to switch, basically, an inline script and the CSS variable that it mentioned, it updated. And this looks good enough for me. And, yeah, this is exactly, what I wanted it to build. So since there's, like, a bunch of things happening, which usually require a Linux or a Unix file system, Git management system, a workspace, and environment for it to, like, generate and edit the code. Usually, this would have required a container, but since we are using computer, from CloudFlare, it made these decisions. So now we have maybe one tenth of the compute required to do something like this. By the way, this application is also open source. If you head over to the doc side on your Goldcast page, there's a doc tab. If you can if you click on it, you have three links to, this project. This project, this slide, as well as the the launch article for Cloudplay Computer. Make sure to check them out. Reading that article actually gave me an idea to build this little application for myself. So, yeah, this is, something that has experimenting with, and, yeah, this is what I wanted to show how exactly to build. So okay. Let's start building this now. Let me head back to my Goldcast screen and switch the screen. I will open up my terminal. Okay. Let me open this let me just open up my code editor and let's see that. Okay. Yeah. It's finally open. Okay. Alright. Let's do some test. Okay. Let me also zoom in. Sorry. The font is way too small. I just like using a small font. So I have a little what do you call scratch pad in my computer? I'll just create a new part. Let's let's start by creating a new project, actually. So, but before we begin, I just want, there are, like, a free prerequisite, for you to create this little application. So one is, running, the container locally will require Docker, so make sure you have installed Docker. I personally like using Orb Stack. It's a lightweight version of Docker application, if you want to try that out. It's also open source. So yeah. I mean, whatever you prefer, please use that. Also make sure you have created a new CloudFlare, dashboard account since, there are a few things the application is using. For example, I'm using workers AI, for using the LLM. So I'm actually using the deep seek, before Flash model. And since, it's a remote resource, we need we'll need, you to log in to that we'll need, you to log in to your account. So once you are I mean, once you have created your account, make sure you have, installed Wrangler CLI. It's the CLI we CloudFlare gives you to access your CloudFlare resources, from your terminal. And okay. Let's start, beginning. Act okay. Let's oh, okay. Let's use PNPM create, CloudFlare at latest. I mean, I actually have a little note written myself so that I don't miss things. Let me just do that. Okay. P n p m eight cloud. This is actually a CLI. We truly we have to scaffold new project. Cloud player at latest, and I'll just do CF computer workshop. And okay. We need to pass in a flag. The framework will use React and read. Okay. Let's do React. And okay. A variant, we'll obviously use TypeScript. LLMs love using TypeScript. I'll just use ESLint, and it scaffolds a few things. I'll show, like, each and every single file that it generates. So, basically, it's a vite application that uses CloudFlare, plug in. So the application gets deployed, built, and run on the CloudFlare worker run time. So it, scaffolded a bunch of things. The packet dot JSON, a Wrangler configuration file, a Wrangler file. Wrangler is basically the config for using resources and running an application on CloudFlare workers. Do you want to use Git? Yes. You want to deploy your application? Nope. I'm I guess we can deploy later. Let's, head over to the directory we just created, CD, which is fine. I'll just open this window, and let me switch back to that window. Okay. Hopefully, this is visible now. I'm using Windsor. This is the editor of my choice. Please use whatever I please use your editor of choice. Okay. I think I opened some wrong folder. Okay. Let me open it up again. Okay. I found WinSurf. Okay. Hopefully, this is visible now. So okay. I'll just quickly give you a run through of what exactly what are the files that we generated. K. Let me just put put this on-site. I'll also zoom in again. Okay. First up, the Wrangler dot JSON file. So, basically, this is just, the first starting point of a CloudFlare worker. I'll just remove this comment. Wrangler dot JSON c file has all the bindings. So if you have worked with cloud, on CloudFlare before, the Wrangler file will have bindings. Bindings are a concept which lets you use resources from your own CloudFlare account. So, let's say you want to use Workers' AI. You don't need to, like, pass an API keys. Rather, you just pass a namespace. Worker will know, CloudFlare will know that you're trying to access Workers' AI from your own file own account since it's the own, the same, environment. So the binding will get resolved to that resource. So, yeah, I think that's the best way to explain, this. Alright. So this is the, JSON, c file, and it has worker configuration. This these are just like types. We have a weak config which uses the CloudFlare plug in, weak plug in. And so this is just a simple React application, to be honest. There's nothing much happening over here. So if you head over to app.tsx, a little TypeScript page, so this is the basic React scaffold, that we get. But there's one, file which you don't usually get if you scaffold the plain React application, which is this worker folder. This is where you can write your back end code. So right now, this is a simple API endpoint of sorts, and it's just returning name equals Cloudflare. Nothing special happened over here. So what I'll do is I'll start editing these files, and I'll also start explaining them one by one. I might not have time to build the exact same fancy UI my agent built, but we'll build a very minimal functional version of the demo that I just did. Okay. Let me, open up my note. And okay. But before we start, we'll need a bunch of things. I'll just, like, keep this on this side. Now I'm just, like, cleaning up my windows. The p n p m create, scaffold actually, like, installed the dependencies. Sorry. Let me you can see the node models are already there. So let's add a few packages. Pin pin add at cloud player slash computer at cloud player slash think. So think is basically, an enhanced version of CloudFlare agents SDK. If you have used agents SDK I mean, I love agents SDK. For those who don't have used agents SDK, it's basically a library or basically an SDK to build agents. So it gives you a bunch of abstractions, and it's open source, by the way. So it will run right inside CloudFlare workers, and it's built on top of durable objects. So you can have things like tool calling, system prompt, chat, etcetera. So you don't need to, like, pipe like, pipe through all of this. So if you have built an agent from scratch, like the olden days, you know what I might be talking about. So, I mean, it requires a lot of plumbing, to do. Okay. So thing is basically, agent's SDK with a few new fee like, lots of new features. So, yeah, we'll need, we'll use think, and we'll also use platformatic. Sorry. Platformmatic slash v f s. Platformmatic is a community not community. I guess they're, a company which builds a lot of Node. Js JavaScript environment tools. And we have VFS. We also need the agents SDK, and we'll need the AI SDK from Versal, and we'll use Sol for type validation. Let's install these. So we installed Cloudflare computer, Cloudflare slash think, platformatic slash VFS, agents SDK, AI SDK, and so on. So all of this plumbed together will get our own little computer. I'll clear this, and let's start off with for angular or JSON files. So what we need to do is when you start me, we need to save all the I mean, basically, write the configuration of all the CloudFlare resources that we need. I have the list over here. Okay. Asset. Since this is a worker API, I just want to add run worker first so that the, slash API will be a separate route and not linked to the single page application. Okay. Observability, true, which is fine. Next up, we need an AI binding. So if you want to use workers' AI, you know you don't need to, like, create an API key then make rest API request to that. I mean, you are free to do that, but since this is a CloudFlare worker that's being deployed on CloudFlare's, developer platform, all we have to do is just write AI. That's basically an object. We'll need to pass in binding. So binding is basically a namespace. So if you want to use AI, all you have to do is e n v dot a I dot run and pass in the model. It'll automatically know that you're trying to use a CloudFlare resource, and you you have used the name binding. Actually, you can, like, name this anything, like AI model or something, which is also possible. Then we'll need to use remote equals true since, workers AI needs this. I mean, since the LLMs are basically hosted in workers' AI, we'll need to enable the remote bind remote client. And then we'll need a container. I mean, since our compute a computer requires a container to run. We'll add in class name. I'll just do site doctor agent. We'll also need to pass in the doctor image file, dot slash doctor file. And we also need to pass in max instances. I'll just set it to five. Sorry. This needs to be an object. That's why the editor is doing and type error. This should be max instances. Let me format this and figure. So, max instances is basically, you can add a limit to how many containers your application or project can spawn. I I mean, just for the demo purposes, I've set it to five, and the Dockerfile, image, that needs and a class name, basically, a name for you to reference while building the application. Now let's head over to a file and create a new Docker file. Actually, I have it written right over here. Let me just space this. There's not much in the Docker file. It's actually quite simple. Just do power and word wrap. So the computer, the worker run time, that's being imported, and we just, like, run this on port eighty eighty. So like I mentioned, not a lot of things happening. It's a very simple Docker file. Let's save this. Hit save. We also need a durable object. Do doable object bindings. Let's name it as site doctor agent. So this needs to be a object two. And okay. We need to also pass in a class name. Let's also just name it as site operation. Let's keep it simple and not complicate this. Okay. Let's format this. This should, this should suffice. Okay. Wait. I also need missed one thing. We need to provide a way for it to use migrations. I actually have this written right here. So, it's just, I mean, telling the durable object where exactly the migrations will live. So, yeah, that's pretty much it. And, we needed AI, an LLM for the computer to take decisions, generate code. I mean, my application needed, LLM. We needed containers, which is good. We also needed a durable object since that's where the workspace will live. And we have all the resources we required in the Angular JSON file. Now, okay, let's head over to the worker. Okay. I will okay. I'll I'll just like so, basically, from the Wrangler file, the AI binding runs the AI, model on workers' AI. The site doctor agent is basically a durable object backed by SQLite, And the container has its own I mean, the container is required because we need NPM, Git, and native Linux tools, I mean, if required. And both of these run times, the container and the durable object, they that will work in the same workspace. The workspace is basically, a feature that our com computer SDK provides. So, yeah, that's pretty much, it. Okay. Now coming back to the back end, I just cleared the file here, which the scaffold generated. So I can actually write it down. I don't think okay. Let's just, like, write, let me import some things from computer. At computer okay. You also need workspace proxy. Okay. That's just a type error, which is fine. Actually, let's also import types. I mean, audio, little object storage like okay. And we also need to import type. I think it's called think workspace. Yeah. Let me download this. And I'll also, like, hide the sidebar just so the entire thing is visible. Okay. We needed, types, workspace, workspace proxy. And okay. Let's start importing the containers. So we need a cloud player from that computer slash oh, sorry. Slash computer slash back ends. Why does it not resolve? Let me check if the package install at cloud player slash computer. Cloud flare. Okay. We need a container back end and cloud flare. Container back end. I will explain what all of these do, in a bit. But workspace, these are some very long names. I'm just, like, making sure they're correct. Container. By the way, if you have any questions, please drop them in the chat. I'll make sure I answer them. Since I only have one monitor, I'm not able to look at the Gold Coast track. But, yeah, actually, let's take a look. Actually, like, let me see if there are any questions. So someone says I need a computer. Okay. That's exactly what we are trying to build. Kevin, hopefully, you'll have a computer at the end. Okay. Also, we have my friend, Ataula, joining, in the who is in the chat. Amen. Okay. There are a few questions. So which, one is from Sterling. Which LLM model was used, and where was it defined in the demo example? So I actually used DeepSeq v four, but if there like, whatever compatible LLM, you can even bring in your own model so you're not limited to just, like, one specific model or something. So I I personally use DeepSeq v four. Hopefully, that answers. So workers.ai actually has, like, an insane amount of model right now. There's also the new GLM 5.3. You you should check it out, which was ox alpha, which was trending a lot on social media, because it was a stealth model which everyone was talking. So that's also available on, Cloud AI, sorry, workers' AI. See okay. I hope, hope that answered Sterling's questions. Then we have Avnish. Say, if I want to access a private repos in my org, can workspace provide some it makes man there. Variable secure storage to hold circular plan for you to use in the isolator container. Yes. Actually, like, so anything that you want to use, you're not just limited. So computer is actually providing you very low level primitives, to be honest, and not trying to force you or opinionate you with, a lot of restrictions. I think that it's my that's how I would answer your questions, of Nish. So if you mean, some variables okay. Let me read your question again. If I want to access private repos in my org, can workspace provide some variables against threshold? Yes. Definitely. If you're using some sort of environment variables, you can just, like, use your own container. Since it's sandboxed, I don't, like, they won't be leaked outside to the agent. So yeah. And then we have, can you please talk about CF worker isolated in comparison with firecracker? Honestly, I am not educated or aware about firecracker. Let me actually, like, do what exactly is firecracker. Oh, VM. Okay. It's a virtualization tech for building containers. Okay. I need to, like, learn a bit more about this. I'll I'll try to, like, I mean, get some information. And if possible, I might, post on social media whatever I find, about your question, Avnish. Okay. Sterling also has yes. I have another question. I see you define the import index dot t s. I think about a process to have done automatically when you're defining the bindings in Daniela. The imports are basically, me trying to I mean, it's just like code, I mean, APIs that I I want to use from the SDK. So, the computer SDK has lots of abstractions, so that's all the, imports are, but it's rolling. The bindings are for CloudFlare resources, not the SDK. So they're, like, limited set of bindings, but, you're not just limited to the bindings CloudFlare provides. If for some reason you want to use your own binding, let's say you want to create an abstraction of computer SDK, your, there's something called service binding, which CloudFlip provides, and it's actually very easy. So let's say, you create a binding specifically with all these imports and all the code. You can just create a binding for this and use it in your own application. That's also very possible. Okay. Those are sterling questions. By the way, like, keep bringing in these questions. Let's keep, this engaging. Love all the questions, by the way. Okay. Avnish, let me know, man, if my answer is not sufficient. I'll I'll try to, like, explain it a bit more. Okay. Let's head back to our back end. Actually okay. Like, since no one is writing code anymore, what I can do is I'll just import all of this stuff myself because that's, like, a lot of imports that I'm trying to do. Okay. Sorry. Okay. Ignore the, type errors. I'll I mean, once we have all the code, it'll stop shouting at me, hopefully. Okay. We have the types that I was trying to import, the workspace and the workspace proxy. We have Cloudflare container back end with workspace container. Yeah. It is being imported. The right package is being imported. CloudFlare computer also provides a Git client of its own, a very lightweight, Git system. And the thing which provides the loop for the agent, And then we have agent get by name. And I also want to export something. The workspace proxy. Okay. Let's bring in model, which is what Sterling was asking. Model equals. So there are, like there's, like, a specific name identifier, for this, which you'll find in workers AI model. So if you, like, Google CF workers AI models yeah. I'll I'll just paste this link in the chat as well. So, yeah, if you open this, you'll get a list of all the AI models, worker AI worker's AI catalog provides. So let me open this back up. So I'll copy the first one, from the workers' AI catalog. Sorry. Not the first one. I'll just use the and deep seek before Flash. Okay. We have our model. Then I'll also, like, write some types, which is basically my tools that I have. One is improve request and improve the result. So I'll I'll tell you, like, what exactly these methods. Now let's start, like, writing all the methods. Actually, like, I probably can just, like, paste the code, from the demo that I have. So it doesn't I mean, I don't go overboard the time. It just won't, like, rip make sure I, like, finish this, and we have a working, demo till the end. We have a site doctor base, which is not doing anything right now, but we'll update it. And then we have the site doctor agent, which is basically the durable agent, object that we have. So okay. Coming back to it, I'll I'll explain this one bit by bit. So we have our import. So the file has, like, three, like, three layers. One is the think, agent loop, and the CloudFlare computer provides a back end and a container, which we'll use for Git and, any sort of NPM related operations that we want to do. And then we have workspace and workspace proxy. So the container can actually access all the file system, or basically the workspace. So if it's using an isolate on the same workspace will be workspace is basically like an environment where the file system lives. Then we have, the durable object. So our agent requires think, which is the agent's SDK enhancement, and then the with container sorry. With workspace container, it adds a Linux container as an execution option. I think that's the best way I can, explain this. So, basically, giving our durable object, container capabilities. And, max steps, if you have used, Wersel CI SDK, so, basically, like, how many steps do you want to, like, run the loop? Right now, I'm just setting it to max. And then we are okay. Yeah. Basically, we are, like, creating a new workspace, and we are giving it a storage back end, which is our back end that you find here in the Cloudflare container back end. And then egress, it's an option to, like, enhance the back end. And then we created a workspace, like I mentioned. It has tools like create get client. It uses thing equals true, which means, the agent loop gets added to our, computer, environment. And then I have a system prompt. So I have, like, kept it, like, very simple. You are a side doctor, a careful engineer working in slash workspace slash repo. By the way, for reference, this workspace is provided by computer, and this is where the file system lives. Let's say the container get cloned something. It'll live in slash workspace slash repo. And I'm telling it to, like, inspect the repository and make one focus change. So maybe I've, like, like, or thought this and this written focus change. Doesn't have to be. And it'll verify it, and it'll use the file tools. The file tools, you will you'll see it over here somewhere. I've written. Okay. I mean, should be somewhere here. I'll I'll, come to it. File tools, for reading and editing, and we'll use bash for NPM, get or checking, some checking basically do an NPM check. So as specifically I'm specifically telling it to not to commit push or act secret, change any unnecessary or unrelated code. And then it'll generate me a summary. So if you saw the demo, it actually generated a summary slash report of all the things that it did, and it generated a diff. And, basically, that's it. The fetch is, I believe it will make a request to improve request, and, there's also an improved response, I believe. Let me let me try to find this. So yeah. Improve result. So it has, like, two, methods, which is improve request and improve result. And so whenever, I it receives basically, these are endpoints that I'm trying to expose to my front end. So whenever I say send a prompting, create, add a new feature, this is where it'll hit. Once you do that, it actually, like, picks up the repository that I'm like, the color palette open source repository that I, gave as a URL. You can find it over here. So input dot URL and the directory where it is supposed to clone. So you can actually, like, change it to repo. Let me even change it to, like, test. So just make sure you use, slash test. So this is where your repository will be cloned. And all the messages will be saved over here. So, basically, this is all the durable object messages that happen, within. Okay. And I believe that's it. The spaces agent's computer, we talked about, the container. And sorry. Let me go back to the workspace bit. I have, like, written a bunch of notes, actually, so I don't derail or, explain anything unnecessary. So yeah. I mean, we gave like, the workspace is the agent's back I mean, computer. It contain, like I mean, it has its own durable file system, and it I mean, we extended it with a container, and the agent can, like, perform very lightweight, file operations, in the isolate that we just created. And whenever required, let's say it needs NPM or Linux tools, it can use a container. And, coming back to, the agent loop, so, yeah, this is what I was mentioning, the improved result and the messages. So whenever we pass in, URL, we will clone, the repository in slash works workspace slash repo, and then the model can actually, like, inspect. So this is exactly where the inspection happens. So let's say it wants to read, files, inspect files, edit code, run, like, some sort of verifications commands like NPM view or NPM check. All of this happens over here. And after the agent finishes, we base we are basically asking Git for the actual diff, that it generated. So whatever, tools that you run, for example, like, edit, read, execute, etcetera. And then we, like, ask it to generate a summary and then create a diff. This is where the get, diff is generated. Let me show you that quickly. Get dot diff. Yeah. Whenever the improved result, API is hit, create the workspace, clone it, and return us the workspace. This is base these are methods exported by our, CloudFlare computers workspace, class. And if, for some reason, it fails I mean, the run fails, they finally will catch this, and you'll see I mean, the agent is, the loop just gets closed. And okay. Let's go back to our worker. So all we are doing is slash improve. Okay. This is basic worker stuff, by the way. This has nothing to do with the computer. So this is where the API, that I wrote is getting exposed. So it's a post method, and I'm so I'll we'll build a front end that has that'll hit I mean, the formal hit slash API slash improve, and it'll accept, some instructions, browser URL, and as well as the GitHub repository, basically. So I have I'm using a validate input, from Zorn, and then we gave the agent. We created an agent saying, get agent by name, nv.sitedoctor agent. So if you remember the Wrangler file, site doctor agent is over here. So this is the agent name. And then we are passing a unique identifier whenever we want it to run git commands or do the in whatever instructions we just mentioned. Once it does that so it actually runs an internal job, which will do whatever we just asked it. So Yeah. Okay. So, basically, the worker is just forwarding the task, through the durable object binding. And and the agent finishes, it reports, and generates a report. Get if is returned as JSON, and that's what I was just, like, showing in in the UI. The validate is just like, the validate input is, validating my, body request. So, yeah, this is basically it. It's a very minimal version of the, agent, the demo that I just showed you. So, yeah, this is pretty much it, and let's head back to our app.tsx. I believe this has all the Okay. I think there's something wrong with the Docker file name I just mentioned. D o c k e r f I l e. Oh, okay. Let me run this again. Okay. Something's wrong. It needs to include a tag. This looks right. Let me copy this again from the original demo, actually. Okay. Some things we are doing here. Remind the right parts. Okay. Worker. I'm just making sure there's nothing wrong with the dependencies and hopefully strengths. Okay. Not surprising. There should be some or validity major is required if this okay. I mean, it looks fine. Maybe I've missed something. Do you see what I actually, let me just open up the original demo file once. Okay. So slash index dot c and zero object site doctor h h h. But that's very odd because, my Docker is running as well. There's no containers running, though. Docker application is open too. Okay. Okay. I I I guess I can, like, show you the let me actually try running the original demo, okay, which interestingly enough is running. And it's on maybe the okay. Everything looks, perfect. I'm not sure what's happening. But yeah. I mean, the original demo that I built is still working, which apparently is exact the exact same Docker file that I'm copying. Yeah. No problem. Let's, I'll I'll still explain, these things, and we'll use the existing demo and we'll run it, on our own. So okay. The Wrangler file, we got the Docker file over here, and we also have the worker back end ready. So I actually had built a very single simple front end, for our React page. Let me let me paste it over here. Not doing much. I think you'll understand, like, so, like, just looking at it once. Like, I didn't try to add too much into that. I'll just, like, replace all the lower stuff. So okay. Time for me. And so improved result, this is what the API my API is trying to hit. We have some use state variables, etcetera. And so it's a basic form data event, and it takes three things. Sorry. So it basically takes three things. One is the repository URL, the goal, and also the, live URL. So the live URL was actually an enhancement that I am trying to add. So whatever changes it makes, I want it to eventually show me a preview of whatever the changes it did, using and by running the application locally. So, hopefully, I'll add that in the future, but for now, it just takes in the repository URL. And the goal the goal is basically an instruction that I just showcased for you. And that's it. So whenever you hit submit, it actually, like, heads over to slash API slash improve. And, yeah, this is where the computer stuff hap starts happening. So get agent by name, it creates a new durable object. So, I mean, gives it the durable object, binding, and that's pretty much it. You all we have to do is just run the agent. Okay. I'll show you the actual, demo that I had built. I'll go over and change. Okay. Sterling is telling is there the error the doc directory location of the rock file. Actually, I just, like, mentioned you know what? Let me check, actually. No. It's it's honestly, like, just I mean, right. Maybe I named it wrong. No. It's right. This is okay. I'll just switch over the screen to my other demo. This is the original I mean, it had a lot of front end CSS UI happening. So I just, like, tried not to, I mean, write code for all of that, but, the Docker file remains the same. You can see over here, like, imports, the computer, the run time. And if you look at the Wrangler file, so it just, like, hitting the Docker file whenever a new container is required. So, yeah, that's pretty I mean, it's pretty similar to the one that we are writing. And if we head over to the back end that we just did sorry. Okay. I have, like, written it a bit I mean, the files are, like, in a different locations, but it's still, the same, thing. So the improve actually, the same thing that we're doing over there. We created a new durable object, passed it the agent name, and the, random unique identifier, that's there. And this basically, like, tells the worker to run this and computer validate input the same set of files that we had written. And I also had, like, a few checks, since my application was not handling private repositories. I just used east public GitHub URL. So and, basically, if it's able to access the file, it means it's, public. And okay. These are the tools that we have. So I'll I'll show you all the tools that we wrote. So if the back end, tool name is execute, we'll use a back end for it, basically, a container of sorts. So, by execute, I mean, like, any sort of shell commands that it has. But it if it has some sort of, isolate as required, it will just use that. And if bash is needed, then again, an isolate if, a fallback is just a file system. And okay. Tool title. So, basically, a bunch of, file tool I mean, all the tools that we require to run, this little application. We have execute command, the bash commands, and delete, a file. Grep is basically for searching files. We're not using this right now, but yeah. Finding files, list, LS, edit, write, and read. So these are all the tools that we had. And, yeah, there's, like, a bunch of things, in this. You can, like, check it out since the repository is open source. Okay. I just want to show you, like, where the tools are being called. Let me okay. Yeah. Like I mentioned, there's a lot of UIs of that was happening. You can see over here. So whenever a new action that the computer took as just, like, pasting it in the UI using a real time file system, so this is where most of The US stuff that you see that was happening. For example, if the repository was cloned, you can see it, in the demo that I just showed you. So the fetch is like something else. Before tool call and after tool calls are basically the agent SDK methods that we have. I just want to quickly show you tools. Surface. Slash API slash approve. This is the method that I had written, and not this. Yeah. Okay. I mean, think has, like, a different format. I mean, pretty used to, like, agencies to give it, so I missed this. But yeah. So think is basically, like, picking all the tools that we have over here, and whatever, tool details that you provide, you can actually look at it over here. So I just wanted to show you how you can override. So let's say you you're not limited to just using a single, isolate. I mean, you can still override, whatever computer action that the thing is using. So just wanted to show you that. But Okay. Yeah. This is basically, I mean, since a thing has, like, a very different, decorator for my I mean, format, so it's actually using this decorator called emit. So all the models that you are seeing, agent loop started, if it wants to use file red. Yeah. Okay. Let's say the I mean, whenever a repository is cloned, you can actually pass in all the tool descriptions over here. So this is exactly what I was trying to, mention. So so let's say you want to, like, rip I mean, clone a repository grid object, and working trace all in a virtual file. This is how you provide descriptions for all the tools that, we have. You are not just limited to this. If in case you want to use some sort of override, you can actually do that as well. But, yeah, basically, this is how I build this, little computer, application. But, like, computer is still in very early preview. There might be, like, API changes, without, I mean, it so it might break. So keep an eye out on updates for all of the changes that are happening. So, yeah, hopefully, this gives you I hope the demo had worked a little better because there's some issue with my Docker file. I'm not sure what's happening. But, yeah, hopefully, this gives you an idea of how the computer, works. So, yeah, let me just show you, like, the tools that we were using. So since think has, like, a very different format so you're seeing that the sandbox completed. These are actually, like, very single, tools, we provided to agent think. And the report that it generated and the diff that you got out of it, These are all actually, like, same, like, single use tools that the application is using. And all of these, this demo, this the slide, they're all actually public. So if you want to use the demo app, I have opened the let me actually zoom this in a bit. Okay. So you have the link to the demo app, which is, again, a GitHub repository you can just I've also, like, posted links to my socials, in case if you want to, like, ping me regarding this. And if any questions that I might have missed, I'll try to, like, answer them, by reading a bit more about it. Yeah. This this is it, pretty much. So okay. Yeah. Okay. I mean, please, like, throw in whatever questions that you have. I'll I'll try to answer all of them. There are, like, a few more questions from, Sterling. Okay. Out of scope this discussion, but I saw a post from you about context and skills library. Where are those we would those be added in the demo if you have time? Actually, like, I mean, there there are a few things being worked by the agents SDK and think team to import skills dynamically. So you just, like, pass in a URL, and it'll automatically load, whatever, whatever skill that you have. And it's not just limited to the skills from, skills.sh repository. So if you have some sort of, git repository, that you want to mirror inside your agent, that's also possible. So, yeah, you can use those. And another question hopefully, that answers your questions. The another question is, so computer is a lightweight, lighter weight, which is why it's a first thing in work before deciding another container resource. Yes. Basically, that's the whole idea, Sterling. So whenever the tool is being executed, think we'll provide it a bunch of tools. So if the LLM decides based on whatever, system prompt or tool description that you have written, if it thinks this is possible with an isolate, it will just use the isolate instead of the container. So that's how the idea of making agents efficient, came through. Now we have Rinkesh, Mauri, asking question on I have an Ubuntu based AI operating systems called titles dot aias, which I mean, it's system file applications, files, notifications, and otherwise what do you think is the best architecture for me? So Rinkesh is asking, like, what is the best architecture for giving AI agents safe, persistent access to a computer environment while still maintaining strong security user control? So, the goal with CloudFlare computer was not to replace containers, like I mentioned earlier. So the whole argument was just for very simpler tasks. You don't need a computer since running a container twenty four seven can cost you a lot. And if you give a new container to every single agent, that will spin up and 10 x your, compute requirement overnight. So this is how, like, like, if it's something simple, like reading a file, which JavaScript I mean, worker isolates are, like, very capable at. This is where, computer shines, actually. But, like, I mean, I think your question was more on, like, making them strong security and user control focused. So it actually, like, comes down to how you sandbox your agent. So create a virtual file system, I'd suggest, and only make sure the code runs all there, and there's no entry leak or memory leak happening within the container and your own, I mean, your own local machine wherever the agent is running. Okay. If there are more questions, like, please, please let me know. And, also, like, since it's, like, a very early preview, I'd love to, like, get some feedback as well that I can pass on to the team, since the team that works, I know them, like, very personally on computer, and I'll I'll be able to, like, pass them on, like, on just directly by DMing them. So that's also possible. And okay. There there might be a few questions I might have missed. Let me check. And that's no. I think, like, we answered most of them. We also have a few chat. Oh, it's, it's the same question from. But, yes, guys, like, thank you for please, let me know if you have more questions. There's also a survey that you have, like, that you can take. Please do that, for improvement, for feedback. Let us know. Like, we'll try to, like, improve more of this. And, also, like, if you have any feedback on topics that you want to learn from CloudFlare from us, do that as well. Drop them in the chat. I'll make sure I take them into account and, like, create and create new virtual workshops and try to, like, host and more. Yeah. Thank you, guys. We are eight minutes early. And if you still have any questions, I'll still be here. Let me know. I'll I'll drop. Not just related to computers, like, anything related to any CloudFlare primitives or CloudFlare products or services. To the best of my scope, I'll try to answer them. Thank you. Thanks, man. Thanks, Sterling. Thanks, guys. I know the demo gods were not in my favor while I mean, there are some issue with the docker, but the original demo that I built, it worked in a very similar way. I just, like, added a lot of UI features to make it look pretty. Yeah. Alright. Thank you, everyone. I'll I'll see you on the next one. See you.