🤖 AI Agents Explained: Effortless Automation Testing Starts Here 🚀
By Execute Automation
Summary
## Key takeaways - **AI Agents: Autonomous Systems or Guided Workflows**: AI agents can be defined as either fully autonomous systems capable of independent operation or as implementations that follow a predefined, guided workflow, both enhancing AI system effectiveness. [00:15], [00:39] - **LLMs Limited, Agents Connect to External World**: Unlike current large language models limited to generating outputs, AI agents enable these models to interact with and take actions in the external world, expanding their capabilities. [00:57], [01:21] - **SmolAgent: Automating UI Tests with Few Lines of Code**: The Hugging Face SmolAgent, with just a few lines of Python code, can automate complex UI testing tasks like logging in, navigating, and creating new users, even learning pages through trial and error. [05:06], [13:33] - **AI Agents Excel at API Workflow Testing**: AI agents can perform complex API testing workflows, including POST, GET, PUT, and PATCH operations, storing variables and verifying responses, all within seconds, effectively acting as a 'Postman killer'. [14:15], [19:26] - **Agent Capabilities Scale from Basic Control to Code Generation**: AI agents are categorized by their capabilities, ranging from models that determine basic control flow (one star) to those that can write and execute new code autonomously (four stars), reducing developer intervention. [03:40], [04:43]
Topics Covered
- AI agents: From predefined workflows to full autonomy.
- AI agents transcend specialized tasks for multi-tasking.
- Graded autonomy: AI agents evolve from guided to self-executing.
- AI agents automate UI testing with minimal code.
- AI agents master API testing, executing complex workflows rapidly.
Full Transcript
hi guys my name is Karthik and I from is
automation.com and today in this video
be talking about what are AI agents and
how to use them for automation testing
so before we get into this automation
testing part of AI agent let's talk
about what is this AI agent itself well
AI agents can be defined in several ways
uh and some Define this AI agent as a
fully autonomous system that can operate
independently for extended period of
time while some other use the same term
a a agent to describe it more in like a
perspective implementation that follows
a predefined workflow so you set the
workflow and that's guided workflow is
what this AI agent is going to work with
but some others say that this AI agent
can become like fully autonomous and it
can take action uh by them themselves so
either way AI agent is going to enhance
the effectiveness of this AI system
which will enable the large language
model to interact with the external
world because we know that the large
language model
which we are using at the moment with
the chat GPT or CLA or Google Gemini
these large language models are limited
with the functionality to generate an
output or maybe generate an image or
video or whatsoever but they are not
really interacting with the external
World well they are not enabled to talk
with the external world but this AI
agent is going to make that happen which
is pretty cool so essentially this AI
agents are a computer program that no
longer ER needs to function as a human
control Tool uh which is confined for a
specialization task rather they can now
combine multiple tasks without having
human Intervention which is which is
pretty dope because that is what is
going to make this AI agent pretty
amazing and that's what is really
happening and there are few examples of
this AI agent like the one which was
released yesterday uh from the open AI
the operator uh which is pretty much
like an uh like a AI agent which is
going to do quite a lot of things for
you I don't really have an access yet
it's only for the chat gbd Pro user with
the dollar2 200 subscription limited to
United States of America not for New
Zealand people like me so yeah that's
the AI agent which the op just released
so there is also perplexity which have
also released another uh AI agent by
themselves uh which is Al going to do
pretty much like uh like what this openi
is really doing so they have released an
agent and there is already a lot of
Agents which available uh like the
hugging face small agent uh and the uh
GPT uh the auto GPT agent that you are
seeing over here and there is also this
uh Cloud anthropic mCP uh server which
also do the exact same kind of thing
I've always talked about the cloud
anthropics mCP agent which can do quite
a lot of different operation like model
control protocol which can go and talk
to the external world we also have a
plugin for the mCP uh playright which is
going to do pretty much like automation
testing on the UI
as well as for the API using that agent
functionality so we talked about it we
also have a GitHub reper which has got
all the details as you can see over here
so these are the things uh these are the
AI agents that we really have got over
here but this AI agents level can also
be categorized uh based on their
capabilities as you can see over here so
if the AG gentic level of the AI agent
uh is like like there is nothing then
the model has no impact on the program
flow the developer has the full control
of the prr and he will just do uh all
the operation by it himself like if you
just do print LM output then the LM
response is going to be printed but if
the agent level is like one star then
the model determines the basic control
flow but still here the developer has
the control over all the possible
functionalities but still guess what the
um the model will do like determine the
basic flow like if condition switch case
statement like that but if you have an
agent level with like two stars like two
level upgraded then the model determines
how to function uh how the function
needs to be executed so now the the AI
agent will get the capability of doing
it for you which is amazing right and
then if the the level of the agents just
increases to like three stars then the
model controls the iteration and program
continuation and now you see that it is
just becoming more and more smart and
the developers control the high level
function of a system and lowlevel
systems will be taken care by the AI
agents and once the agent level become
like four star fully capable then the
model writes and execute new codes by
themselves and here the developer is no
longer needed and the developer defines
the high level function and the system
can which the system can do and the
system can control all the possible
functions uh and when they are done they
will say that the task is completed so
this is the four star that we're talking
about this is exactly what we are going
to be seeing as a demonstration over
here with one of the agent called as
hugging face small agent I've already
talked about this small agent before but
I'm going to show you bit more detail
how we can use it for the automation
testing purposes so let's quickly jump
into that particular uh demonstration I
will show you how amazing this tool
really does things so as you can see I
have just created a very very super
simple code uh with the small agent in
the python over here and and this is the
line that I have cre over here like I
have imported the small agents uh
Library uh and I have also imported the
following class from this particular
Library the small agents library and the
code agent is the one which is
responsible for uh holding all the
different tools as well as the models so
if you're going to have uh a tool if you
I mean for definently because we're
going to talking about the code which is
going to talk in the internet to grab
some information you need to pass this
tool like Duck Duck Go search Search
tool this is going to perform the search
operation on the internet for you that
is the tool that we're passing in over
here and you can pass any number of
tools that you wanted I mean there are
many different tools available you can
pass it as well as an axillary help for
this particular agent and then we are
going to pass the model over here with
this hchf API model so the default model
is going to be Qin model which is going
to be chosen from the hugging face API
uh with the hucking face Hub but if you
want to specify any uh any model as well
you can do it for instance you can pass
GPT 40 if you wanted to or you can also
pass Cloud anthropic and you need to
supply the API key for that matter and
once you do that it is going to talk
with those agent to perform the
operation so the code agent is not
limited to any specific model it's going
to be uh it's just open for any
different model that you have uh
specified over there which is amazing
and now in this particular agent I'm
just going to say run and I'm going to
specify some task which it needs to
perform so I'm going to say uh perform
or
write a uh code or uh maybe I can just
copy paste the one that I have already
written over here for playwright instead
of playright I'm just going to say
selenium so I'm saying write a selenium
test code to run the test in an headful
mode for this particular URL uh uh and
then perform a login operation uh and
then navigate to the employee list link
and create a new user with some
realistic data see I'm doing quite a lot
of things over here I'm telling this
agent to perform these operation for me
so this is the command that I'm giving
to the AI agent to perform these
operation and the AI agent is going to
do all these things for me so just to
show you uh on the context of what we're
talking about uh with the AI agent so if
I go to this application over here uh
and if I go click this login you see
that I'm going to get this particular
link or URL
and I'm asking the a agent to go and
login for me without me supplying the
username and password whatsoever and I'm
asking the agent to go and click the
employee list click this create new
button and enter some realistic
information on this particular uh
particular window and make the task
completed and it's all going to happen
on my browser it's like it's not going
to be happening somewhere in the large
language model or Cloud anywhere it's
going to happen on my machine
with the agent and that's when you are
letting the large language model the
capability to go and talk uh to the
external world like my machine uh to
perform any action that is the power of
the agent itself guys now the agent has
got the capability to go and talk to the
external world with this agents over
here so now I'm just going to save this
code and let me try running this code
just three lines of code it's going to
do all the Magics for you and see what
are the Magics going to happen over here
so the moment I say Python 3 small uh
agent demo the small spelling is wrong
it's just SM o uh agent uh not SM o l e
agent or whatever you see that now it
has chosen a model for me which is the
Qin uh coder 32 billion uh instruct
parameter model uh and now it's going to
perform the action over here for me with
selenium python code and it is trying to
run the code but before itun the code it
is going to search on the internet like
what are the website which has uh which
it has got to perform the same kind of
operation that we have told to perform
that operation it is trying to learn all
the information and now it has created a
code which it can execute on my machine
right and then it has written a code for
it as well like how it's beautifully
doing that and now it has really failed
I mean this code is meant to fail and I
there is a reason why I wanted to show
you this time is that you see that this
selenium import has actually not
happened and because we are telling the
agent to Performance selenium operation
the selenium does need some libraries to
be executed the code needs to be
executed on the context of this uh small
uh agent uh box so how do we actually
let that happen so we need to somehow
tell this uh this agent to hey uh you
know what import this web driver library
or serum library for me just let this uh
thing to happen see because we have not
let this happen to the agent now the Cod
has just manually provided me the steps
to perform the creation of a new user on
the website and the test has got I mean
the task has been completed so now I'm
going to let the agent to really get
that capability of executing me
executing on my machine and the way I
can do it is I'm going to set the
additional authorized inputs uh over
here uh I'm going to say this is going
to be an array sorry like that and I'm
going to say uh selenium so go and have
this selenium thingy uh for me and also
s web driver common key uh and
common uh buy uh and then probably uh
let's say web driver manager. Chrome as
well if you remember the web driver
manager is also required uh if it's
going to launch the browser so I'm going
to give it just in case if it doesn't
really require that it's not going to
really use it so I'm going to give all
these three Imports like an additional
Imports for the agent to perform the
action for me and now if I try to run
the same exact
code you'll notice that it is going to
perform all the action by having this
import capability now hopefully it is
going to the agent is going to open a
browser for me so now see that it has
got all the learnings from the website
like how to automate an application and
the step one it is now writing the code
got it checked and now you see that it
has opened the browser for me and it's
entering the username and password
without me supplying the username and
password which is crazy like how it has
learned even my username and password
from the uh internet uh and then it is
trying to uh perform the action but see
that first time it couldn't be able to
achieve the uh operation successfully so
it has just abruptly failed there to
perform any action on the UI uh and and
see that just with a log off like login
operation it just failed now it's trying
to do the same login operation second
time and third time uh and now it is
clicking the employee list which is also
happening and should create click the
create new user it's done and now we
should enter the user details so now the
AI agent for the AI agent this this page
itself is new right like it needs to
learn that particular page the agent has
now learned that page see now it's
running third time to see if it it could
a ble to perform any action on that
particular page because it has learned
the page this time you see that it's now
learning the page uh with all the uh
page source as well behind the scene uh
it is gaining all the information
required to achieve the task and for the
fourth and final time this time you will
notice that it is going to go create the
user with the information as you can see
there which is amazing right like it has
learned the page it has performed many
tasks to make that happen and the action
is completed which is amazing so you see
that now the AI agent has reached like a
maximum step but it has really achieved
the goal of completing like creating uh
creating a user and it it has
successfully created a new user on our
website which is amazing right like this
is what is the task that the AI agent is
doing a lot of re TR operation to
perform this
operation and this is amazing already
because now with just few key strokes
from our side we could able to do an
automated UI testing using selenium with
this
agent and I have tried even further to
see what this agent is really capable of
can it really do any API testing like
how we do like a big workflow of testing
so I tried that as well so I have
actually went a level further and I just
went to um this particular website like
uh the API uh restful API dodev like
restful uh api. Dev website you can see
that this is an API uh which is
available 24 bar7 for free to perform
our testing purpose so they have got
some end points over here you can do uh
like a get operation post operation put
patch and delete operation you can do
every single thing with this particular
API endpoint and you can also store the
responses and do all things there so I'm
going to use this particular uh apis
that I have got and I'm going to do an
test over there so I have already copied
the uh really I have some commands that
I wanted to perform the action over
there so I'll show you what I really did
this is the same kind of operation I
tried doing with my mCP playright server
to to show you how the mCP like Cloud
mCP can actually use play's API
capability to do all this action with
the tool that I Define fine but over
here it's it's like next level where you
don't have to do anything that agent is
going to take care of that all of this
for you so I'm going to say prompt is
equal to and I'm going to just put like
string literals here I'm going to paste
that command over here essentially my
prompt I'm saying is perform a post
operation for me for this URL this this
one with this body so I'm passing the
body of that particular uh post
operation and I'm also telling that
verify if the response is create has a
created at and ID properties and store
this particular
ID uh in a variable like product ID
which I'm going to be using as a future
reference so basically I'm just telling
like a like a postman where you just
store like a variable uh in a for your
operation so you can do that as well and
then I'm going to ask the same agent to
say like perform a get operation for
this particular uh um endpoint with the
product ID that you have
stored in the variable right and now you
also perform a put operation for me for
this same product ID by updating the
value and then also perform a patch
operation just to update a specific uh
value out from it and also now verify if
it has if the response has got an
updated at property uh with this value
you see that I'm telling a lot of
workflow operation for API testing to
the agent and now the agent is going to
do all these things for me hopefully so
let's see if that really works so I'm
going to just save this code uh and I'm
going to comment this serium line of
code and then I'm going to ask the agent
to run the prompt for me this code is
also going to fail for the first time
I'll tell you why because we are going
to be asking the agent to perform uh an
actual HTP request operation so we have
to uh tell the agent uh or maybe let the
agent to give the capability to go and
talk to the external world and you see
that now the uh code has been written
but it couldn't able to perform any
action because the requests library is
missing uh from for the agent so
essentially this is pretty cool because
you see that now the agent has got like
a simulation task to perform like a get
request verified put patch verified but
it's really not doing anything behind
the scene it's just trying to simulate
as if like the the operation is
successfully done but it's not really
doing anything on that actual API so now
let's give the capability to the AI
agent to perform this action so I'm
going to go ask the agent uh to I mean
go ask the code agent to have this
Library imported as well so I'm going to
let the agent to go and import this
Library uh for your operation and now if
I'm going to go and try to run the same
code that we executed before this time
you will see that the agent the code
agent has got the capability to go and
talk to the external world you see that
the first thing it did is like post
operation and it is trying to oh yeah
there we go it has did that and you see
that it is getting a response coming up
over here and has got the ID over here
and then it is going to I mean this is
the get operation that is trying to do
yeah there we go see that the get
operation is done the post operation is
also done uh and it has stored the
particular ID if I'm not wrong uh and it
is doing a patch operation it's also
doing that successfully over here see
that the patch operation is also working
uh and finally it is going to perform
the yeah and finally the patch operation
is the final operation right like so it
has completed all the operation and it
has successfully completed the those
things like just 2.48 second it has
completed all the API testing for us and
the agent is now capable not just the UI
testing but is also capable of doing API
testing and as you can see which is
mind-blowing that's it guys this is how
we can see how we can use the power of
AI agent for automation testing uh as
well as uh the API testing in much much
easier fashion with just like manual
commands like a user command with a
plain English text and it's just going
to work just let me know your thoughts
about how these things are really coming
through and how it's changing the
landscape of testing we can probably
discuss even more detail about the AI
agents in our upcoming videos of this
particular YouTube series but I'm sure
this is quite exciting once again thank
you so much for watching this video and
you guys have a great day
Loading video analysis...