back to indexIntroducing Strands Agents, an Open Source AI Agents SDK — Suman Debnath, AWS

00:00:16.280 |
I'll quickly go through a couple of demos, that's all. 00:00:29.420 |
is to make your agents as simple as possible, 00:00:34.900 |
The only thing that is needed is tool and the model. 00:00:43.080 |
you don't have to dictate what the agent should do, 00:00:47.220 |
and the idea is, since the models are becoming 00:00:51.460 |
more and more intelligent, we want the model to take 00:00:58.340 |
We don't want to scaffold with a lot of prompts, 00:01:01.000 |
a lot of system prompts, a lot of backgrounds, 00:01:10.560 |
third-party providers, like LangFuse, LightLLM. 00:01:19.820 |
You don't need to use Bedrock hosted models, but you can go ahead with any of the model of your choice using LightLLM. 00:01:27.360 |
And also you can use OLAMA if you want to test it out locally. 00:01:32.720 |
Now, this is the agentic loop that we have in strands. 00:01:38.200 |
As I mentioned, it's just the models and the tools, that's all. 00:01:41.980 |
And that is actually the two strands in this logo of strand denotes. 00:01:52.360 |
Okay, so now let's see a demo, how you can create a strand agent. 00:02:00.240 |
So the demo that we are going to have now, it's very simple. 00:02:03.700 |
We are going to read one file from our disk, and then we will generate a summary of that. 00:02:09.740 |
Then we will write that summary into our local drive. 00:02:14.340 |
And then we will also tell the agent to speak out the result. 00:02:18.920 |
So basically, we are trying to add the voice aspect of this, okay? 00:02:22.860 |
So now there are three things we are doing: reading a file, writing a file, and generating a speech. 00:02:30.120 |
All of these three, we are doing it using the default tools from strands. 00:02:34.700 |
So you don't have to write any custom tool for this. 00:02:36.980 |
You just have to install a strands tool, and boom, you can get started with this, okay? 00:02:46.620 |
I have recorded this because I heard that the Wi-Fi is pretty fantastic here. 00:03:00.860 |
So here, the first thing we need to do is we need to install strands. 00:03:09.580 |
We are just installing the strands agent, and then we are going to install strand tools. 00:03:16.120 |
So this is a simple pip install, nothing fancy here. 00:03:19.540 |
And when you install the strands tool, it gives you a lot of default tools. 00:03:23.720 |
You can always make your own custom tools, but this is how you can create or use out-of-the-box 00:03:31.200 |
These are the three tools that we are going to use. 00:03:34.160 |
So now we are going to write the application. 00:03:44.120 |
So the first thing that we need to do is we need to import strands, and by default, it uses 00:03:50.000 |
bedrock model, which is Cloud 3.7, under the hood. 00:03:54.120 |
But if you don't want to use that, you can always use any model of your choice. 00:03:59.080 |
I am trying to show you how you can define the model, but later on when we create agents, 00:04:05.540 |
you will see that you don't have to give model ID. 00:04:10.880 |
But I just want to show you, if you want to define your own model, how you can define the 00:04:16.040 |
In case you want olama, you can use olama there. 00:04:21.500 |
When I share the GitHub repo, try to do this, delete the system prompt, it should still work. 00:04:26.620 |
But I just wanted to give you an intuition of how things work under the hood. 00:04:31.360 |
And if you see here, all we are doing here, we are giving the model ID, system prompt, and 00:04:36.280 |
And now we are asking the same question, read this chapter number 10, summarize that, 00:04:43.240 |
and write it in a markdown file, and speak out. 00:04:46.900 |
Now to listen to the speech, let me increase the volume. 00:04:53.000 |
So now it is reading the file, then it is trying to write the file after creating the summary, 00:04:59.520 |
The human eye functions like a camera, with light entering through the cornea. 00:05:03.600 |
So you get the idea, right, so how these things work. 00:05:07.780 |
Now there is one more demo I have, which is around MCP with strands. 00:05:14.880 |
Because without MCP and agents, I was told that you cannot have any talk in this conference. 00:05:22.140 |
How many of you have heard of 3Blue1Brown YouTube channel? 00:05:31.300 |
So we are trying to build animations and videos like what we see in 3Blue1Brown. 00:05:37.480 |
It is powered by one of the library called Manim. 00:05:40.480 |
So I have been working with this Manim for a couple of years to, if you are from science 00:05:47.740 |
and mathematics background, eigenvalue, you know, eigenvectors, SVD, these are the concepts 00:05:53.480 |
which are very easily we can explain using visualization. 00:05:56.900 |
So what we are going to do now is we are going to create a strands agent using an MCP server, 00:06:06.080 |
which will help me to generate these videos using Manim. 00:06:17.100 |
Assume that we already have an MCP server which can generate this video. 00:06:28.100 |
So now what we are going to do is using strands, we are just going to call the MCP client and 00:06:38.280 |
So in this case, I am importing the strands agent and the MCP client. 00:06:45.080 |
The next thing that we are going to do is we are going to create the MCP client. 00:06:49.120 |
If you see here, this is my MCP server path where I have returned the code to execute that 00:07:01.180 |
So that, this particular code I am not showing, but after this I will show it to you what that 00:07:11.300 |
Now, when I create an agent, in the previous example, if you remember, we mentioned that 00:07:16.880 |
agent then tools equal to read file, write file, and speak. 00:07:23.180 |
In this case, I am not using any of the default tools. 00:07:30.460 |
And for that, I am just using tools equal to Manim MCP client list tool sync. 00:07:36.500 |
So this will broadcast all the tools that the MCP server has to my client. 00:07:49.220 |
And at the end, we are just going to give the prompt. 00:07:51.780 |
So in this case, you can give any prompt of your choice. 00:07:54.660 |
But here we are just saying that create a visualization for this cubic equation within the range of x minus 00:08:04.440 |
If you want to try this with something else, you can always give, like, explain me byte-pair encoding in a visual way. 00:08:11.580 |
Or you can say, explain SVD, explain how two metrics of 2 x 2 perform a metric multiplication, or whatever, right? 00:08:25.820 |
So for this, before I start the MCP client or the strand agent, I have to make sure that server is up and running, right? 00:08:33.440 |
So in here, I'm just making the MCP server up so that this is available in that local host. 00:08:40.580 |
And now I'm running this app.py, which contains the code which we have seen a while back. 00:08:49.720 |
So this is the same prompt that we have seen in the previous slide. 00:08:54.860 |
And if you notice, we have not mentioned any scaffolding, kind of, like, system prompt and all that. 00:09:05.860 |
We want the model to reason about this and figure it out of its own. 00:09:21.000 |
And you can actually define the duration of the video. 00:09:28.140 |
Let's say 30 seconds, 10 seconds, and all that. 00:09:32.140 |
And if you have worked in Manim to generate this code, it takes some time, right? 00:09:41.280 |
So that's about the integration with MCP and Strand. 00:09:46.280 |
And before I show you a few of the resources, let me show you the code. 00:09:52.280 |
No one pings me while I'm working, but everybody pings when -- okay. 00:10:05.280 |
So this is the -- so this is the MCP server that I have. 00:10:14.280 |
It just -- I have imported fast MCP and this is the -- this is a couple of the tools that 00:10:28.620 |
And if you see this here, the way that you can create an MCP tool is just wrap it around 00:10:35.660 |
So this becomes -- these two are the tools for my MCP server. 00:10:40.960 |
And when I come here -- when I come here, and if you look at the main function -- so this 00:10:50.080 |
is the function where I'm going to call that using strands agent and MCP client, right? 00:10:56.740 |
So I -- what I've shown in the presentation is just a few lines from this main function. 00:11:02.740 |
But we are doing a little bit more before just calling the agent. 00:11:08.440 |
We are listing the tools, but before that, we are also giving some examples. 00:11:14.900 |
And if I show you this example, I'm just giving one example of how to create, you know, and 00:11:33.940 |
But my -- as far as the agent is concerned, it's just one line of code. 00:11:43.020 |
And then here, we are just calling the agents. 00:11:46.380 |
And then we have a while true loop so that we get an interactive chat kind of an experience. 00:11:53.020 |
And in our first demo -- not first demo -- I want to show you one quick thing is how you 00:12:08.480 |
This is -- I'm just jumping around a couple of things because we just have two, three minutes. 00:12:14.480 |
It's no less than a time bomb, trust me, when I see this. 00:12:18.240 |
So let's say you have any function -- let me just quickly scroll down and show it to you. 00:12:30.480 |
So if you have any function, and you want to create that function, you know, turn that function 00:12:40.380 |
into a tool, all you have to do is this -- let's say this is a function. 00:12:52.260 |
It's there in the GitHub, but I will not explain that. 00:12:54.160 |
But the idea is, let's say you have a function. 00:12:57.960 |
All you have to do is just import tools from here and decorate it with tools. 00:13:03.900 |
Once that is done, this retrieve from Quadrant will become a tool for you. 00:13:09.960 |
So next time when you create an agent, when you create an agent, you just give that as a tool. 00:13:17.040 |
And now here, in this list of tools, you can give your custom tool as well as your default 00:13:21.860 |
tools, whatever we have -- read file, write file, speak, and so on and so forth. 00:13:29.440 |
Now, if you want to learn more about strands, we have a GitHub repository. 00:13:38.440 |
And this is the documentation, which is nothing but strandsagent.com. 00:13:48.380 |
And if you have any questions, feel free to, you know, ask me. 00:13:55.380 |
There are plenty of demos with strands, with Lambda, MCP and, you know, to get started. 00:14:04.320 |
Feel free to raise a PR if you have something. 00:14:07.380 |
If you have built something into the samples code repository within strands, GitHub.