Claude Managed Agents Full Tutorial: How to Setup Your First AI Agent
By Bart Slodyczka
Summary
Topics Covered
- You Only Pay When Claude Agent Is Active
- Environments Are Like Rooms with Tools
- Create Specialized Agents for Each Task Type
- The 15-Second Wait Is Not Production Ready
- One Configuration Enables the Entire Workflow
Full Transcript
Hello legends. In this video, I'm going to give you a full overview of the new Claude managed agents. I'll start by taking you through the new managed agent section in the Claude console. We'll
spin up a brand new agent from scratch and we'll understand what these things are, which are sessions, environments, and credentials. And then after we
and credentials. And then after we created our agent and done a bunch of testing within the Claude console, I'll then show you how to deploy your agent into the real world. So for today's example, I built a basic chatbot where
I'm using N8N as the front end and then the back end is the Claude agent. And
I've decided to use N8N for the integration layer because it's going to be very easy for me to explain all the different API calls and like that you need to actually stitch the AI agent into the webchat. So let me give you a
quick demo of how this works. I'm just
going to message my agent that my hot tub is broken. And here we have the response from Claude. And back in the Claude console, we can see a new session was created 30 seconds ago. And over
here you can see the message that I sent in to start the chat and then the response from Claude. And actually, this is a really cool situation here because the fact that we have sessions, we can create one single agent, like a customer
support agent, and then every time a new customer interacts with us, like creates a new ticket via email or starts a new chat session via the N8N widget, all we need to do is create a new session, and then the entire context of that
conversation is private to that customer. And now back in the chat
customer. And now back in the chat widget, if I send in a new message and we come back into the session, we can see that my message was sent in that I tried the water and it's working, and then we had the response from Claude.
And this all occurred in that existing session. And here's that response. And
session. And here's that response. And
as you can see, the implementation layer to get this working is like 10 nodes in N8N. So it's actually very easy. But
N8N. So it's actually very easy. But
before we look at N8N, let's actually start by creating a brand new agent. So
the first thing you need to do is go across to your Claude console. If you
don't have an account yet, then just go to platform.claude.com,
to platform.claude.com, create an account, and make sure you upload some credits. Now you're going to need to upload credits to your account because the Claude managed agent is actually charged in two main ways. The
first way is that it uses your tokens.
So it's not using your actual Claude account if you got Pro or Max. You're
not using the subscription, you're actually using tokens. And the second way it's charged is at the actual runtime. So you're charged at $0.08
runtime. So you're charged at $0.08 per session hour and only while the agent is running. Now just to slow down here for a second, you're not actually
charged $0.08 per 24 hours in a day, 7 days a week, 365 days a year. It's only charged for the duration of time that it's running.
So right now, for example, the chat that I was having with my agent, since I'm not messaging any questions and getting any responses, so right now it's totally free for me to run. We only get charged while it's running, so while it's
executing tool calls or generating a response or basically completing the task that you built it to complete. But
while it's waiting for the next next task or the next response or it's rescheduling or it's terminated, it's not actually costing you anything. So in
this first section where we see we have 5.7 seconds to process, this blue bar, this is actually the first message that I sent, the pink section here, and then the blue section is the response. This
entire thing would have cost me for the runtime and API keys, but then this time while it was idle and actually just waiting for me to respond, which is 2 minutes and 28 seconds, you can see it
says idle there, I wasn't charged. And
then my next response, which is over here, we have my response and then the AI agent response back to me. Both of
these things were charged at the runtime and also at the API tokens. And you can see a full breakdown of all the tokens that you have per message sent. So we
have input three case read, 26.7k case write, and then the output. And same
thing for that next response. Now when
it comes to building your agent, you can definitely use one of these pre-existing templates. You can just start from a
templates. You can just start from a clean slate or you can just have a conversation with this agent and get it to create one for you. I want to create a customer support chatbot for jewelcard.com.au.
jewelcard.com.au.
It needs to be able to handle general FAQ questions and also troubleshooting questions. And if it can't fix the
questions. And if it can't fix the problem or the customer is asking to escalate, then it must raise a task in ClickUp. So we're just going to start by
ClickUp. So we're just going to start by building a very basic customer support chatbot that'll be able to read information from my website. And then
for ClickUp, I've got a sample list where I want to raise new escalations, so I'm just going to copy this URL. And
I'm just going to say raise escalations here. And now we have the agent creating
here. And now we have the agent creating the initial configuration. So now we can keep having a conversation directly by messaging back into here and giving it more tool access or giving it more comprehensive instructions. But for now,
comprehensive instructions. But for now, I'm just going to go and create this agent. Awesome, and the bot is ready to
agent. Awesome, and the bot is ready to go. So the next thing for us to do is
go. So the next thing for us to do is configure the environment. And as we can see here, the environment is the cloud container configuration that your agent runs inside. So imagine you have an
runs inside. So imagine you have an office space and the environment is like creating a room, and within that room we have access to all different tools and files, basically everything the agent
needs to get the job done. And then over here we're asked about network access.
Because I mentioned before I want to be jewelcard.com.au, I'm just going to go
jewelcard.com.au, I'm just going to go limited and only restrict my web search ability to my domain. So the environment was created. Now let's start our
was created. Now let's start our session. And perfect, we picked up that
session. And perfect, we picked up that before we actually start the session, we need to set up the ClickUp MCP authentication. So I'm just going to
authentication. So I'm just going to scroll down to here. I'm going to acknowledge and accept and click connect. Just going to approve the
connect. Just going to approve the connection to the workspace. Now
everything's set up, so let's go for a test run. So now on the right hand side,
test run. So now on the right hand side, we've got a testing panel. This is
similar to that interface that we saw before with N8N, where we send messages in and then the accumulated session, like the responses and the tool calls, is all going to show here. This is
actually really nice and neat. I didn't
write this message, Claude just generates it automatically. So I'm just going to send this. And while we're here, we're going to get a play-by-play of everything that's happening with the assistant agent creator on the left hand side. So we have the response, which I
side. So we have the response, which I can click into and look at the entire contents of. This looks pretty cool. I'm
contents of. This looks pretty cool. I'm
just going to reply back and say, "I need to escalate to a human." Just to trigger that escalation process. Let's
close down this message, and now we have that next response from Claude. So I
want the name, email address, and some other details. There we go. So now
other details. There we go. So now
hopefully the agent will pick this up and then execute a tool call. I'm just
going to go into the debug section to see if it does call that tool. And it
looks like over here it hit that tool, and then that second section over here has the result, which is success is true. And just to confirm that, back in
true. And just to confirm that, back in ClickUp, we have this task created, customer escalation bar hot tub won't turn on, and that's all the information that I gave it. So now at this stage, I'm really happy with the agent and I'm
ready to deploy it to N8N. But before we deploy it, I want to take a look at exactly what's going on in this interface so we understand what we need to do on N8N side to facilitate that integration. So at the moment, we're in
integration. So at the moment, we're in the quick start panel and we use the agent assistant mode to help us create an agent and then we had a conversation, we created a ticket. So essentially what we did over here was we had a session
with the agent that we created. If I go into view session, this is a similar view to what we had before. We have the full breakdown of my message and a response, the downtime that's not charged, the next message, the downtime,
the next message. So just to explore the panel a little bit further, if we go into the agent section, this is where we find all the different agents that we're creating. So we just created the
creating. So we just created the Jewelcard customer support bot, but if I wanted to get a bot that plugs into Zendesk and handles all of my email responses, then I would go ahead and create a new agent in the exact same way. If I wanted a document parsing bot
way. If I wanted a document parsing bot that would receive invoices and then process them and then add them into my accounting software, then I'll go ahead and create a new agent. So from this view, if I click into my agent, I can
see the entire configuration, the system prompt. The default model now is Sonnet
prompt. The default model now is Sonnet 4.6, this might change in the future.
All the MCP connections, any skills that I got configured, and then I can see all the sessions related to this agent, which right now is just one. And up the top here, I can either choose to edit the agent manually or go back into that
guided edit mode. And then we have the existing configuration on the right hand side, and we can continue talking with the agent assistant on that left hand side, which I recommend doing for now.
So sessions we already looked at, we understand how this works. This gives us the ability to create an agent that completes one task, and each session is a different completion of that task. It
can be a different invoice that we process, it can be a different day that it runs, or it can be a different customer that it interacts with. We've
got environments where you create one environment per agent or maybe a bunch of different agents share one environment. For now, I would just do
environment. For now, I would just do separation of concerns. So our customer support agent has its own customer support environment. And looking inside
support environment. And looking inside here, we have some more settings. And
then finally, we go into the credentials vault. And the credentials vault
vault. And the credentials vault contains all the different authentication that we need for different tools that we're using. So
before I authenticated with the OAuth for ClickUp, and that's why it's available here. So based on all the
available here. So based on all the stuff that we just saw, we know that we have the ability to actually choose between agents. So if we want to deploy
between agents. So if we want to deploy within N8N, we have to have a way to choose the agent we want to deploy. Also
with sessions, as we saw, we have the ability to create a brand new session from scratch, so like sending a brand new message as a new customer, or the ability to go back into an existing session and append the new message. Same
thing with environments, we can create multiple environments and assign an agent within an environment, and the same thing with credentials. So
technically speaking, we need to take care of all four of these things within N8N. And thankfully, if we go back into
N8N. And thankfully, if we go back into the documentation where we're looking at the Claude managed agents overview, scroll down a little bit, click into the API reference. We've got a really
API reference. We've got a really well-documented API reference here. It
does everything from managing agents, environments, sessions, and vaults.
So I recommend just uploading the link to this page to your to Claude and asking it to explain some of these API endpoints. Or actually, what I did for
endpoints. Or actually, what I did for this video is I created a new Claude co-work project. I uploaded some key
co-work project. I uploaded some key like URLs into that project. I said,
"Understand these API endpoints. This is
what I want to achieve." And it helped me actually create these API calls, which headers I needed, what the configuration was, what the body of the API calls had to be as well. So
definitely do that. And now it's actually time for us to go back into N 8 N and take a look at things. So, within
N 8 N, if this is the first time you're seeing this tool, N 8 N has a native web chat interface, and you can just deploy that by using this node, which is what I'm doing over here. I just copied this URL, and I was able to paste it into a
new browser, and that's how I'm able to have a conversation with the agent. So,
this was my interaction layer. So, then
the idea is, as we send a new message into this system, the first thing we're checking over here is if an existing session exists. So, we already know that
session exists. So, we already know that when you're creating a new chat, we need a way to uh create a new chat session.
We have an API for that, but we don't want to create a new chat session every time we receive a message. So, if we just open up this node, we can see the import from this node is the actual
message received from the user, as well as a custom session ID. So, that session ID is the exact same as long as I'm in the exact same chat session. So, that's
why when I sent this message, it came into the same session in N 8 N, and then when I sent this message, it was also appended with the exact same session ID.
So, as the message comes into here, we're then checking our database to see if that session already exists. The
database layer is super simple. It just
carries two main variables. One is the user session ID, so that's the session ID from N 8 N, and then if we want to create a new session and have a ongoing conversation with Claude, we just store
the Claude session ID as well. And all
we're doing here is just matching up that user session from N 8 N to the generated Claude session ID. So, then
the idea is if we go through this process and it turns out it's a brand new message for a new chat session, we just take this bottom route and create a new session using the API. But, if we do pull out some information from the
table, which means an existing session exists, we just go into this existing session route. So, for managing new
session route. So, for managing new sessions, all we need to do is use the create new session API. Once we create a new session into the API, we've got to use another API call to send in a
message into the API. And then once that message is sent, we need to wait like 10 20 seconds for Claude to actually go ahead and execute the tool calls, look at your MCP connections, look at the files you've got attached, and generate
the response. And then after the
the response. And then after the response is generated, we need to list all the messages that exist within that session. So, to explain that using the
session. So, to explain that using the API docs, we first have to create a new session. So, we came into this session
session. So, we came into this session section over here and used the API for creating a new session. You can just copy this directly into N 8 N using the curl command, and then just fill out the variables for yourself. The dynamic
stuff here is the actual agent ID and then the environment ID. So, let's go ahead and configure it up to our brand new agent. So, just scrolling down here,
new agent. So, just scrolling down here, I've got the JSON body, which includes the agent ID, so I know I'm speaking to the customer support agent within a certain environment with all the different tools and access that I give
it. And then I also have this variable
it. And then I also have this variable called vault IDs, and the vault ID is just the ClickUp authentication access that I gave to this agent. So, I need to pass that through as well. So, the first thing I want to do is grab the agent ID.
I'm going to copy this and paste it into here. Next, I want the environment ID,
here. Next, I want the environment ID, so I'm just going to copy this, paste it into here, and then I want the vault ID.
So, I'm going to copy this and paste it into here. So, now if I just send in a
into here. So, now if I just send in a brand new message, let's actually go through this process and see what happens here. So, at this create
happens here. So, at this create session, after we execute the create new session, if we just go down to the very bottom, we've got a new variable over here that contains the session ID. And
now that we have the session ID, and if we go back into the sessions tab, we can see that N 8 N API call just created this new session. So, then we're setting the session ID, we're storing the
session ID against the user ID within our table, so that on our next message, we actually pull it out and take the top route, which is existing session. And
now, it's time for us to send a first message into the session, so everything's already carried through because we're using the variable placeholder for Claude session ID. And
if we scroll down into the body over here, we're also passing in the message.
Now, there's a bunch of different bodies that you can send. You can actually attach files or images uh and do a couple of different things, so it's worth looking into the documentation to see how to structure the body of
different API calls. So, if we send in the first message, we can see that message was just received, and then we have the response from Claude. Now, I've
got this very simple wait step, which just waits for 15 seconds. And this is meant to be a slight delay that when we send a message into Claude, we get a response back. This is very simplified.
response back. This is very simplified.
It's not production ready. I would
definitely ask your Claude for assistance on how to create a better loop here, because sometimes your Claude tasks might take a few minutes to execute, so then waiting 15 seconds is actually not the answer. And then after
we waited enough time, we can execute the next step, which just brings all the events from that session and lists them over here. And then we're using a code
over here. And then we're using a code node to just get the most recent message from the agent and then display it back to the user. So, as you can see, the only edit we had to make here was just for creating a new session, where we
have to define which agent, environment, and credentials we're using. Otherwise,
everything else is already carried through to the different API calls. And
now, if I send another message back into the system, "How are you?" We're going to be taking the top route because we actually found the credentials stored in our database.
We didn't have to change any of the API information here because we're already extracting the existing session ID from the database. And same thing with the
the database. And same thing with the list message API. And then finally, we have that response back, which is "I'm doing great. Thanks for asking." And
doing great. Thanks for asking." And
then to deploy this workflow, all you need to do is publish the workflow, then come back into this first node, copy this URL, paste it into a new browser, and then have a conversation with your agent. All right, guys. Thank you very
agent. All right, guys. Thank you very much for watching this video. If you
want to see more build-outs of Claude agents, subscribe to my channel and drop a comment of what you want to see. See
you in the next one.
Loading video analysis...