Skip to main content

Building AI agents with Claude in Amazon Bedrock | Code w/ Claude

TL;DR

  • AWS has launched Strands Agent, an open-source SDK designed to simplify building intelligent AI agents that can reason, plan, and execute multi-step tasks.
  • Strands Agents leverage powerful foundational models like Claude, running on Amazon Bedrock, and integrate seamlessly with various "Multi-Capability Platform" (MCP) servers to extend their functionality.
  • The SDK enables developers to quickly create agents with custom or built-in tools, allowing them to interact with external APIs, generate code, or produce architectural diagrams with minimal boilerplate.

Takeaways

  • Strands Agent SDK: An open-source AWS SDK that simplifies AI agent creation by requiring only models, tools, and a prompt, minimizing scaffolding.
  • Agent Definition: An autonomous system capable of reasoning, planning, taking multiple steps, and evaluating results to achieve a given objective, much like a human.
  • Amazon Bedrock: A fully managed AWS service providing access to foundational models (e.g., Claude family) via a unified API, offering model choice, guardrails, and enterprise-grade security.
  • Tools in Strands Agent: The SDK includes built-in tools (e.g., HTTP request tool) and allows easy creation of custom tools by decorating Python functions with @tool.
  • Multi-Capability Platform (MCP) Servers: These act as "USB-C" connectors, providing external capabilities and context to LLM agents for tasks like accessing AWS documentation, performing cost analysis, or generating diagrams.
  • Agentic Workflow: Strands Agents facilitate a clear workflow where the LLM reasons on behalf of the user, breaking down complex prompts into a series of search, read, act, and evaluate steps.
  • Claude Code Integration: Claude Code can be used within VS Code to assist developers by explaining agent code, generating new Strands agents, and creating templates based on context.
  • Deployment Flexibility: Strands Agents can be easily deployed to AWS services like EC2, Lambda, or ECS, offering integrated support for cloud environments.

Vocabulary

AI Agent — An autonomous system capable of reasoning, planning, and executing multiple steps to achieve a specific objective, often by using various tools. Foundational Model (FM) — A large AI model trained on a vast dataset, capable of performing a wide range of tasks and serving as a base for more specialized applications. Amazon Bedrock — An AWS fully managed service that provides access to powerful foundational models (like Claude) through a unified API for building and scaling AI applications. Strands Agent SDK — An open-source Software Development Kit by AWS designed to simplify the creation of AI agents using a minimal set of models, tools, and prompts. System Prompt — Initial instructions or context given to an AI model that guides its behavior and defines its role or task within an agentic workflow. Tool (in agent context) — A specific function or capability that an AI agent can invoke to perform an action, interact with external systems, or retrieve information. Multi-Capability Platform (MCP) Server — A server that provides an LLM agent with structured access to external APIs, documentation, or specialized functionalities, extending the agent's abilities. Claude Code — An AI coding assistant that leverages Claude models (often via Bedrock) to help developers write, explain, and debug code directly within their IDE, especially useful for agent development. AWS CDK (Claude Development Kit) — An open-source software development framework for defining cloud infrastructure in familiar programming languages and provisioning it through AWS CloudFormation. Agentic Workflow — The multi-step process an AI agent follows to achieve an objective, involving reasoning, planning, action execution, and evaluation until the goal is met.

Transcript

building AI agents with CLOT in Amazon Bear Rock. Today I am excited to explore how to create intelligent autonomous AI systems that can transform your applications. My name is Duane Lifefoot. I am a developer advocate at AWS. I'm Ben Javier-Biammy. I'm a Susan's architect at AWS. Hi everyone. My name is Suman Devnath. I'm a developer advocate at AWS. Now this will be a hands-on keyboard event. So we have a live workshop where you can log into an environment and get started with some code. So we're going to go through a few slides to kind of level set and get everyone on the same page and then we'll hop into the workshop. Now this is code with CLOT. And one of the things that I want to talk about is in Thropic or AWS. To do that, we have Amazon Bear Rock, which is a fully managed service that provides you access to powerful foundational models like those in the CLOT family, through a unified API. This gives you everything you need to not only build, but also scale your AI applications globally. And it does this by providing you with everything you need, model choice, guard rails, as well as it gives you security at enterprise grade at default. Now we're talking agents. That's what everyone is here to see. But we kind of need to level set what that really means. And at AWS we explain it like this. An agent is an autonomous system that can reason, plan, and take multiple steps to perform an objective like humans. So if you have a task and you give it to an agent, the agent is able to take that task and say, here is the high level objective. Let me create a plan of the steps that I need to take. Then it could take actions on those steps. And once those steps have been taken, the actions have been taken on those steps, then it can evaluate the results in reason on what needs to happen next until it actually achieves that objective. This is an agitic system that we'll be discussing today. Now at AWS we've also done something awesome that Makali Suman is going to talk about at this time. Thank you so much, Duan. So taking one step further, what we have done, in fact last week, last Friday, we have announced an open source SDK to build agent-to-caplication called strands agent. So what this agent does is, it's a very simple SDK, which needs three things, models, tools, and prompt. It cannot go any simple than that. It doesn't have any scaffolding that you don't have to guardrail your prompts, your backstory, goals, et cetera. What we believe in is that in today's world, the LLMs are pretty strong. And we want to make use of the full strength of the model in the backend. So we are giving the better flexibility for the model to reason on behalf of us. And that's why if you look at this architecture, it's very straightforward. You create a prompt or this is your question. You send it to the agent, which is the strands agent. And when you create an agent object, you will define the model and tools that we provide to you. You will see in the workshop, when Banjo will go through a couple of the demos, you will see that the default model that we use is Claude 3.7 as of today. And the moment you have strands installed and configured, you get a bunch of tools in build. So you don't have to write heavy lifting code to create free of your basic needs. And the best part is not only for your testing and deployment in the test environment, you can actually deploy on the Claude. So assume that you have your workforce in EC2 or Lambda or ECS, you can just deploy your code with the integrated support for all these services. So to get started, just take a snap of this. This contains the launch blog as well as the documentation which is nothing but strands agent.com and the GitHub. And this is an open source project. So feel free to give a start and just rate the PR if you have anything interesting that you build or if you have any specific requirement which is not there, feel free to contribute. It's just three days old and we got many PR and feedback from the community and we would love to work with all of you. All right, so the moment you're all waiting for it, time to build. So we have from key configured AWS accounts for you, VS code is also configured so it's nothing you need to download. Everything is done in the browser. So when you go to this URL, it's gonna take you to our pop up screen and you're gonna sign in. You're gonna ask you for a one time password. That's the best way to log in. And once you do that, you're gonna be able to access to the AWS account as well as the VS code servery spun up. So we're gonna take a few minutes to get set up. I always say this is the hardest part of the workshop. So Tuma and Dua are gonna be walking through, ask any questions, raise your hand, and I'll also walk through it, but take some minutes to get started and let's get start building. So when you log in, you'll get to a screen like this. So I'll give a couple more minutes to get to the screen and I'll walk through setting up bedrock so we can access to the model that into our VS code server. Well, while people are waiting, I have a video to highlight what strands can do. So I can assure that in the meantime. So this example, we actually have a strands agent that's actually gonna create a math video for this. So it's actually pretty cool. So let's see what happens here. So it's running an MCP server. It's gonna start that sort of environment. It's gonna actually create an animation video for us. So it's gonna create a maximum scene. I draw the cubic function, 2x cubed. Yeah, something hard I might have to do in late text, scientific like this is very annoying. But we'll see how the MCP server is actually gonna build it and actually make a video to highlight it. How many of you have heard of three blue, one brown? So that is what you are going to see now. So we have created an MCP server which can create the video that you see in three blue, one brown. So we have created a quadratic equation and we wanted to plot that within the range of minus three to three and this is powered by clod 3.7 and strands. So we'll push that code in the GitHub repo which we have shared earlier. But this is just a testimony of how you can get started quickly with the out of the box tools and just few lines of code. Thank you. So the first thing to do is make sure you log into this AWS account so you should not be using your own AWS account. We have already provisioned one with all the resources needed. Open AWS console and it will open up a new account, new like this. You can see this workshop participant role. So you should not be using your own AWS account if you have it. From here, we're going to type bedrock, Amazon bedrock. So we get to the Amazon bedrock console screen. We're going to want to enable the models so we can use them in our lab. So for a second, we're going to scroll down to this model access button. And then I click the modify model access. And we got some new models but we have not enabled them yet so we're just going to use Clawed V7, V.5 IQ and V.5 on it. So enable those. We got four already yet. I don't think it's enabled in this account yet. So we've got to use the older models. So when first next, once we request access submit. But again, this code, all the code is open source. The workshop is open source and we can see the link so you can run this on yourself. So module one is the one we're doing today. So we're going to show you how Strand agent works and how you can actually build a agentic workflow to fit. So the first thing you do is install it. So just doing pip install Strand agents and Strand agent tools gets you what you need. And have some utility things. UV to download MCP servers. So I'm going to copy that command. All right. I already installed. Great. So. And then the cool thing with Claude Code, you actually can use it of Amazon bedrock. So if you have an AWS account, you have bedrock. You can use Claude Code without using the ontop of the key signing in. Everything is just done to bedrock. That's by using the export Claude Code environment variable. So let me go ahead. All right. So Claude gets started. We start preview. We've got a pastark mode. Of course, Claude. All right. Cool. So you just recommended settings. Yes, proceed. All right. Claude Code, ready to go. So all I did was this export that command, because it's already using bedrock. Everything is ready to go. It's already in my environment. And you all can see this, right? This is a good screen. Yeah. Cool. So the first exercise of the workshop, we're actually going to use a weather count. Every AI thing has to start with weather first. So you know, where we added two tools to this one. The one that can actually get the weather, and then actually count how many words are in the response. So let's just show how easy it is to use different tools using strands. So, and we're actually going to use Claude Code to explain how this code works as well before I dive into it. So I'm going to open this up. Paste. Can you explain the structure of the strand agent weather, world count file? All right. So it's going to be able to see what happens. Use the tokens. Let me open the file. What does that? And we'll see what Claude says. All right. So demonstrate a simple agent, implementation to strand frameworks, and the agent file, import, necessary, word count tools, using Claude 3.5, actually to query. So let's walk through the code in more detail. So we actually have a system prompt, and we're saying, you know, find the weather, and it actually puts the API in the system prompt, HTTPweather.gov. So there's no API key needed for this. So I can just query this and get the actual weather or what the place is, and provide in a human readable way. And the cool thing about this, strands has this HTTP request tool already built into the framework. So it's going to be able to make that request for you, automatic. You just provide URL. It's able to call that and get the actual data from that. And then you can, the cool thing about strands also is you can change the different models you can use. You can use light LLAM. You can use Alama. You can use bedrock, bedrock to default. So I just changed the Claude 3.5. It's going to be faster here. And then the cool thing about strand is that's the system prompt. The system prompt will put up there, which tools we're going to use, the word count tool. Now, whatever you like about the tool decorator is, I just define a function and I put the return value. There's no crazy thing, no adding. I just put this tool decorator and it handles the rest. So as a developer, it's building function. I want to put all this extra stuff in there, making it as simple as possible to have a tool. So that's a really big plus to the strand stream work. And from there, I'm going to say, what's the weather like in Seattle? Let's change it and then Francisco. And let's go to the terminal. All right, so we can see how it's going here. First, I've got the coordinates for San Francisco. You can see the HTTP request tool. Now it's going to use the HTTP request tool to find that weather. You get the San Francisco 65 sunny, west winds, few days, highlight. Now, you use the word count tool, 110 words. So there have been about 44 lines of code we're able to make that API request. We have the agent. We have multiple tools done. So I'll pause here for a second just to have the next question for strands. Because everybody's going through it. So strand is an open source SDK for building agents. So there are a lot of agentic frameworks, but strand is its own one. And you can see that you really just need a system prompt, the tool, then a model, and it can execute that loop. So yet it is similar to other agentic frameworks, but I believe it's much easier to get started without the boilerplate and extra stuff that you've seen in other frameworks. One more question and we'll move on to the next part. Thank you. So I have a code related question. So how are you passing the latitude, longitude, and zip code inside the strand? So the cool thing is that we're letting the model decide how to do that. It uses this HTTP requesting and it understands what the latitude and longitude is of San Francisco and is able to pass that to this API endpoint or use API zip code. So it understands what the API is based on the system prompt and the model is figuring it out by itself. So we're handing a lot of the infrastructure you might see in other agent frameworks that you've got to do this. You've got to do this. We'll let the model decide to do that. Because the model of the multiple capable and they were two years ago when you saw the first type of agent frameworks coming out. So the strands tools, like I see that you're importing two tools, which is like word count and HTTP request. So how many tools are there? Yeah, yeah. So there's some built-in tools in the strand framework, like HTTP request. But then I also just made my own tool, which is literally this one line of code, returned as length. So it's very easy to make your own custom tool. You just put this tool decorator and that's it. So very, very streamlined. All right. So we're going to move on to the next exercise. So the next exercise is fun one, MCP servers. So I'm MCP is the hottest thing. So what's really cool about strand that has built-in MCP support? And AWS, we actually have a official AWS MCP servers. So I'm going to highlight the documentation lookup. Because AWS is going to be very long. A lot of different things. So if I don't have one endpoint that does grab that information and pass up the model, it's going to be able to understand how to build. And then architecture diagram. So making AWS diagram. So there are two MCP, there's a whole bunch of them listed here. But I'm going to highlight these two in an example. So let's go back. And we can also ask Claude Code to explain it as well. So, good, Max. You open my Claude Code. So I have to explain how the MCP Diag one works. So let me open that up while I'm tweeting. Let me close that. Claude Code's documenting. Looking what to do. Looking at it's time. So while Claude Code is going, I'll explain what's happening. At the finish call. All right. Import the strand. Still going. All right, so the cool thing about MCP server is we can actually just pull it in with one line. We just the command UVX. This is a Python theory for downloading things. So we can just point it to the MCP server and download it locally. So I'm passing in the documentation MCP server and I'm passing in the diagram MCP server. And then Claude's even saying the same thing. Connect to the MCP Diag one. Configure using Bedrock again. I can choose a different model on Bedrock to pass in. And then I'm giving a system prompt. You're an extra certified solution to architect. You're also help customers understand best practices, query documentation, generate diagrams, tell the customer the full path of the diagram when you create it. So so we know where it is. And then again, we just say, passing multiple MCP servers with the diagram client, the docs client, we get all the tools based in those MCP servers. And then again, you have the tools. We have the model and the system prompt. All you need to have the Starrans agent. And then we give it like, get the documentation for AWS Lambda, then create a diagram on a website that uses Lambda for a static website hosted on S3. So that's the task I give it. Let's see how it executes that. No. Oops. All right, so download the MCP server. It's already downloaded that already. And I was processing now. It breaks it down to the steps. So first I'll search the AWS documentation. Then I'll read the document. Then I'll create a diagram illustrating architecture. So you can actually see a stop process. It makes an HTTP call to get the search and find the Lambda welcome page, get the information. Acquire the documentation. Now it's going to draw the diagram. Let's see. It listed the icons. So what icons are available for it. Now it's actually generating the diagram. So it failed there, but it understood that and explained. Let me correct the Claude walk icon. Now it generated it, explained what's happening, and it made this new diagram safe here. So I should be able to open it up, generated diagrams, and today I made a new diagram for me. So whoops. Yeah. Ha ha. Really. Yeah. It's going to be different every time when you, of course, based on how much context you give it. But yeah, I'm able to make that diagram. And just about 40 lines of code. I have two MCP servers. I put my system prompt, picking a different model, and I'm able to create that agentic workflow very quickly and very easily without any too much headache. So I'm going to pause here on any talk about MCP servers connecting with a strand agents. Is there a pattern through API gateway to host a MCP server with Lambda? Like the server side events. Is there something that allows you? Yeah. Not because MCP supports the HTTP streaming server side event, you can have it in a Lambda function and do that. There are some, I believe there are some open source code that demonstrate time to do that. When my colleagues have done that, so yes, totally possible to do that use case. Because right now I'm just running the MCP server locally, but if you wanted to have it in the Claude, like a Lambda function, totally possible use case, you'd have to change how this is set up. So the last exercise was we're actually going to create a new agent using Claude Code to understand how it does without just looking at the code we have already, and able to understand which CDK. I'm going to make a CDK agent. So CDK is a Claude development kit. So it's a way to create a data with infrastructure through code. Normally, if you want to create a data with infrastructure, you might use something like Claude Formation, which is a YAML-based way. But if it's a developer, CDK is more preferred for that. Because you can integrate it to Python TypeScript code. So I'm going to show an example of how we can use Claude Code that we created a new strand agent for us. And I make this new file here. All right, so I created a blank, brand new file, nothing in it. And then I'm going to ask Claude Code, update the CDK agent to create a stand agent connecting to an MCP server. Look at the other files to understand how to do this. So I'm not giving you the documentation. I'm just going to say, you know, use the knowledge you have already to understand how to make it. So let me get into the repo and then Claude and ask it. So yeah, so now Claude Code is going to look through. We'll see the plan of attack it does. So let's see what it's doing. All right, I'll update the CDK agent to the strand agent connected to an MCP server. It looks at the other one. There's no one line of code there. I read the other word count one. It finds the MCP dot one. The exam is across it off the list. All right, onto the next one. Create a stand agent and put all the code for that. It asks me do I want to make this edit? So I say yes, make the edit. Adding the code to the movie. All right, configure string agent, MCP client configure system prompt. It's done it. Perfect. So you can close that of it. And what I like about Claude Code, actually says how much it costs when you end it? So the total cost, how long the API talk, how many code changes, which models it use, it use Claude 3.5. It's like, hi, koo, use koo.5. It's on it to understand what the best way is. So using Claude Code of Bedrock, it's an easy way to get started in building applications like this. And it's now natively inside BS code. This will be exciting. So let's see if the code actually works. So I'm just going to run it. Let's see your expert AWS CDK expert. How can I get a simple S3 bucket with CDK? Give us something simple. Let's see how it works. I thought the CDK agent. All right, so I was making a TypeScript example. I'll provide stuff by step guidance. It wrote the code for me. It's doing that security, tech this, add a CNN, nag rule. So it really understands what CDK is. It's putting all this extra stuff there. And yeah, you've explained that. So Claude Code was able to understand how string agent works, create a new agent based on that, create a template on that. And it was very easy to understand. So by providing enough contact, Claude Code they would understand what to do, create this agent. Pretty good job. So very impressive using Claude Code and Bedrock found that also amazing. But that was kind of the workshop through and through. Kind of to show you what strands can do from a simple weather agent to connecting to MCP server that are also making your own agents. And we're going to pause here for any question or if you want to see a demonstration of something cool, I'm happy to try it out and see what Claude can do. So I just have to ask, what are some of the use cases for using MCP? I know I will be building agents that probably connect to the outer world through APIs and all. Maybe I don't know a lot about MCPs. So but like, what are some of the use cases you can use MCPs for? Right. So a great question. What are the use cases for MCP? So by the fall, the agent doesn't have enough information to connect to external API. So you saw in the example, we created an AWS diagram. If I did that with an MCP server, the model would not know how to make the AWS diagram. It won't know how to look up the AWS documentation. So providing extra context to the model to do extra action. So when it comes to using large thing with model, context is really the empowered what's going to go on. MCP provides a structured way to grab that information. So it can take action, re-documentation, connect to external applications. So MCP is really kind of the USB-C, they call it, of connecting the LLM. So for me, it's a great way to just connect the external applications, get different context for your model. And I'll show you some highlights of the AWS MCP server as this so you can get an example of what we have. So there are a official list of AWS MCP servers that do a bunch of different things. So I'll go through some examples. You saw the documentation one, bedrock knowledge space. If you have a bunch of PDFs, the document, you want to give to an LLM cost analysis. So you want to do AWS cost analysis, you want to get another example. The MCP server can be useful for you. Amazon Nova Canvas, if you want to draw images, Nova Canvas, NBC server, the diagram one that we use today can also draw AWS to architect your diagrams, a Claude formation. So there's a bunch of different ones. And Terraform, if you use Terraform, front-end code, you want to specialize in React or use an AWS amplify, et cetera. So there's a whole source of MCP server. So one big use case is I want my model to understand these things. You have a bunch of documentation, Postgres database, Amazon Neptune server. Like so, this is really the power of MCP, so there's so many integrations you can have to give that model extra abilities to do. We do have AWS credit for you. So if you want to give us some feedback and surveys, I want you to fill this out. You'll get a new $25.00 AWS credit to use. So you can play around and try some things out. But thank you for coming and let's go builds.

Feedback / ReportSpotted an issue or have an improvement idea?