[00:00:00] Speaker 1: In this video, I'll show you step by step how to build an AI agent in UiPath from scratch. Some tasks follow the same steps every time, which makes them a great fit for traditional automation, but other tasks require judgment. You might need to evaluate information, make a recommendation, or decide between multiple different options. That's where AI agents come in. We'll build an AI agent that takes a request, evaluates a list of options, and selects the best fit. We'll do everything from the command line, and then bring the agent into UiPath's visual environment so you can test it and see how it works. There are multiple ways to build AI agents in UiPath, and later I'll show you the visual approach. By the end of this video, you'll have a fully working agent that you can adapt for your own use cases. I'm Kevin, and this video is sponsored by UiPath, who helped support this tutorial. Let's dive in. For this example, we're going to build a simple agent that takes a request and recommends the best option. To keep things easy to follow, we'll use cookies. For example, if someone says, I want something chocolatey, but not too sweet, and the options are chocolate chip, double chocolate, oatmeal raisin, and sugar cookie, the agent should pick chocolate chip. That's a simple example, but the same pattern could apply to many real-world scenarios, like let's say routing support tickets, recommending products, or selecting the best option in a workflow. All right, let's go ahead and build this step-by-step, starting with the command line. First, we need to install the UiPath CLI, or command line interface, which is what we'll use to build and manage our agent from the command line. I'm using VS Code, which is free to download and use. I've included a link below, but really any terminal will work. In VS Code, start out by opening a new terminal, and then set the type to git bash. Next, we need to make sure that you have Node.js version 18 or later installed for this. If you don't have it, you can install it at the link that I've included in the description, and then once you install it, reopen VS Code. Once you have it installed, run this command right here to check the version that you have. I'll run this, and there you can see that I have at least version 18 or later. Now, as a note, you'll find all the commands that I run in the description of this video, so that way you can just copy and paste it from there. Now, let's install the UiPath CLI in AgentTool. I'll type in this command, and then hit enter. Once that's installed, we can verify everything worked by checking the version. I'll type in this command, and then hit enter. And right there, I can see version 1.1.1. If you see a version number, you're good to go. Next, we'll install the AgentTool, which adds the commands we need to create and manage our agent. I'll type this in, and then run it. Now, run the following commands to ensure that it was successfully installed. And right here, it looks like it was successful. As an optional step, if you're using a coding tool like Claw, Copilot, Cursor alongside the CLI, you can install UiPath Skills for Coding Agents to give it context on agent projects and commands. This can make it easier to build and troubleshoot your agent, but of course, it's not required. Everything we're doing here will work without it. If you want to use it, you can run the following command right down here, and simply replace the agent name with whatever tool you're using. Now, in my case, I happen to be using Codex, but you can replace that with Claw, Cursor, Copilot, or Gemini. Here, I'll run it. Right up above, I can see that it successfully installed all of these different skills. Before we create our agents, we need to authenticate the CLI so it can connect to your UiPath account. Right down here, enter in the following command to log in. This will open up a browser where you can sign in and select your tenant if needed. If you don't have one, you can also sign up for the free community edition. Now that we're signed in, let's create the solution and the agent. In UiPath, the agent lives inside a solution. The solution is the container that we'll eventually upload into Studio Web. Now, as a first step, let's create a working folder. I'll call mine Cookie Agent. Now, feel free to use the same name if you'd like to follow along, or you could use your own name. Here, I'll create that directory, and then let's move into it. Next, create a new solution. In my case, I'll call it Cookie Selector. Now again, if you want to follow along, feel free to copy, or you could use your own name. Then, run it. This creates the solution structure, including the solution manifest that UiPath needs when we upload everything later. Now, let's create the solution project inside the solution. Here, I'll type in this command. Now, the first cookie selector is a solution folder, and the second cookie selector is the agent project inside the solution. Now, run it. Let's now move into the solution folder. I'll type in this command, and then from here, we'll configure the agent by editing the JSON files directly. Now, let's configure how our agent works. Over on the left-hand side, let's open the Explorer, and then navigate to where you have your project files. Here, you'll see the cookie agent working folder, the solution, and then the project, and all the associated files. The agent is defined in two files. We have the agent.json and entrypoints.json. Agent.json controls the agent itself, including the model settings, system prompt, input schema, output schema, and the message structure. Entrypoints.json exposes the same inputs and outputs to the solution runtime. The important thing is that the input and output schemas need to match in both of these files. For this example, we're building a cookie recommendation agent. It'll take a user request, look at a list of cookie options, and return the best match. Let's start by opening the agent file right here. I'll double-click on this, and let's adjust the size so we can see the JSON file better. We're going to replace the contents of this JSON file with the version linked in the description below. So over here, I'll highlight all this content, go all the way to the bottom. However, I'm going to leave the project ID here. This was generated by the scaffold, since this value will be unique to your project. I'll remove this, and then paste in the JSON file from the description. Let's take a moment to look at this JSON file. Now, this file controls how the agent works, and there are really three main areas to pay attention to. Right here at the top, we have the input schema, and this defines what data the agent expects. In this case, the user is going to describe the type of cookie that they would like, and we also give a list of cookie options to choose from. Now, if we scroll down a little bit more, here we have the output schema, and this defines what the agent returns. So, based on their request for a cookie, the agent will provide a cookie that it recommends. Now, if we scroll down just a little bit more, here we have the system prompt that tells the agent what to do. Next, let's open up the EntryPoints.json file right over here. Here too, we'll replace the contents of this JSON, but we're going to keep the unique ID that was generated by the scaffold. So right over here, I'll highlight all this content, and here I'll paste in the new content. Again, you'll find this in the description. This makes the same input and output schema available to the solution. If you adapt this for your own use case, the main things to update are the system prompt, the input fields, and the output fields. Just make sure that the schema matches in both the agent.json and EntryPoints.json files. Before continuing, make sure to save both the agent.json and EntryPoint.json files to capture all the changes that we made. Before we upload this, let's validate the agent and make sure that everything is set up correctly. In my terminal, I'm currently in the working folder, so let's change into the solution folder. Now, let's run the following command to validate the agent. Right up above, let's expand the terminal so we can see the output better. This checks that the agent definition, inputs and outputs, and entry points are all valid. Now, right up here, I can see the result says success, so that looks good. Now that the validation has passed, we're ready to upload the solution to UiPath Studio Web. To upload the solution, run the following command in the solution folder. This uploads the solution into UiPath Studio Web as an editable project. Now, once the upload finishes, if you scroll up towards the top, here you should see a message saying result success. That's great. Now, right below that, we also have what's called the designer URL. You can open that link directly in your browser. Let's click here. This is where UiPath bridges the gap between code and low code. We built the agent from the command line, and now we can open it visually in Studio Web to test it, inspect it, and continue iterating. Once Studio Web opens, you should see the agent in the agent builder. Over on the right-hand side, you'll see the system prompt along with the request and options inputs that we defined earlier. To test it in the top left-hand corner, let's click on debug. Here, we can pass in sample input as JSON. So, right here, I'll paste in something like this. Here, we have the request. I want something chocolatey but not too sweet, and then I pass in all the different options. Once you finish entering this in, in the bottom right-hand corner, let's click on save and debug, and that'll run the agent. Once it finishes, right here in the center of the screen, you'll see the result. Here, we have all the input that we provided, and down below, we can see the output with the cookie it thinks is the best match. And in this case, it looks like it's chocolate chip. You can try different inputs here to see how your agent behaves and refine the prompt over time. Let's try again. Let's go back up to debug and click on that again. Right down below, let's now change the request. So, this time, let's say I want something classic with raisins and oats. Now, I would expect it to return oatmeal raisin, but let's see what the agent says. In the bottom right-hand corner, let's now save and debug. And right over here, it returns oatmeal raisin, just like we expected. Now, of course, this is a really simple example, but the same pattern can apply to many business scenarios where you need to choose the best option based on a request. Now that we tested our agent, let's look at how to improve it over time. As you try different inputs, watch the outputs and adjust your system prompt if needed. You can make the prompt more specific or add constraints to guide the result. UiPath also includes evaluation tools to run multiple test cases and track performance. Over time, you can iterate on your prompts to make the agent more reliable in real workflows. Now, I want to show you something. Everything we just built from the command line can also be built directly in UiPath's agent builder. You can define your prompt, configure inputs and outputs, and test your agents all from a visual interface. Now, this could be a great option if you want to prototype quickly, or maybe you just prefer a low-code experience. Whether you like working in code, a visual builder, or maybe just a mix of both, UiPath gives you the flexibility to build the way that works the best for you. Once you've built your agent, the next step is integrating it into larger workflows across UiPath using something called UiPath Maestro. Maestro lets you orchestrate agents as part of the end-to-end workflows, passing data in, receiving decisions back, and coordinating work across people, systems, and AI. I have a full video on UiPath Maestro if you'd like to learn more. You'll find a link right down below in the comments and also in the description. Let me know in the comments if you have any questions or what you'd like to see next. If you want to go deeper, check out the UiPath playlist right there on the screen for more step-by-step tutorials. Thanks for watching, and I'll see you in the next video.
We’re Ready to Help
Call or Book a Meeting Now