Why I switched to Pi... — Transcript
Full transcript
- 0:00Thanks HubSpot for sponsoring this
- 0:02video.
- 0:03If you're into AI agents, you've
- 0:05probably heard about this Pi agent quite
- 0:07a lot recently. And most of you probably
- 0:08know Pi agent because it was what
- 0:10powering Open Claw. And today I want to
- 0:12give you a breakdown of what's special
- 0:14about Pi agent, why it is one of the
- 0:16best option for you to build agent
- 0:18system, and in the end how can you use
- 0:19Pi to build some agentic system like
- 0:22Post AI from scratch, which is agent
- 0:24that designed to launching and running a
- 0:26business. But before we dive into Pi, I
- 0:28know a lot of you already using coding
- 0:29agent like Cloud Code or Codec everyday.
- 0:31But this probably a 10 or even 100X
- 0:34difference between someone who just open
- 0:36terminal, send a prompt, and hopes for
- 0:38the best versus someone who fully
- 0:40utilize every aspect of what this modern
- 0:42harness provides. Things like what type
- 0:44of Cloud or MD or agent.md actually
- 0:46works, how you structure code base that
- 0:48is agent ready, what are hooks that up,
- 0:50and how to keep a long running work on
- 0:51track with task state, and how to run
- 0:54more post sessions without creating a
- 0:55complete mess. If you want to be on the
- 0:57right side of gap, then this free Cloud
- 0:59Code Playbook I put together with
- 1:01HubSpot will get you there. This is a
- 1:03playbook I wish I had when I was
- 1:04figuring all this out the hard way. It
- 1:06covers my prompting patterns, how I set
- 1:08up my Cloud or MD and project context,
- 1:10which hooks and guardrails I use, and
- 1:12how I manage the task state for longer
- 1:14work. My favorite part is probably the
- 1:16parallel sessions setup that enable you
- 1:17to run not just one or two sessions, but
- 1:2010 to 15 different agent sessions safely
- 1:22at the same time. Although it is called
- 1:23the Cloud Code Playbook, the principles
- 1:25actually apply to Pi as well. Because
- 1:27for every Cloud Code feature, there's
- 1:28almost a equivalent package that you can
- 1:31plug into your Pi agent, which we will
- 1:33talk about soon. So most of the
- 1:34principles here are harness agnostic,
- 1:36which means no matter which agent you
- 1:37use, you can adopt it. I put a link in
- 1:39the description below so you can
- 1:41download for free. And thanks HubSpot
- 1:42for sponsoring this video. Now, let's
- 1:44get back to the Pi agent. So
- 1:45fundamentally, Pi agent is a coding
- 1:47agent. And every time when people ask
- 1:48me, "Hey, is Cloud Code better or Codec
- 1:50better?" My answer for the past few
- 1:52weeks just they are same. There's no
- 1:54real difference between those coding
- 1:55agents anymore. But why did Open Claw
- 1:57choose Pi Agent as the base to build
- 1:59upon? Because CloudCode, CodeX,
- 2:00OpenCode, they all have their own SDK
- 2:02and CLI that allow you building new
- 2:04agent system by wrapping it. Well, the
- 2:06core difference is all the other coding
- 2:07agents harness, even though it's really
- 2:09powerful, you can't really modify or
- 2:11change how the harness inside it works.
- 2:14Even CloudCode and CodeX is becoming
- 2:16increasingly similar to each other, but
- 2:18each one still have their own unique
- 2:19features. Like CloudCode has dynamic
- 2:21workflow, but if you're user of CodeX,
- 2:23you can't just tell CodeX to say, "Hey,
- 2:25implement this dynamic workflow as part
- 2:27of your harness." And vice versa. Even
- 2:29though they already tried to open up
- 2:31more customizability by exposing hook
- 2:33system to the user. And if you don't
- 2:35know hook, they normally allow you to
- 2:36define some programmatic behavior when
- 2:38certain things happen, like when a
- 2:40session start or before the agent try to
- 2:42call a tool. So, you can achieve some
- 2:43sort of harness modifications by doing
- 2:45things like every time when CloudCode
- 2:47try to call a tool, it automatically
- 2:49check a permission rules that you write
- 2:51and then return back true or false based
- 2:52on permission rules that you want. It's
- 2:54pretty powerful, but still a bit
- 2:55limited. Like, if you look at the GitHub
- 2:57issues, there are a lot more scenarios
- 2:59of the hooks that users want to modify,
- 3:02but couldn't. And this is where Pi Agent
- 3:05really shine. So, the whole design
- 3:06philosophy of Pi Agent is that harness
- 3:08should actually adapt to the user rather
- 3:10than the other way around. So, at
- 3:12default, Pi comes with a minimum version
- 3:14of coding agent. It only has four
- 3:16critical tools: run bash command, write,
- 3:18read, and edit files. There's no sub
- 3:20agents, no agent teams, and don't even
- 3:23have MCP comes with it. It's very bare
- 3:25minimum. But, meanwhile, it can be
- 3:27easily extended with any other features
- 3:29that you want. They have this concept
- 3:30called extension. So, users and agents
- 3:33can just write new extension file to
- 3:35extend the Pi coding harness. They
- 3:37expose a whole bunch of things to allow
- 3:38you to make modifications across the
- 3:40tools, contexts, hooks, session
- 3:42management, command UI, almost
- 3:44everything that you can think of. So,
- 3:45you can add in new tools, command
- 3:46shortcut providers, large language model
- 3:48providers, and they They almost every
- 3:51single hooks that you will ever need.
- 3:53So, you can write programmatic behavior
- 3:54to change and improve the harness. They
- 3:56even expose the UI itself as well. For
- 3:58example, I can just customize my Pi
- 4:00Agent UI to whatever I want, like this
- 4:02random character. And the cool thing is
- 4:04that this extension can be written by
- 4:06you as human or by the agent itself. Pi
- 4:09Agent has its knowledge baking already
- 4:11and has full awareness of what kind of
- 4:13extension already loaded and how to
- 4:15write the extension. You can just modify
- 4:17itself on the fly. For example, I can
- 4:19just tell it, "Hey, I want to see the
- 4:20weather info in the prompt input. Help
- 4:22me customize your UI." It will
- 4:24automatically read the extension doc,
- 4:26then write a new extension for the
- 4:27weather widget. Once it's done, you can
- 4:29just do {slash} reload. It will
- 4:31immediately reload the latest version of
- 4:33the harness that it just created with
- 4:34those extensions. And now you can see
- 4:36the weather information is showing up
- 4:37here, just above my prompt input. And
- 4:40this type of UI customization is just
- 4:41really small part of all the
- 4:43possibilities. You can almost ask it to
- 4:45update things on the fly for any part of
- 4:47harness. And there's a Pi Agent package
- 4:49catalog. So, you can install extensions
- 4:51built by others. So, even though default
- 4:53Pi Agent don't have any of those
- 4:54features, we can find almost every
- 4:56popular Cloud Code Codex feature already
- 4:59implemented by someone that you can plug
- 5:01into your Pi Agent, like the Go feature,
- 5:03the MCP adapter, the Chrome browser
- 5:05access, the ask user question tool, sub
- 5:07agents, plan mode, and even dynamic
- 5:09workflow and computer use. If you want
- 5:11to enable dynamic workflow, you simply
- 5:13copy this package of dynamic workflow,
- 5:15run this command, then reload. Now I can
- 5:17just give a prompt including keywords
- 5:19like workflow, then works almost like
- 5:21Cloud Code's dynamic workflow feature.
- 5:23It will trigger workflow, and I can also
- 5:25do {slash} workflow, which will pop up
- 5:27this workflow UI, and you just get a
- 5:28very similar, almost identical
- 5:30experience from the Cloud Code. There
- 5:32even package that will just turn your Pi
- 5:34Agent into a Cloud Code or Codex. The
- 5:37package all special tooling those other
- 5:39harness has, so you can install and use
- 5:41that artifact. There even extension that
- 5:43allow you to play DOM while the agent is
- 5:45running. And some of the extensions
- 5:46might not be well-built, but technically
- 5:48you can actually ask agent update and
- 5:50build for you. And with this
- 5:51flexibility, I can already see some
- 5:53really interesting things that only
- 5:54possible to be built with pipe. For
- 5:56example, this one package called Pi
- 5:58hyper. What it does is that it will
- 5:59capture every tool call hook for things
- 6:01like bash command to actually making
- 6:03sure it pre-processing the bash command
- 6:06result and only return relevant and
- 6:08minimum information back to the agent.
- 6:10For example, previously, if agent is
- 6:11running Git log to see what are recent
- 6:13commits, command will include a lot of
- 6:15information for each commit like hash,
- 6:16author, date, body, and diff blocks. But
- 6:19with this package, it will actually
- 6:20clean things up to show only what
- 6:22matter. And just by doing this, it can
- 6:24probably reduce 96% of those type of
- 6:26commits. And in some other testing
- 6:28commits, it will all cut token by like
- 6:3080 to even 90%. And this is a good
- 6:32example where things like that is just
- 6:33difficult to implement with cloud code
- 6:35or codex because their pre-tool use cook
- 6:38only allow you to append new information
- 6:40to the tool call rather than directly
- 6:42modify the tool call result. So, this is
- 6:44rich extension system is a core that
- 6:46making Pi agent a super useful and this
- 6:48exactly how Open Claw started. So, first
- 6:51what they were building is mainly the
- 6:52gateway to connect with app Slack and
- 6:54the web interface while using the Pi
- 6:56agent as the main agent runtime. So, you
- 6:58can utilize agent loops, large language
- 7:00model OS, and the session management,
- 7:02but also extend it with MCP, memory sub
- 7:04agent, ACP, and many other things. And
- 7:06those type of customizability would be
- 7:08otherwise very difficult to achieve if
- 7:10Open Claw were using cloud code SDK or
- 7:12codex CLI. And it's actually pretty easy
- 7:14to build those extensions. I'm going to
- 7:16show you a few quick examples. So, to
- 7:18build extension, you can just create a
- 7:19dot pi folder in any project folder or
- 7:21in your root and then add an extensions
- 7:23folder inside it. And here is a few
- 7:25examples. So, let's say you want to
- 7:26modify agent's context to always be
- 7:28aware of the current Git repo like which
- 7:31branch it is on, what are the available
- 7:32work trees, un-staged changes, and
- 7:34recent commits. We can simply create
- 7:36extension like this, which is in
- 7:37TypeScript, and adding a Git function
- 7:39which will run the Git command get all
- 7:41those Git related information back,
- 7:43extract and generate a Git summary. And
- 7:45then just simply do this
- 7:46pi.on_before_agent_start
- 7:48and modify the system prompt, append
- 7:50additional Git context after the
- 7:52predefined system prompt. And this is as
- 7:54simple as it get. Once you put this
- 7:56extension file here, the next time you
- 7:58load the pi agent, it will automatically
- 7:59have those contexts. I can simply ask
- 8:01it, "What's the Git information here?
- 8:03Use no tools to answer me." And it will
- 8:05return back the information. And
- 8:06meanwhile, you can also easily add
- 8:07custom tools. Like, what if you want
- 8:09your pi agent to be able to read what's
- 8:11in your clipboard? You can simply do
- 8:13this pi.register_tool,
- 8:15give it a name, label, description, and
- 8:17param, then define the actual function
- 8:19here. With this, if I go copy the
- 8:21previous Git context extension file, and
- 8:23I will just ask it, "What's in my
- 8:24clipboard?" It will use the tool that we
- 8:26write to get clipboard information. And
- 8:28we can even build something more
- 8:29interesting, like this permission gate.
- 8:31So, the idea is that what if you want
- 8:32this agent to be used by your team,
- 8:34where each one might have different
- 8:35permission access to different level of
- 8:37information? Instead of message sent
- 8:39directly to agent, or let the agent
- 8:41decide whether the user has right
- 8:43permission, what if we add a permission
- 8:45check using a cheap and fast small
- 8:46model? If it's all good, then continue
- 8:49with agent as normal. But if it is some
- 8:51dangerous information, you can just stop
- 8:52the session right away. And here, we
- 8:54just write another extension. We are
- 8:55using two different package, which I
- 8:57will dive a bit deeper. One is a pi
- 8:59coding agent that allow you to write
- 9:00extension API, but also this pi AI
- 9:04package, which is some package from pi
- 9:05agent that allow you to do large
- 9:07language model call with any model very
- 9:08easily. So, we define a small gate model
- 9:11to use Haiku and output decision whether
- 9:13it's allowed or denied, plus a
- 9:15reasoning. Then we package this as small
- 9:16decide tool, the system prompt, as well
- 9:19as the user message, which load up both
- 9:21the policy, which is permission.md file
- 9:23that user can define on the root, plus
- 9:25the user request. And we use this
- 9:26function provided by the pi AI package
- 9:29to direct call the large language model
- 9:31and output result. All we need to do is
- 9:33just when the session start, we will
- 9:35load up the policy information in the
- 9:37prompt. And then after every time user
- 9:39send a message, we're showing message on
- 9:41the UI saying permission checking, wait
- 9:43for the large language model result. If
- 9:45it is denied, then on the UI we will
- 9:47show this block information and skips
- 9:49agent entirely. Otherwise, continue like
- 9:51normal. To test it, you can just define
- 9:53a permission.md file to define a
- 9:54specific permission. Like here I said
- 9:56only Jason can get revenue data. So if I
- 9:59go to my Pi agent, ask what's the
- 10:01revenue for June, it will trigger
- 10:02permission and show me back this
- 10:04information that is blocked. That you
- 10:06don't have permission to access revenue
- 10:07information. So this is one example of
- 10:09how you can update Pi agent's harness by
- 10:12writing those extension. And most of the
- 10:13time you actually don't need to learn
- 10:15building those extension yourself, cuz
- 10:17you can just talk to the Pi agent, it
- 10:18will self-evolve. However, the real
- 10:20power of Pi, from my point of view, is
- 10:23actually not just use it as a coding
- 10:25agent, but actually build on top of Pi
- 10:27agent to powering your AI products. If
- 10:29you can look at Pi agent repo, it
- 10:31actually comes with five different
- 10:32package. The first one is this AI
- 10:34package. This is almost like a Vercel AI
- 10:37SDK that allow you to call different
- 10:39large language models. It comes with all
- 10:41the OAuth function to allow your user to
- 10:43connect cloud code subscription, code
- 10:45act subscription. So you can actually
- 10:46use this as standalone function to just
- 10:49do large language model call in the
- 10:50application you're building. The second
- 10:51package is this agent package. This is
- 10:54basically the agent loop. You can
- 10:55consider almost this like a Vercel AI
- 10:57SDK stream text function that has this
- 11:00small agent loop built in. The third one
- 11:02is this coding agent. So coding agent
- 11:04you can use agent core loop as well as
- 11:07AI package, but comes with this
- 11:09essential tooling like read, write, add,
- 11:11and bash, as well as session management,
- 11:13compassionate context window, the
- 11:15extension system, as well as SDK. And
- 11:17this package, you can almost consider as
- 11:20equivalent to the cloud code agent SDK,
- 11:23but it is fully customizable and you can
- 11:25connect to any model you want. And in
- 11:26the end it also comes with this TUI
- 11:28package that wraps the coding agent in
- 11:30this terminal UI. And also a up trader
- 11:33package. So this up trader package allow
- 11:34you to build like schedule job or
- 11:36delegate task to different Pi agent
- 11:38process. And this is been more
- 11:39experimental. But you can see that based
- 11:42on the type of a product you're
- 11:43building, you can actually utilize the
- 11:44Pi agent's ecosystem to scaffolding the
- 11:47agent products. And I actually utilize
- 11:49this coding agent SDK to build a product
- 11:52like Posia, which is a a times agent
- 11:54that can launch and run business to
- 11:55showcase the real power. And I'm going
- 11:57to show you very quickly how I build it
- 11:59to help you draw a picture. So as I
- 12:01mentioned, I'm using this coding agent
- 12:02package because it comes with a SDK that
- 12:05you can use. If you are trying to build
- 12:07a local agent, which means the agent
- 12:09system that lives on user's own
- 12:11computer, then this package basically
- 12:12give you most of stuff that you need.
- 12:14And you can just easily extend
- 12:15functionality by building extension
- 12:17system, custom UI, and task triggers.
- 12:20One good example is this all my Pi
- 12:22coding agent. This is coding agent that
- 12:24build on top of Pi package. But it comes
- 12:26with a lot of new tools that brings
- 12:28performance closer to the cloud code
- 12:30Codex. It comes with editor type of user
- 12:33interface inside terminal. It even have
- 12:35features that allow you to just publish
- 12:37a specific conversation session you have
- 12:39with someone else. It has a QR code that
- 12:41people can scan or a URL you can share
- 12:43with others. So you can actually build
- 12:45very sophisticated local agent products
- 12:47on top of Pi agent. But meanwhile, you
- 12:49can also use Pi agent package to build
- 12:52web hosted agent product like this Posia
- 12:54replica I did. But there are some nuance
- 12:56you need to handle because the Pi
- 12:58e-coding agent SDK at default is
- 13:01designed quite tied to the local file
- 13:02system. But when you have this web
- 13:04deployed agent, which means agent run
- 13:06actually lives on your shared backing
- 13:07infrastructure. But when you try to
- 13:09write file, run bash command, then each
- 13:11user has their own sandbox. With this
- 13:13type structure, you will need to make
- 13:14some modifications. Like instead of
- 13:16using Pi coding agent default session
- 13:18manager system, which is directly tied
- 13:20to the general file on the computer, you
- 13:22probably want to store the session
- 13:24information in your DB and manage
- 13:25compassion yourself. And also for the
- 13:27default bash added read write tools, you
- 13:29probably want to wrap a layer so that it
- 13:31will do those operations in the sandbox
- 13:33that user is owning. But, it is same
- 13:35situation we need to handle even though
- 13:37you are using cloud code agent SDK. And
- 13:39with this, you can also build a web
- 13:41application like this, which is a chat
- 13:43agent. User can chat to it. To implement
- 13:45such experience, we pretty much still
- 13:47using the pi coding agent package. But
- 13:49this time we use the default resource
- 13:50loader. So, this is how you can pass
- 13:52additional extension skill to the coding
- 13:54agent. For example, here we define a
- 13:56extension for guardrail that it will
- 13:58block by running certain bash commands.
- 14:01And also define a tool to get MRR with
- 14:03some mock result. Then we define this
- 14:05resource loader. So, we can pass on the
- 14:08directory the agent should be working in
- 14:10and in the directory where agent should
- 14:11load extension file like OS key. And you
- 14:14can also define whether the agent should
- 14:16just load up extension skills from the
- 14:18door pi folder. We can also passing
- 14:20customized extensions. Like here, we are
- 14:22passing the guardrail's extension that
- 14:24we define in line here. As well as
- 14:26additional skills. So, this will allow
- 14:27you to customize what type of skills
- 14:29each agent session should have access
- 14:31to. Then use this create agent session
- 14:33function to passing the custom tools as
- 14:35well as a resource loader. And the rest
- 14:37will be similar. Based on the type of
- 14:39events, you can present different
- 14:40information on the UI. So, this is how
- 14:42you can build a wrong pi package. I
- 14:44actually use the same pi SDK build a
- 14:46replica version of post here, which is
- 14:47hosted agent system that can launch and
- 14:49run company autonomously. It is using
- 14:51pi's coding agent SDK as agent runtime.
- 14:54Breaking down into 11 different agents
- 14:56with orchestrator that's built around
- 14:58task entity and persist the state and
- 14:59context as well as tools proxy. I'll
- 15:01share more details step-by-step tutorial
- 15:03of how did I build the system from
- 15:05scratch in a builder club. So, you can
- 15:06join if you're interested. Meanwhile,
- 15:08I'll add some of the extension I build
- 15:09or some of my own favorite pi extensions
- 15:12into our curious skill folder. So, you
- 15:14can give it to pi agent and have it set
- 15:16up. I hope this is useful. Thank you.
- 15:17And I'll see you next time.
About this transcript
This page contains the full transcript of Why I switched to Pi... by AI Jason, generated from the public captions YouTube serves with the video. The transcript has 3,322 words across 483 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.