Claude in the Box - Use Anthropic Agent SDK in a Sandbox
Chapters11
An introduction to running a coding agent as an agent with code and the option to host it yourself using Anthropic.
Cloudflare Developers demonstrates running an Anthropic Agent SDK inside a Cloudflare Sandbox to host autonomous agents that fetch, analyze, and review tutorials locally.
Summary
Cloudflare Developers’ showcase centers on running an Anthropic Agent SDK as a self-hosted agent inside a Cloudflare sandbox. The host explains how to host the agent, what a sandbox provides, and why hosting locally enables autonomous execution with minimal friction. The demo walks through wiring in environment variables like the Anthropic API key and Cloudflare account tokens, then spinning up a sandbox workspace and checking out a repo. The core idea is to use Anthropic’s new skills feature to teach the agent to fetch a tutorial, convert a page to markdown, and evaluate the content with a custom checker. We see the code flow: create or reuse a sandbox, pull the repo URL, install dependencies with npm, and start the agent so it streams its output. The speaker highlights the power of skills by describing a custom markdown-fetch tool and a tutorial-checker, which operate on the fetched content to produce a review. Finally, the workflow is demonstrated end-to-end, with the agent writing the review to the console and storing results in Cloudflare KV for easy access. It ends with a call to experiment further—imagine spinning up a sandbox to run QA steps on tutorials in a loop. Overall, the video blends practical setup with a glimpse of future automation workflows using Anthropic in a sandboxed environment.
Key Takeaways
- Cloudflare Sandbox can host an Anthropic Agent SDK, enabling autonomous agent execution locally via Docker.
- You must supply an Anthropic API key and a Cloudflare account ID and API token to run the sandboxed agent.
- The demo uses Hono for streaming text, showing the agent’s output as it runs in real time.
- Skills in Anthropic enable bespoke behaviors; the agent uses a markdown-fetch skill and a tutorial-checker to process pages.
- The workflow includes fetching a tutorial URL, converting it to Markdown, analyzing it with the checker, and storing results in KV.
- The setup involves npm install, npm start, and streaming the URL path through the sandboxed agent for end-to-end execution.
- The speaker envisions QA automation by spinning up multiple sandboxes to run tutorial steps and validate outcomes.
Who Is This For?
Developers curious about hosting autonomous agents locally with Anthropic’s SDK, especially those exploring sandboxed QA pipelines and custom skills. Ideal for Cloudflare users and frontend/backend engineers integrating agent-driven reviews into their tooling.
Notable Quotes
"What if I could feed an agent a tutorial and have it review everything for me?"
—Setting up the core idea of the demo: an agent that autonomously reviews content.
"You can run it as an agent with code. And the best part, you can host it yourself."
—Emphasizing the self-hosted, code-driven agent capability.
"A sandbox is able to read files. So, I’m going to read the file and then I stored it up in KV."
—Demonstrating sandbox file access and KV storage to persist results.
"Isn't that cool? Imagine the QA possibilities."
—Encore on future automation use cases enabled by sandboxed agents.
Questions This Video Answers
- How do you run an Anthropic Agent SDK inside a Cloudflare Sandbox?
- What are Anthropic skills and how do you implement a markdown fetch and a tutorial checker?
- Can I store agent results in Cloudflare KV and stream output in real time?
- What steps are required to set up environment variables for running a sandboxed agent?
- How could sandboxed agents be used for automated QA of tutorials and docs?
Anthropic Agent SDKCloudflare SandboxHonoDockernpmmarkdown fetchtutorial checkerskills (Anthropic)KV storeQA automation
Full Transcript
Hey everyone, I want to show you something super cool that I've been playing around with. Now, I know we all love our coding agents. It just kind of goes off and does stuff, right? It asks when it needs permission and it has all the access to those lower level things like reading and writing files and all sorts of shell commands. Did you know that Anthropic lets you run that yourself? Well, guess what? You can run it as an agent with code. And the best part, you can host it yourself. Here, let me pull the docs up real quick.
So, I'll link these in the description as well. Uh, this is how you host the agent SDK. And what you need is you need to have a sandbox, right? And so, if in case you missed it, uh, we have one. We have a Cloudflare sandbox. It's awesome. Uh, also links in the notes here. Uh, and that means that you can run your agent autonomously, no sweat. And I'm sure like all of you, writing code isn't the only thing that you do, right? I make tutorials and I make videos like this one and I would love to kind of have that same sort of agent, right?
Help me out. There's always stuff that slips through the cracks. Maybe it's missing links or it's unclear steps, whatever you name it. So, I had this shower thought. What if I could feed an agent a tutorial and have it review everything for me? And this is that thought. Now, this is totally work in progress, but aren't we all? I'm running locally. Uh, which is awesome because I can iterate on this quickly conceptually. So, what I'm going to do is I'm going to toss it a URL. Let's see. Uh, here's the AI search tutorial and I'm going to click check tutorial.
And you'll see that it says starting the claw in the box. It already has gone and got a sandbox. I'm again running this locally. So, it's using Docker and it's going to go get a repo and it's checking that out. And I made the pattern pretty extensible because I am pretty sure that I'm going to be using this a lot. So, while this is cooking, let me show you some code. So in here we will see that we go and just get the sandbox, right? So we have this get sandbox. It's coming from this Cloudflare sandbox.
I get the sandbox. I'm giving it a unique name. I don't I don't need to uh I can name it name it something but the name is unique to it. So I can get a hold of this sandbox later uh if I need it. I'm going to store that sandbox uh locally because I'm going to use it. And uh I with that sandbox I pass across environment variables, right? So I need to have my anthropic API key. I need to have a Cloudflare account ID and API token. I'll show you why that is here in a second. Uh, and so I'm using Hono.
I'm using the awesome Hono library and I'm doing this stream text. So what I'm doing is I'm streaming out. You saw those lines were coming out one by one. Uh, I am saying what it is. Uh, each one of these sandboxes have a a work a workspace and I'm just making sure if it exists. I don't want to overwrite it in case something was there. Uh, and then I just do this get checkout. Right? So I'm checking out this repo URL. Now, I want to show you what that repo URL looks like. And I'm telling it to go to that cloud agent directory.
So, uh, and then actually, let's just go a little bit further. Uh, I I go I get in there, I do this npm install, right? I get all the dependencies and then I go ahead and call this npm start and then I pass across that URL that came through because what I wanted to do was I wanted to go and run this agent repo. So, let's take a look at that agent repo. So, there's a main function and it comes in and basically this is the prompt here. So, so what I've done is I said first use the skill right now because this is its own repo.
I can actually run it locally on my machine and make sure that it's doing what I want it to do before I run it in the container approach. And and the way that this is working is I'm I'm running this prompt here, right? I'm running this prompt and you pass it to this uh thing called query and it sends the messages. Uh you tell it what it's allowed to do and I'm using skills. Now, if you haven't used skills yet, Anthropic just released this pretty recently, and I'm really digging how I can just put things where they belong, and it works.
So, uh, right. So, I'm saying that it can use this allowed tool of skill, and in my folder, I have thisclaw skills. And I have a couple of skills in here. So, this, uh, first skill that's in here is this markdown fetch. And I have a file called skill.md. And one of the cool things that I was able to do is sometimes you could just do a straight web fetch of a page, right? So it gets what happens when you do that though is it gets a lot of surrounding garbage. And the default tool actually if we look at the default tool called web fetch, uh it doesn't currently support websites dynamically rendered with JavaScript. And I want that, right?
I want anybody to be able to drop their tutorial in there. Uh and so what I wanted to do is I wanted to convert that page to markdown. So what I did was I made that skill, right? I I I discussed that skill and I was just kind of playing around here. This is really powerful. You can kind of just say what you want to have here and it will check that there's these these variables and I gave it the endpoint, right? There's an endpoint for it and I kind of explained what happens. And I straight up just told it that I want to save things in a specific location.
And then the other skill, this tutorial checker, comes in here. And check this out. You just kind of describe what it is that you want to have happen. I love living in the future. All I just told it like this is how I want you to evaluate it. Super super cool. So, uh, so if I flip back and I look at it, I say I want to use the skill markdown fetch to fetch it from the URL, right? I pass the URL through and then I want to use the skill tutorial checker to analyze the markdown.
So, so it's using those skills and if I come down here, we'll see that I am just going ahead and I'm writing out to the console to standard out. I'm writing out the message, right? because on the other side I'm going to grab it. And I wanted to make sure that I redacted some things. So I put a little safety in there. Let's see how things are going. So I'm going to pop back. Uh cool. It's it's it's outputting some stuff. Uh and it's it's seeing that it has the Cloudflare account ID. It's making sure it did a curl.
It's got and gone and fetched it. And so now it's stored that file. And now it's about ready to start writing that review. Right. So let's go ahead and uh let's look at what it looks like on the other side. Uh, so where I'm using that, let's get back into my my other repo here, the claw in the box. So I've I've called npm start and I've passed the URL and I said stream equals true. And so I have this function that will go ahead and grab this. Uh, it'll pull it out. And we can see that uh we have the standard out and we're doing this JSON parse of that data.
Uh, the user thing is pretty noisy, so I turn that off. So you'll see that the type if the type system, it returns back the session ID. And I could actually write an interface that sends data back in, but I don't need to in this case. So, uh what happens then is we just go through and I get the text out um and I make sure that I show the tool and I show what's happening uh there. And then I just handle very at the end, right? This is specific to my app. I uh wrap things up here and I say I want you to go read that file, right?
Because a sandbox is able to read files. So, I'm going to read the file and then I stored it up in KV. So, so, uh, I stored it so that let's go take a look really quick at what came back. So, uh, it finished. And so, I've got here's the content that was fetched, right? There's the that's the markdown. Uh, and then here's the review of the tutorial. Uh, really nice. Uh, I love this. It It's awesome. I can sit here and I can read and see what's missing, right? I can come here and kind of think about, oh, that's an interesting take on it.
And I can, you know, improve this as it goes, but this is awesome. This is totally awesome, and I need this, right? I need this. I need some other eyes to to take a and of course the best part is you can take this idea and run with it. So one of the things that I was thinking about as I was literally talking to you about this there's nothing that is stopping us from spinning up a sandbox and having it try to run the tutorial steps and see if they work. Isn't that cool? Imagine the QA possibilities.
Now keep me posted if you build that. I think I'm going to go give that a go right now and I'll share too when I get it. Big thanks to Anthropic for making all of this possible. And now you've got your own claw in the box to try out. Have fun. Thanks for hanging out.
More from Cloudflare Developers
Related Videos

Should You Take IBM's Full Stack Developer Certificate in 2026? (Coursera Review)
00:13:32


DevOps Engineer Full Course 2026 | Learn DevOps In 24 Hours | DevOps Tutorial | Simplilearn
23:41:19

Top 5 AI Automation Tools 2026 | 5 Best AI Tools You Need To Try To Boost Productivity | Simplilearn
00:11:36


Get daily recaps from
Cloudflare Developers
AI-powered summaries delivered to your inbox. Save hours every week while staying fully informed.



