YouTube2Text

Why I switched to Pi... — Transcript

by AI Jason · 3,322 words · 483 segments · language en · Watch on YouTube

Full transcript

  1. 0:00Thanks HubSpot for sponsoring this
  2. 0:02video.
  3. 0:03If you're into AI agents, you've
  4. 0:05probably heard about this Pi agent quite
  5. 0:07a lot recently. And most of you probably
  6. 0:08know Pi agent because it was what
  7. 0:10powering Open Claw. And today I want to
  8. 0:12give you a breakdown of what's special
  9. 0:14about Pi agent, why it is one of the
  10. 0:16best option for you to build agent
  11. 0:18system, and in the end how can you use
  12. 0:19Pi to build some agentic system like
  13. 0:22Post AI from scratch, which is agent
  14. 0:24that designed to launching and running a
  15. 0:26business. But before we dive into Pi, I
  16. 0:28know a lot of you already using coding
  17. 0:29agent like Cloud Code or Codec everyday.
  18. 0:31But this probably a 10 or even 100X
  19. 0:34difference between someone who just open
  20. 0:36terminal, send a prompt, and hopes for
  21. 0:38the best versus someone who fully
  22. 0:40utilize every aspect of what this modern
  23. 0:42harness provides. Things like what type
  24. 0:44of Cloud or MD or agent.md actually
  25. 0:46works, how you structure code base that
  26. 0:48is agent ready, what are hooks that up,
  27. 0:50and how to keep a long running work on
  28. 0:51track with task state, and how to run
  29. 0:54more post sessions without creating a
  30. 0:55complete mess. If you want to be on the
  31. 0:57right side of gap, then this free Cloud
  32. 0:59Code Playbook I put together with
  33. 1:01HubSpot will get you there. This is a
  34. 1:03playbook I wish I had when I was
  35. 1:04figuring all this out the hard way. It
  36. 1:06covers my prompting patterns, how I set
  37. 1:08up my Cloud or MD and project context,
  38. 1:10which hooks and guardrails I use, and
  39. 1:12how I manage the task state for longer
  40. 1:14work. My favorite part is probably the
  41. 1:16parallel sessions setup that enable you
  42. 1:17to run not just one or two sessions, but
  43. 1:2010 to 15 different agent sessions safely
  44. 1:22at the same time. Although it is called
  45. 1:23the Cloud Code Playbook, the principles
  46. 1:25actually apply to Pi as well. Because
  47. 1:27for every Cloud Code feature, there's
  48. 1:28almost a equivalent package that you can
  49. 1:31plug into your Pi agent, which we will
  50. 1:33talk about soon. So most of the
  51. 1:34principles here are harness agnostic,
  52. 1:36which means no matter which agent you
  53. 1:37use, you can adopt it. I put a link in
  54. 1:39the description below so you can
  55. 1:41download for free. And thanks HubSpot
  56. 1:42for sponsoring this video. Now, let's
  57. 1:44get back to the Pi agent. So
  58. 1:45fundamentally, Pi agent is a coding
  59. 1:47agent. And every time when people ask
  60. 1:48me, "Hey, is Cloud Code better or Codec
  61. 1:50better?" My answer for the past few
  62. 1:52weeks just they are same. There's no
  63. 1:54real difference between those coding
  64. 1:55agents anymore. But why did Open Claw
  65. 1:57choose Pi Agent as the base to build
  66. 1:59upon? Because CloudCode, CodeX,
  67. 2:00OpenCode, they all have their own SDK
  68. 2:02and CLI that allow you building new
  69. 2:04agent system by wrapping it. Well, the
  70. 2:06core difference is all the other coding
  71. 2:07agents harness, even though it's really
  72. 2:09powerful, you can't really modify or
  73. 2:11change how the harness inside it works.
  74. 2:14Even CloudCode and CodeX is becoming
  75. 2:16increasingly similar to each other, but
  76. 2:18each one still have their own unique
  77. 2:19features. Like CloudCode has dynamic
  78. 2:21workflow, but if you're user of CodeX,
  79. 2:23you can't just tell CodeX to say, "Hey,
  80. 2:25implement this dynamic workflow as part
  81. 2:27of your harness." And vice versa. Even
  82. 2:29though they already tried to open up
  83. 2:31more customizability by exposing hook
  84. 2:33system to the user. And if you don't
  85. 2:35know hook, they normally allow you to
  86. 2:36define some programmatic behavior when
  87. 2:38certain things happen, like when a
  88. 2:40session start or before the agent try to
  89. 2:42call a tool. So, you can achieve some
  90. 2:43sort of harness modifications by doing
  91. 2:45things like every time when CloudCode
  92. 2:47try to call a tool, it automatically
  93. 2:49check a permission rules that you write
  94. 2:51and then return back true or false based
  95. 2:52on permission rules that you want. It's
  96. 2:54pretty powerful, but still a bit
  97. 2:55limited. Like, if you look at the GitHub
  98. 2:57issues, there are a lot more scenarios
  99. 2:59of the hooks that users want to modify,
  100. 3:02but couldn't. And this is where Pi Agent
  101. 3:05really shine. So, the whole design
  102. 3:06philosophy of Pi Agent is that harness
  103. 3:08should actually adapt to the user rather
  104. 3:10than the other way around. So, at
  105. 3:12default, Pi comes with a minimum version
  106. 3:14of coding agent. It only has four
  107. 3:16critical tools: run bash command, write,
  108. 3:18read, and edit files. There's no sub
  109. 3:20agents, no agent teams, and don't even
  110. 3:23have MCP comes with it. It's very bare
  111. 3:25minimum. But, meanwhile, it can be
  112. 3:27easily extended with any other features
  113. 3:29that you want. They have this concept
  114. 3:30called extension. So, users and agents
  115. 3:33can just write new extension file to
  116. 3:35extend the Pi coding harness. They
  117. 3:37expose a whole bunch of things to allow
  118. 3:38you to make modifications across the
  119. 3:40tools, contexts, hooks, session
  120. 3:42management, command UI, almost
  121. 3:44everything that you can think of. So,
  122. 3:45you can add in new tools, command
  123. 3:46shortcut providers, large language model
  124. 3:48providers, and they They almost every
  125. 3:51single hooks that you will ever need.
  126. 3:53So, you can write programmatic behavior
  127. 3:54to change and improve the harness. They
  128. 3:56even expose the UI itself as well. For
  129. 3:58example, I can just customize my Pi
  130. 4:00Agent UI to whatever I want, like this
  131. 4:02random character. And the cool thing is
  132. 4:04that this extension can be written by
  133. 4:06you as human or by the agent itself. Pi
  134. 4:09Agent has its knowledge baking already
  135. 4:11and has full awareness of what kind of
  136. 4:13extension already loaded and how to
  137. 4:15write the extension. You can just modify
  138. 4:17itself on the fly. For example, I can
  139. 4:19just tell it, "Hey, I want to see the
  140. 4:20weather info in the prompt input. Help
  141. 4:22me customize your UI." It will
  142. 4:24automatically read the extension doc,
  143. 4:26then write a new extension for the
  144. 4:27weather widget. Once it's done, you can
  145. 4:29just do {slash} reload. It will
  146. 4:31immediately reload the latest version of
  147. 4:33the harness that it just created with
  148. 4:34those extensions. And now you can see
  149. 4:36the weather information is showing up
  150. 4:37here, just above my prompt input. And
  151. 4:40this type of UI customization is just
  152. 4:41really small part of all the
  153. 4:43possibilities. You can almost ask it to
  154. 4:45update things on the fly for any part of
  155. 4:47harness. And there's a Pi Agent package
  156. 4:49catalog. So, you can install extensions
  157. 4:51built by others. So, even though default
  158. 4:53Pi Agent don't have any of those
  159. 4:54features, we can find almost every
  160. 4:56popular Cloud Code Codex feature already
  161. 4:59implemented by someone that you can plug
  162. 5:01into your Pi Agent, like the Go feature,
  163. 5:03the MCP adapter, the Chrome browser
  164. 5:05access, the ask user question tool, sub
  165. 5:07agents, plan mode, and even dynamic
  166. 5:09workflow and computer use. If you want
  167. 5:11to enable dynamic workflow, you simply
  168. 5:13copy this package of dynamic workflow,
  169. 5:15run this command, then reload. Now I can
  170. 5:17just give a prompt including keywords
  171. 5:19like workflow, then works almost like
  172. 5:21Cloud Code's dynamic workflow feature.
  173. 5:23It will trigger workflow, and I can also
  174. 5:25do {slash} workflow, which will pop up
  175. 5:27this workflow UI, and you just get a
  176. 5:28very similar, almost identical
  177. 5:30experience from the Cloud Code. There
  178. 5:32even package that will just turn your Pi
  179. 5:34Agent into a Cloud Code or Codex. The
  180. 5:37package all special tooling those other
  181. 5:39harness has, so you can install and use
  182. 5:41that artifact. There even extension that
  183. 5:43allow you to play DOM while the agent is
  184. 5:45running. And some of the extensions
  185. 5:46might not be well-built, but technically
  186. 5:48you can actually ask agent update and
  187. 5:50build for you. And with this
  188. 5:51flexibility, I can already see some
  189. 5:53really interesting things that only
  190. 5:54possible to be built with pipe. For
  191. 5:56example, this one package called Pi
  192. 5:58hyper. What it does is that it will
  193. 5:59capture every tool call hook for things
  194. 6:01like bash command to actually making
  195. 6:03sure it pre-processing the bash command
  196. 6:06result and only return relevant and
  197. 6:08minimum information back to the agent.
  198. 6:10For example, previously, if agent is
  199. 6:11running Git log to see what are recent
  200. 6:13commits, command will include a lot of
  201. 6:15information for each commit like hash,
  202. 6:16author, date, body, and diff blocks. But
  203. 6:19with this package, it will actually
  204. 6:20clean things up to show only what
  205. 6:22matter. And just by doing this, it can
  206. 6:24probably reduce 96% of those type of
  207. 6:26commits. And in some other testing
  208. 6:28commits, it will all cut token by like
  209. 6:3080 to even 90%. And this is a good
  210. 6:32example where things like that is just
  211. 6:33difficult to implement with cloud code
  212. 6:35or codex because their pre-tool use cook
  213. 6:38only allow you to append new information
  214. 6:40to the tool call rather than directly
  215. 6:42modify the tool call result. So, this is
  216. 6:44rich extension system is a core that
  217. 6:46making Pi agent a super useful and this
  218. 6:48exactly how Open Claw started. So, first
  219. 6:51what they were building is mainly the
  220. 6:52gateway to connect with app Slack and
  221. 6:54the web interface while using the Pi
  222. 6:56agent as the main agent runtime. So, you
  223. 6:58can utilize agent loops, large language
  224. 7:00model OS, and the session management,
  225. 7:02but also extend it with MCP, memory sub
  226. 7:04agent, ACP, and many other things. And
  227. 7:06those type of customizability would be
  228. 7:08otherwise very difficult to achieve if
  229. 7:10Open Claw were using cloud code SDK or
  230. 7:12codex CLI. And it's actually pretty easy
  231. 7:14to build those extensions. I'm going to
  232. 7:16show you a few quick examples. So, to
  233. 7:18build extension, you can just create a
  234. 7:19dot pi folder in any project folder or
  235. 7:21in your root and then add an extensions
  236. 7:23folder inside it. And here is a few
  237. 7:25examples. So, let's say you want to
  238. 7:26modify agent's context to always be
  239. 7:28aware of the current Git repo like which
  240. 7:31branch it is on, what are the available
  241. 7:32work trees, un-staged changes, and
  242. 7:34recent commits. We can simply create
  243. 7:36extension like this, which is in
  244. 7:37TypeScript, and adding a Git function
  245. 7:39which will run the Git command get all
  246. 7:41those Git related information back,
  247. 7:43extract and generate a Git summary. And
  248. 7:45then just simply do this
  249. 7:46pi.on_before_agent_start
  250. 7:48and modify the system prompt, append
  251. 7:50additional Git context after the
  252. 7:52predefined system prompt. And this is as
  253. 7:54simple as it get. Once you put this
  254. 7:56extension file here, the next time you
  255. 7:58load the pi agent, it will automatically
  256. 7:59have those contexts. I can simply ask
  257. 8:01it, "What's the Git information here?
  258. 8:03Use no tools to answer me." And it will
  259. 8:05return back the information. And
  260. 8:06meanwhile, you can also easily add
  261. 8:07custom tools. Like, what if you want
  262. 8:09your pi agent to be able to read what's
  263. 8:11in your clipboard? You can simply do
  264. 8:13this pi.register_tool,
  265. 8:15give it a name, label, description, and
  266. 8:17param, then define the actual function
  267. 8:19here. With this, if I go copy the
  268. 8:21previous Git context extension file, and
  269. 8:23I will just ask it, "What's in my
  270. 8:24clipboard?" It will use the tool that we
  271. 8:26write to get clipboard information. And
  272. 8:28we can even build something more
  273. 8:29interesting, like this permission gate.
  274. 8:31So, the idea is that what if you want
  275. 8:32this agent to be used by your team,
  276. 8:34where each one might have different
  277. 8:35permission access to different level of
  278. 8:37information? Instead of message sent
  279. 8:39directly to agent, or let the agent
  280. 8:41decide whether the user has right
  281. 8:43permission, what if we add a permission
  282. 8:45check using a cheap and fast small
  283. 8:46model? If it's all good, then continue
  284. 8:49with agent as normal. But if it is some
  285. 8:51dangerous information, you can just stop
  286. 8:52the session right away. And here, we
  287. 8:54just write another extension. We are
  288. 8:55using two different package, which I
  289. 8:57will dive a bit deeper. One is a pi
  290. 8:59coding agent that allow you to write
  291. 9:00extension API, but also this pi AI
  292. 9:04package, which is some package from pi
  293. 9:05agent that allow you to do large
  294. 9:07language model call with any model very
  295. 9:08easily. So, we define a small gate model
  296. 9:11to use Haiku and output decision whether
  297. 9:13it's allowed or denied, plus a
  298. 9:15reasoning. Then we package this as small
  299. 9:16decide tool, the system prompt, as well
  300. 9:19as the user message, which load up both
  301. 9:21the policy, which is permission.md file
  302. 9:23that user can define on the root, plus
  303. 9:25the user request. And we use this
  304. 9:26function provided by the pi AI package
  305. 9:29to direct call the large language model
  306. 9:31and output result. All we need to do is
  307. 9:33just when the session start, we will
  308. 9:35load up the policy information in the
  309. 9:37prompt. And then after every time user
  310. 9:39send a message, we're showing message on
  311. 9:41the UI saying permission checking, wait
  312. 9:43for the large language model result. If
  313. 9:45it is denied, then on the UI we will
  314. 9:47show this block information and skips
  315. 9:49agent entirely. Otherwise, continue like
  316. 9:51normal. To test it, you can just define
  317. 9:53a permission.md file to define a
  318. 9:54specific permission. Like here I said
  319. 9:56only Jason can get revenue data. So if I
  320. 9:59go to my Pi agent, ask what's the
  321. 10:01revenue for June, it will trigger
  322. 10:02permission and show me back this
  323. 10:04information that is blocked. That you
  324. 10:06don't have permission to access revenue
  325. 10:07information. So this is one example of
  326. 10:09how you can update Pi agent's harness by
  327. 10:12writing those extension. And most of the
  328. 10:13time you actually don't need to learn
  329. 10:15building those extension yourself, cuz
  330. 10:17you can just talk to the Pi agent, it
  331. 10:18will self-evolve. However, the real
  332. 10:20power of Pi, from my point of view, is
  333. 10:23actually not just use it as a coding
  334. 10:25agent, but actually build on top of Pi
  335. 10:27agent to powering your AI products. If
  336. 10:29you can look at Pi agent repo, it
  337. 10:31actually comes with five different
  338. 10:32package. The first one is this AI
  339. 10:34package. This is almost like a Vercel AI
  340. 10:37SDK that allow you to call different
  341. 10:39large language models. It comes with all
  342. 10:41the OAuth function to allow your user to
  343. 10:43connect cloud code subscription, code
  344. 10:45act subscription. So you can actually
  345. 10:46use this as standalone function to just
  346. 10:49do large language model call in the
  347. 10:50application you're building. The second
  348. 10:51package is this agent package. This is
  349. 10:54basically the agent loop. You can
  350. 10:55consider almost this like a Vercel AI
  351. 10:57SDK stream text function that has this
  352. 11:00small agent loop built in. The third one
  353. 11:02is this coding agent. So coding agent
  354. 11:04you can use agent core loop as well as
  355. 11:07AI package, but comes with this
  356. 11:09essential tooling like read, write, add,
  357. 11:11and bash, as well as session management,
  358. 11:13compassionate context window, the
  359. 11:15extension system, as well as SDK. And
  360. 11:17this package, you can almost consider as
  361. 11:20equivalent to the cloud code agent SDK,
  362. 11:23but it is fully customizable and you can
  363. 11:25connect to any model you want. And in
  364. 11:26the end it also comes with this TUI
  365. 11:28package that wraps the coding agent in
  366. 11:30this terminal UI. And also a up trader
  367. 11:33package. So this up trader package allow
  368. 11:34you to build like schedule job or
  369. 11:36delegate task to different Pi agent
  370. 11:38process. And this is been more
  371. 11:39experimental. But you can see that based
  372. 11:42on the type of a product you're
  373. 11:43building, you can actually utilize the
  374. 11:44Pi agent's ecosystem to scaffolding the
  375. 11:47agent products. And I actually utilize
  376. 11:49this coding agent SDK to build a product
  377. 11:52like Posia, which is a a times agent
  378. 11:54that can launch and run business to
  379. 11:55showcase the real power. And I'm going
  380. 11:57to show you very quickly how I build it
  381. 11:59to help you draw a picture. So as I
  382. 12:01mentioned, I'm using this coding agent
  383. 12:02package because it comes with a SDK that
  384. 12:05you can use. If you are trying to build
  385. 12:07a local agent, which means the agent
  386. 12:09system that lives on user's own
  387. 12:11computer, then this package basically
  388. 12:12give you most of stuff that you need.
  389. 12:14And you can just easily extend
  390. 12:15functionality by building extension
  391. 12:17system, custom UI, and task triggers.
  392. 12:20One good example is this all my Pi
  393. 12:22coding agent. This is coding agent that
  394. 12:24build on top of Pi package. But it comes
  395. 12:26with a lot of new tools that brings
  396. 12:28performance closer to the cloud code
  397. 12:30Codex. It comes with editor type of user
  398. 12:33interface inside terminal. It even have
  399. 12:35features that allow you to just publish
  400. 12:37a specific conversation session you have
  401. 12:39with someone else. It has a QR code that
  402. 12:41people can scan or a URL you can share
  403. 12:43with others. So you can actually build
  404. 12:45very sophisticated local agent products
  405. 12:47on top of Pi agent. But meanwhile, you
  406. 12:49can also use Pi agent package to build
  407. 12:52web hosted agent product like this Posia
  408. 12:54replica I did. But there are some nuance
  409. 12:56you need to handle because the Pi
  410. 12:58e-coding agent SDK at default is
  411. 13:01designed quite tied to the local file
  412. 13:02system. But when you have this web
  413. 13:04deployed agent, which means agent run
  414. 13:06actually lives on your shared backing
  415. 13:07infrastructure. But when you try to
  416. 13:09write file, run bash command, then each
  417. 13:11user has their own sandbox. With this
  418. 13:13type structure, you will need to make
  419. 13:14some modifications. Like instead of
  420. 13:16using Pi coding agent default session
  421. 13:18manager system, which is directly tied
  422. 13:20to the general file on the computer, you
  423. 13:22probably want to store the session
  424. 13:24information in your DB and manage
  425. 13:25compassion yourself. And also for the
  426. 13:27default bash added read write tools, you
  427. 13:29probably want to wrap a layer so that it
  428. 13:31will do those operations in the sandbox
  429. 13:33that user is owning. But, it is same
  430. 13:35situation we need to handle even though
  431. 13:37you are using cloud code agent SDK. And
  432. 13:39with this, you can also build a web
  433. 13:41application like this, which is a chat
  434. 13:43agent. User can chat to it. To implement
  435. 13:45such experience, we pretty much still
  436. 13:47using the pi coding agent package. But
  437. 13:49this time we use the default resource
  438. 13:50loader. So, this is how you can pass
  439. 13:52additional extension skill to the coding
  440. 13:54agent. For example, here we define a
  441. 13:56extension for guardrail that it will
  442. 13:58block by running certain bash commands.
  443. 14:01And also define a tool to get MRR with
  444. 14:03some mock result. Then we define this
  445. 14:05resource loader. So, we can pass on the
  446. 14:08directory the agent should be working in
  447. 14:10and in the directory where agent should
  448. 14:11load extension file like OS key. And you
  449. 14:14can also define whether the agent should
  450. 14:16just load up extension skills from the
  451. 14:18door pi folder. We can also passing
  452. 14:20customized extensions. Like here, we are
  453. 14:22passing the guardrail's extension that
  454. 14:24we define in line here. As well as
  455. 14:26additional skills. So, this will allow
  456. 14:27you to customize what type of skills
  457. 14:29each agent session should have access
  458. 14:31to. Then use this create agent session
  459. 14:33function to passing the custom tools as
  460. 14:35well as a resource loader. And the rest
  461. 14:37will be similar. Based on the type of
  462. 14:39events, you can present different
  463. 14:40information on the UI. So, this is how
  464. 14:42you can build a wrong pi package. I
  465. 14:44actually use the same pi SDK build a
  466. 14:46replica version of post here, which is
  467. 14:47hosted agent system that can launch and
  468. 14:49run company autonomously. It is using
  469. 14:51pi's coding agent SDK as agent runtime.
  470. 14:54Breaking down into 11 different agents
  471. 14:56with orchestrator that's built around
  472. 14:58task entity and persist the state and
  473. 14:59context as well as tools proxy. I'll
  474. 15:01share more details step-by-step tutorial
  475. 15:03of how did I build the system from
  476. 15:05scratch in a builder club. So, you can
  477. 15:06join if you're interested. Meanwhile,
  478. 15:08I'll add some of the extension I build
  479. 15:09or some of my own favorite pi extensions
  480. 15:12into our curious skill folder. So, you
  481. 15:14can give it to pi agent and have it set
  482. 15:16up. I hope this is useful. Thank you.
  483. 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.