Pi Agent – Crash Course | Minimal Coding Agent

Alejandro AO4,996 words

Full Transcript

Good morning everyone, how's it going today? I hope you're having a wonderful day. Today we're going to be taking a look at the Pi Agent Harness, which let me just add the animation right here. It's a beautiful Agent Harness, very minimalist, that is taking the world by storm recently. I have been trying it for the past few weeks and it works great. So the idea is that this video is the only video that you need to actually get started with it. We're not going to go over every single feature, just everything that you need to actually start using it. Later, if you're interested, I may do a crash course about more detailed features. So what we're going to do is, first of all, say what is the Pi agent, then how to customize it, then what are Pi extensions, and then what are Pi packages, okay? So without any further ado, let's get right into it. All right, so very quickly, let's talk about what is actually Pi. and it's very straightforward. It is an agent harness that is very minimalist and it grows with you. When you just install it, it comes with only four tools instead of all these bloated agentic harnesses that are out there and it comes with pretty much no features. You really just build the features that you want. So for example, let me show you. So it doesn't come with MCP, it doesn't come with sub-agent support, it doesn't come with permission pop-ups so it is able to just do whatever it wants. It doesn't come with plan mode and it doesn't come with built-in to-dos or to-do like this tool that actually tracks the to-dos in real time. What it offers instead is that you can add MCP support if you want. You just have to ask Pi to enable MCP support. You can add sub-agents if you want it. There are no permission pop-ups, but you can either run this in containers or build, ask Pi to build a permission pop-up system which is actually what I'm going to show you in just a moment. There is no plan mode so instead of doing that it can write the plans to its files or it can just implement its own plan mode as well. That's also possible. There is no built-in to-dos. Ideally what they recommend is that you use a to-do.md instead or you can also build it. But let me show you how to install this. So what you're going to do is you're going to copy this thing right here. You're going to go right here. You're just going to execute and there you go. Now I am not going to reinstall it because I already have installed. But once you have installed it, you're going to be able to just do pi and you will see this terminal interface. And it's very straightforward. It will already load the skills that you have in your .agents file immediately. But something important is that if you just installed it, you're not going to have any models in it. So you're not going to be able to use it with any LLMs. So in order to actually be able to use it, you're going to have to do login. And there are two ways to login. You can login with a subscription or with an API key. In this case, I have logged with an API key from HuginFace, but you can also log in with a subscription, for example, from Anthropic, from ChatGPT, or from GitHub Copilot. I do think that Anthropic has discontinued and disabled third-party harnesses, but you can still use it for ChatGPT and Copilot. In my case, I have already selected HuginFace, so I'm using all the models from HuginFace inference providers. so what I can do now is I can just do slash model and I can just select from either my favorite models or from all of the models available in Hugging Face right here so I can use Gwen, Minimax, DeepSeek, Kimi, etc. In this case I'm sticking to Minimax for the demo but know that that is also a possibility. Remember that if you want to do that all you have to do is login with an API key, search for Hugging Face and enter your API key. Okay. All right. So now let me show you some of the features. Okay. So the first thing that I want to show you is the way to change models. I already showed you a little bit about this, but you can do a slash model and you will be able to go through all of the models that you have available for any different subscriptions or API keys that you have added. In this case, I have only Hugging Face, but you can also remember that you can just do login and add any other provider and you will have all of them available when you do slash model. Okay. Now, as you can see right here, I have two different scopes. So I have all and here if I hit tab, I go to scoped, which are kind of my favorite models. So in order to set your favorite models, what you're going to want to do is to slash scoped models like this. And here you're going to be able to select them. So say for example, that I want to at minimax 2.1 as well. What I'm going to do is just go through it, hit enter, and now it is right there. Then I hit ctrl s and I save it. And now if I just get out of here, I can just do ctrl p to switch across my favorite model. So for example, ctrl p glm, ctrl p deep seek, minimax, minimax, key me, etc. Okay, so that is what you can do. And also, there's also the possibility of changing the thinking level of your model. So some models have thinking levels available, so low, medium, high, etc. And if you want to do that, all you're going to want to do is shift tab like this. And there you can see that it's minimal, low, medium, high. For example, that's for GLM. If I want to switch, for example, let's switch to DeepSeq, I can also switch from minimal, low, medium, high, etc. Okay, same thing. If you have your codec subscription connected to Pi, you will also be able to change your thinking level for GPT 5.5, for example. All right. So something I want to show you right now is prompt templates. Now, these are prompts that you can do kind of like slash commands or custom slash commands that whenever you type them, they're going to be your custom prompt. So what you can do is actually ask Pi to create its own custom prompts. And that's a little bit easier. And then you can customize it like that. So for example, right here, I'm going to ask it, create a custom prompt for code review. Make it detailed and very thorough. And there we go. And as you can see, it is reading its own documentation in order to be able to update this and to apply the things that I asked. And there you go. It has finished doing the whole thing. Now it has added my new custom prompt. Now, something to keep in mind is that whenever you update Pi or you ask Pi to update itself, you're going to have to either restart Pi or just ask it to reload like this. And now that it is reloaded, I should have my new prompt right here, which is code review. And as you can see, I can just hit enter. And I just going to stop it because in this case I am not even in a coding workspace but just to show you that it replaced my slash command with all of this very detailed explanation of what I want so if you find yourself typing the same prompt over and over what you can do is just put it into a custom prompt and it will do just this and you can of course add variables to it and it just makes working with your coding assistant much more simple now to give you an idea of where this is stored just to give you some general culture about this. I'm just going to do control D to get out of pi. And let me show you where it is located. So if I go to my home folder, and I go to dot pi, you will see that I have my agent folder right here. So I go inside agent. And inside it, you can see that I have extensions, prompt sessions, etc. So this prompt was stored in prompt. So I go to prompts. And right there, you will see that you can see my code review. So I can just open it and as you can see it is this code review that my agent just created for me. And I can of course just add more custom prompts right here manually. If you already have your coding harness or you have added your custom prompts to GitHub Go Pilot or to other assistants you can just copy them right here and start using them in Pi. And just for the record Pi automatically scans all of the configurations that are in your home folder in the .py directory, and you can also have a .py directory within your workspace to have custom settings for that specific workspace, okay? That's for prompts. Now let's take a very quick look at skills. Okay, so now let's talk very quickly about skills. If you're not familiar with skills, I do have a very detailed and thorough video to understand what skills are and how to install them. I use skills.sh to install them most of the time. You can watch that video right here. It's a crash course about everything that you need to know about skills. But in the case of Pi in particular, it is very straightforward. All you have to do is to open Pi and you will see your skills listed right here. And in order for Pi to identify your skills or to load them, it first of all searched in multiple places. It searched into .agents directory, so both your home and your workspace .agents directory. And if you go inside skills, it will load all of those right there. And it will also automatically load all of the skills in your .clote directory. Okay, so in my case, my .clote directory has pretty much the same skills as my .agents directory because I use same links between them. But just know that that is the case. And also, if you want them to be very specific for Py, you can also add the skills right here inside your .py agent and inside the skills directory right here. So I have my skills right here. And as you can see, I also have some sim links right here that go to my .agents directory anyways. So there you go. That is for skills and where they are found. Now, in order to actually use them, what you're going to want to do is to slash scale and you will be able to select any scale that you have loaded right here. Now, in my case, I have a few skills available, Video tool, for example, is a skill that I built that I use to edit my own videos. Skill visualizer, I five-coded it yesterday just to help me visualize my skills. Skill creator, I think it's built-in. And find skill, I also think it's built-in. I don't remember. I mean, built-in with cloud code, if I remember correctly. But let me just show you the skill visualizer, for example. So there you go. I just called it, and it automatically runs my MD file, runs a script in order to generate my visualization. And then I'll be able to just open it and see what skills are available. And this is actually a good moment to show you that you can also run bash commands within your terminal inside Pi. So what you're going to want to do is to exclamation mark. And then whatever you write right here is going to be interpreted as a bash command. So you can do open. And then I can just open my skills visualizer. And also something that you can do is to double exclamation mark. and the difference is that if you use one, the bash command is going to go into the history of the conversation so your agent will know that you ran that command and if you do double, it is not going to go into the history so your agent will not know it and of course it will not clutter your context if it's something unrelated. So what I'm going to do is I'm just going to do open and there you go, here's my skills visualizer. It's very straightforward, I mean it's just a very quick visualizer that I made to be able to see my skills and the scripts and their references. I'll leave a link in the description if you want to use it. It's on GitHub. So there you go. It is very straightforward. As you see, pretty much the same functionality with skills that you have at Cloud Code or Codex or OpenCode, etc. Now let's go into the more fun parts, which is customization of your AI agent. All right. So next thing that we're going to do is we're going to take a look at the themes. because as you can see, Pi is very minimalist, and you can basically edit or modify everything about its terminal user interface. In this case, I'm going to change something very minimal, which is the themes. So what you can do is you go to settings, and right here, you're going to type themes, and you're going to see that you have multiple themes available. In this case, it comes with two themes pre-loaded, so dark theme and light theme. And the light theme, the only difference is that it turns this to light for some reason. I don't like it. I just use the dark one. But what we could do is ask Pi to create a new theme for us. And in this case, I'm going to ask you to create a theme in this workspace so it's not available for everyone in the home directory. So let's do that. Create a fun theme for Pi agent right here in this workspace. Make it fun, make it creative, and make it great looking. so let's take a look at that and there you go it is done now if I go to settings I'm probably not going to be able to sit to see it so I'm going to go to theme as you can see it's not there yet what I'm going to do is I'm going to hit reload because remember that anytime that we change anything in the configuration or we have used pi to build itself we're going to have to reload all the settings and now you can see I have my new custom theme right here which is Gummies I'm going to do settings and on themes I'm going to go to Gummi this time and there you go now I have Gummi available it is a little bit different and it also has different colors for thinking and there you go just a very quick way but of course you can modify the entire terminal user interface if you want to that just a very quick overview of themes Now let go into context files All right now let take a very quick look at the context files. Now this is something that is universal. PI follows the agents.md standard, which basically is this set of instructions that all your AI agents load automatically in your workspace or in your home directory. And Py follows this convention as well. And however, it also reads the clod.md file that you have. So let's take a look at this. So let me show you very quickly how this works. If I go to my videos director, it's just one repository that I have right here that actually I use agents on. So right here, you see that I have my agents.md and my clod.md file. What happens is that Py reads both of this and adds them both to context. So it is going to see both my agents.md, which is all of these things, and it's going to also see my clod.md file, which is right here, as you can see. And there you go. This is essentially what's going on right here. And also something important is that this one right here, both of these are located in my workspace directory. But if I go to my home directory here, I also have a .clod directory. And inside this, I also have a clod.md file. And what happens is that Py will automatically load all of them, just like any other AI agent that you're currently using. So if you're using clod or codecs, they actually do the same. So that's why it's probably a good idea to be careful with what you add to your home directory agent files. There you go. That is how to handle context. It's very straightforward, as I told you. Just add here very general instructions about your workspace or about your general way you interact with your coding agent. Okay, so let's go to the next part. All right, so now let's take a look at extensions. And extensions are very straightforward. As you remember correctly, Pi is very, very minimalist. As you can see here, we have some themes and prompts and skills. But these are things that I added after I installed Pi. These are things that were not there by default. And Pi also does not come with many of the things that some people would consider basic or that some agents come with right out of the box, such as it doesn't come with MCP, it doesn't come with sub-agents, it doesn't come with permission pop-ups or with plan mode or to-dos, etc. Of course, there are ways to update it and to change that. And the way to do it is with extensions. So I told you that Pi is very simple and very straightforward, and it is also very modular, which means that you can either write your own extensions by hand, or you can have Pi write its own extensions and update the way that it interacts with your computer. So for example, let's go right here and go to documentation. And inside the documentation, we can take a look at the extension section. and you can see that extensions allow you to extend the functionality of your Pi agent. And here are some examples, but let me actually show you how to do this. So right here, what I'm going to do is I'm just going to prompt it to create an extension for the current workspace. So this is not going to be available for all of my Pi sessions, only for this specific workspace. That prints a welcome message whenever a new session starts. write a set of messages that are quotes from famous scientists and writers and each time display one randomly. So I'm going to just run this and let's have it write the whole thing. And there you go, it finished creating it. And what you can do is just restart pi. Let's just get out of it and let's reopen it. And as you will see, here we have our nice little quote right here. It says, logic will take you from A to B, imagination will take you everywhere, says Albert Einstein. And that is just some nice little functionality that we have added right here. And you can, of course, add many other things. So for example, you can add things to your footer, for example, things to your editor right here, whatever you want. Okay. Now, let me give you another very quick example. Here I have another prompt that I have that I think that is a good extension that you can add if you're going to be using this as a coding agent, not like an autonomous agent in a sandbox or anything. So I can ask it to create a pi extension at the current workspace that asks for confirmation before running any bash command containing rm, rf, or git push force, because I'm going to be using this for coding. So I would not really want my agent to remove or push force things without my permission. So let's take a look at how it does it. And there you go. It has completed writing the whole thing. Now let's see if it actually does it. So what I'm going to do, so I'm just going to get out of here. I don't remember what I have available right here. I'm just going to create a new directory right here, call it hello. And inside of it, let's just create another hello file right here. So hello.md. And there we go. And here right now, if I ask pi, To remove it, I'm going to be able to test that new extension that I created. And as you can see right here, we have the dangerous command guard extension and the welcome quote extension that we created before. So remove the hello directory from here. And there you go. It's saying that there is a dangerous command detected RM with force recursive flags. Execute anyway, yes or no. So here I can say yes, and now it will delete it. there you go so hello directory has been removed and just to show you that this actually works and how and where this is located let me just show you that right here in my pi tests directory which is just somewhere that i've had been doing some experiments if i go into my pi directory and i go inside extensions you will see that i have my two extensions right here And as you can see, they are basically just TypeScript files that are very, very straightforward. Okay. So there you go. And just to give you the demonstration that this actually did not work before we created the extension I just going to remove the extension It going to remove the dangerous command and let go right here let go back here and let just create again a hello directory and let just create inside of it what we going to do is we're going to open pi and we're going to ask it to remove remove the hello there from here and as you can see it run rmrf hello and it removed everything without asking me for permission so my extension actually worked and there you go that is how extensions work how to use them and how to create them and if you take a look at the documentation there are a bunch of examples of useful extensions that you may want to create all right now let's take a very quick view at packages Now, packages are very straightforward. These are essentially just bundles of extensions, skills, prompts, etc. that come all together in a single package so that they all work together and you can build them together. They're very straightforward and you actually have them already available right here in the packages section. All of them that have been built by contributors in the community. So here are some of the common functionalities that you already know from other coding agents that you can add with a single command to your PyAgent. So for example, there is PySubagents, there is context mode, MCPAdapter to be able to use MCP, WebSearch because of course PyAgent does not come with WebSearch by default, PyWebAccess, etc. So a bunch of different things that you can use. Feel free to explore this. And of course, all of these are open source for you to be able to actually see what you are installing. And naturally, be careful to not install any package that you do not trust or that you have not thoroughly reviewed, at least had Py review it to make sure that it is safe because these packages sometimes contain scripts and your agent will sometimes execute those scripts. so you don't want to be executing malicious scripts in your computer naturally. So there you go. Just take a look at this and, of course, feel free to create your own if you want to. Okay, so now it's time for my favorite feature of Pi probably. Other than the fact that it is customizable, which is amazing, I think my favorite feature is sessions. Now, of course, Pi is great because it's customizable and it is minimalist and you can just build your own agent harness with it. But to me, the best part about this is this sessions part. So it makes it extremely easy for you to retrieve, edit, and navigate through your threads. Okay. So for example, let's suppose that you are right here in my, just this test that I gave to you. I can just do slash name and I can rename this specific thread. So I will call it testing, for example. And now, as you can see right here, it is named testing. And if I do slash session, I will see that this session is called testing. And also, very importantly, it tells me where it is located. And now this is extremely important because if we go right here to my .py agent, and if I go inside my agent, I can see that I have my sessions right here. And if I go inside sessions, you will see that I have all of my sessions that I have started with my PyAgent organized by directory. where I started. So for example, this one right here, let's say that I want to go into temp. So I'm going to go into temp right here. Let's go right here. And here I have all my conversations that had in that directory in JSON L format. Now, there is that. But also, let's suppose that you are using your agent. And at some point you start, you send it some message and you just mess things up and you didn't want to send that message. But you want to continue from a previous message. It's very straightforward. All you do is tree. And this will give you a list of all of your messages. And you can just continue from where you started. So for example, let's see, let's go back to my assistant message. I do not want to summarize the other things. And here we are back there. I want to go forward again. I'll just go forward like that again. And there you go. That's very straightforward. All that we're doing is just navigating our tree. There are also two other commands that are pretty useful. So fork, for example, will take the session, duplicate it, and you will continue working on that one. Or you can also clone a session, which will duplicate the current session at the current position. From here, something else that you can do is ask your agent to compact your conversation in case you're close to reaching your limit in your context window, and it will manually compact that session. And something nice is that you can add custom instructions right here, like for example, something like pay attention to the API or something like that. Okay. And probably my favorite thing right here is that you can export your session just like that. So I'm just going to click export and you can see my session was exported to this file right here. Now, let me actually open it for you. I'm just going to do open and here it is so as you can see it is a pretty nice user interface where I can visualize all of my messages and right here I can also navigate the whole thing in this nice little sidebar and I can filter with tools with user labeled or all and since I I mean yeah there's also the possibility of labeling your messages but I'll show that later or you can probably read the documentation for that to make to not make this video super long and of course very nicely. If you want to use this thread to maybe train a large language model or create, for example, create a skill, you can just download the JSONL and now you can use that to create your skill. So there you go. And there you go. Thank you very much for watching. It has been a pleasure. I can probably make a more detailed video on Pi or some other tutorials about Pi and how to use it. But I suppose that with this, you have more than enough to get you started and to customize your Pi agent for whatever you want to do. I can probably make videos about how to run Pi with local models or how to run or create other more specific extensions. But please let me know what you would like to see. Thank you very much for watching. It has been a great pleasure and I will see you in the next one.

Need a transcript for another video?

Get free YouTube transcripts with timestamps, translation, and download options.

Transcript content is sourced from YouTube's auto-generated captions or AI transcription. All video content belongs to the original creators. Terms of Service · DMCA Contact

Pi Agent – Crash Course | Minimal Coding Agent - YouTube ...