YouTube2Text

How Google engineers build AI agents in production (complete roadmap) — Transcript

by Google Cloud Tech · 4,384 words · 713 segments · language en · Watch on YouTube

Full transcript

  1. 0:00In this video, you're going to learn the
  2. 0:01complete architecture of modern AI agent
  3. 0:04engineering straight from five Google
  4. 0:07engineers building these systems in
  5. 0:09production.
  6. 0:10Right now, most developers are stuck in
  7. 0:12a trap.
  8. 0:13It takes 10 minutes to build an AI agent
  9. 0:16demo that looks magical,
  10. 0:18but it's much harder to figure out why
  11. 0:20it hallucinated something or why it
  12. 0:23deleted your unit test and submitted a
  13. 0:26massive broken pull request in
  14. 0:28production. Fixing that isn't just about
  15. 0:30writing better prompts. So let's explore
  16. 0:33the four layers of agent engineering
  17. 0:36with Logan, who'll explain the four
  18. 0:38layers to us.
  19. 0:41>> Everything changing in AI engineering
  20. 0:43right now comes down to one shift,
  21. 0:45replacing yourself as a copy-paste
  22. 0:48middleman and moving from prompt
  23. 0:50engineering to loop engineering. Loops
  24. 0:52live inside what we call the harness,
  25. 0:54the layer of software that sits between
  26. 0:55the raw models underneath, like Gemini
  27. 0:58or Gemma, and the finished application
  28. 1:00on top. It treats the model as a fixed
  29. 1:02black box and builds a system around it
  30. 1:04to make it reliable.
  31. 1:05When we look inside the harness, the
  32. 1:07engine at the center is simple. You take
  33. 1:09a model like Gemini, equip it with tools
  34. 1:11like a command line, file system access,
  35. 1:14or MCP servers, and wrap it in a while
  36. 1:16loop.
  37. 1:17That's the loop. On its own, a raw while
  38. 1:20loop is pretty brittle. To turn it into
  39. 1:22a system you can actually trust in
  40. 1:23production, you have to engineer the
  41. 1:25layers around it. Let's break down a
  42. 1:27production loop piece by piece across
  43. 1:29four layers, each one solving a specific
  44. 1:32mode of the engine. Layer one is about
  45. 1:34managing the context window before the
  46. 1:36agent acts.
  47. 1:37And we can think about this in three
  48. 1:39parts. First, concise contact maps.
  49. 1:42Instead of a massive manual that goes
  50. 1:44out of date, you give the loop a
  51. 1:46lightweight map like an agent file that
  52. 1:49tells the agent how the repository is
  53. 1:51structured and where to look next.
  54. 1:53Second, persistent memory.
  55. 1:55On its own, the model forgets everything
  56. 1:57between runs, but we don't let that
  57. 1:59For long tasks, the loop uses markdown
  58. 2:02plans and task lists on disk to record
  59. 2:05what is done, what failed, and what is
  60. 2:07next. Third, modular skills. Your agent
  61. 2:10doesn't need cloud run or IAM
  62. 2:12instructions on every run. Instead, you
  63. 2:15package specialized workflows and
  64. 2:16scripts into skills on disk that get
  65. 2:19pulled into the context window only when
  66. 2:21the loop actually needs them. That is
  67. 2:23how an agent learns new domain expertise
  68. 2:25on the fly without overloading the
  69. 2:27context window. Okay, so layer one gave
  70. 2:30our loop a map, a memory, and skills.
  71. 2:33The agent writes some code, runs the
  72. 2:35build tool, sees zero syntax errors, and
  73. 2:38stops the loop. Task complete, right?
  74. 2:41Not quite. Just because our code
  75. 2:42executed successfully doesn't mean it is
  76. 2:45doing what we want. That's why layer two
  77. 2:47wraps the loop in fast, deterministic
  78. 2:50guard rails. Now our code compiles,
  79. 2:52respects module boundaries, and passes
  80. 2:54every unit test in layer two.
  81. 2:57Are we ready to merge?
  82. 2:58Not quite. Code can pass 100% of your
  83. 3:01unit tests and still be wrong.
  84. 3:02Layer three adds semantic and multimodal
  85. 3:05review.
  86. 3:06Here, we decouple generation from
  87. 3:08critique.
  88. 3:09Instead of the coding agent grading its
  89. 3:11own homework, the harness spins up an
  90. 3:13independent reviewer agent,
  91. 3:15like Gemini, in a fresh, unbiased
  92. 3:17context window to review the diff
  93. 3:19against your engineering standards. And
  94. 3:21because Gemini is natively multimodal,
  95. 3:24the loop can spin up the app in a
  96. 3:25headless browser, capture screenshots or
  97. 3:28video of the UI, and inspect how the
  98. 3:30feature actually looks and behaves
  99. 3:32before a human engineer gives final sign
  100. 3:34off. With layers one, two, and three, we
  101. 3:36have a complete runtime engine for
  102. 3:37executing a single task.
  103. 3:39So what's layer four?
  104. 3:41Think about how an engine is built in
  105. 3:42the real world. Layers one through three
  106. 3:44are the components inside the car while
  107. 3:46it's driving down the road.
  108. 3:48Layer four is the diagnostic test bench
  109. 3:50in the garage.
  110. 3:51Let's say you tweak your agent's file,
  111. 3:53add a new MCP tool, or upgrade models.
  112. 3:56Layer four is about evaluating and
  113. 3:58scoring the harness itself.
  114. 4:00>> Logan just gave us the blueprint for the
  115. 4:02entire four layer engine. Learn, guard,
  116. 4:06review, and score.
  117. 4:08So, let's dive deep into layer number
  118. 4:10one, learn.
  119. 4:12How can we get our agentic system to
  120. 4:15learn from a large amount of documents,
  121. 4:17rules, or tools? If you add everything
  122. 4:20your agent needs to learn into the
  123. 4:22prompt, you end up killing your context
  124. 4:24window.
  125. 4:26That's exactly where agent skill comes
  126. 4:28in. Let's move over to Remic, who will
  127. 4:32teach us what agent skills are and how
  128. 4:35to use them.
  129. 4:37>> If you've ever tried to get an AI coding
  130. 4:39agent to follow your team's actual
  131. 4:41workflows, you've probably hit the same
  132. 4:44wall.
  133. 4:45Out of the box, coding agents rely on
  134. 4:48static training data, so they invent
  135. 4:50outdated SDK code, guess invalid CLI
  136. 4:53flags, or run risky terminal commands
  137. 4:55without asking.
  138. 4:57And if you try to fix that by stuffing
  139. 4:5950 pages of rules and docs into your
  140. 5:01system prompt, you blow up your context
  141. 5:04window and make the agent even worse at
  142. 5:06coding.
  143. 5:07To fix this, you don't need a bigger
  144. 5:09model or a longer prompt. You need agent
  145. 5:13skills. Open sourced in December 2025,
  146. 5:16the agent skill specification quickly
  147. 5:18became one of the biggest shifts in
  148. 5:20agent engineering. And today, it is
  149. 5:23supported across Cloud Code, Codex,
  150. 5:25Antigravity, and almost every major
  151. 5:28coding harness. At its core, a skill
  152. 5:31isn't some complex framework. It is just
  153. 5:33a portable folder.
  154. 5:35Inside, you put a skill MD file with two
  155. 5:38things, a tiny metadata at the top
  156. 5:41describing when to use it
  157. 5:43and a plain markdown instructions
  158. 5:45underneath explaining how to do the job,
  159. 5:48plus some optional folders for helper
  160. 5:50scripts or reference docs. Remember that
  161. 5:53scene in the Matrix where Trinity needs
  162. 5:55to fly a helicopter? She calls Tank and
  163. 5:58downloads the pilot program in seconds.
  164. 6:00That is what an agent skill fills. You
  165. 6:02package your workflow once, and a
  166. 6:04compatible can pick it up instantly.
  167. 6:07Now, the obvious question is, if I give
  168. 6:09my agent 100 skills, doesn't that still
  169. 6:12clog up the context window?
  170. 6:15No. And the reason why is progressive
  171. 6:17disclosure. Instead of dumping
  172. 6:19everything into memory at once, skills
  173. 6:22load in three stages.
  174. 6:25First stage, discovery. When your agent
  175. 6:27starts up, it only reads the short name
  176. 6:30and the description of each skill. That
  177. 6:33takes a minimum number of tokens and
  178. 6:35it's just enough for an agent to know
  179. 6:37what's available.
  180. 6:39Second stage, activation. Only when your
  181. 6:42prompt actually matches a skill
  182. 6:44description does the agent load the full
  183. 6:46skill MD file instructions into your the
  184. 6:49memory.
  185. 6:51And free the execution. Any extra files,
  186. 6:54reference files or scripts are only
  187. 6:56loaded when this specific step is
  188. 6:59needed. So one skill travels fine on its
  189. 7:01own. If you just want your agent to
  190. 7:03format PRs or run a database migration
  191. 7:06your way, a single skill is all you
  192. 7:08need. Wrapping one skill in a plugin is
  193. 7:11an overkill. Where agent plugins
  194. 7:13actually earn their keep is when a
  195. 7:15complex domain needs multiple skills,
  196. 7:17live MCP service and routing rules
  197. 7:20working all together.
  198. 7:22Using a plugin JSON manifest, you bundle
  199. 7:24all of these pieces into one installable
  200. 7:27unit. To wrap up, you don't have to
  201. 7:29choose between speed of AI coding agents
  202. 7:31and the safety of cloud best practices.
  203. 7:34With Google Cloud Developer plugin, you
  204. 7:36get one click install, live
  205. 7:38documentation from Developer Knowledge
  206. 7:40MCP server, strict IAM and billing guard
  207. 7:43rails and on demand access to over 150
  208. 7:46Google Cloud skills. And remember, it's
  209. 7:49not only limited to Antigravity. You can
  210. 7:52use the exact same plugin and skill
  211. 7:54catalog with Cloud Code, Codex or any
  212. 7:57other compatible agent. You can try it
  213. 7:59out today in under 30 seconds by opening
  214. 8:02customizations in Antigravity,
  215. 8:05scrolling down to Build with Google,
  216. 8:08looking for the Google Cloud developer
  217. 8:09plugin
  218. 8:11and clicking add.
  219. 8:12>> Now you know how to use agent skills
  220. 8:14when engineering your agentic system. So
  221. 8:18your agent can now learn.
  222. 8:20But there's something else. Let's say
  223. 8:22your AI agent gets stuck or is not able
  224. 8:26to carry out an action. It might
  225. 8:28actually cheat.
  226. 8:30Prompting the model to be careful won't
  227. 8:32actually save you here because a prompt
  228. 8:34is just advice
  229. 8:36to keep bad code or bad actions from
  230. 8:39getting in the way of your agentic
  231. 8:41system. You need layer number two, which
  232. 8:44is cold deterministic gates that the
  233. 8:47model cannot negotiate with or edit.
  234. 8:50Next up, we'll move on to Aaron, who's
  235. 8:52going to teach us how to lock down your
  236. 8:54agentic system.
  237. 8:57>> When your agent finishes writing code
  238. 8:59and says all the tests passed, how can
  239. 9:01you trust it?
  240. 9:02Ask yourself three things. Were those
  241. 9:04tests already there or did the agent
  242. 9:07just write them?
  243. 9:08Did it tweak any old tests just to get a
  244. 9:10green light?
  245. 9:11And if you ran those exact checks
  246. 9:13tomorrow on a totally fresh machine,
  247. 9:15would they still pass?
  248. 9:17If you don't know for sure, you're just
  249. 9:19taking the agent's word for it. Today,
  250. 9:21we're diving into deterministic checks,
  251. 9:23the hard rules that control what code
  252. 9:26your AI agent can actually keep. When I
  253. 9:28say deterministic check, I just mean
  254. 9:31running code that gives you the exact
  255. 9:33same result every time without any AI
  256. 9:35model chiming in or changing its mind.
  257. 9:38Compilers, type checkers, a test suite
  258. 9:40with fixed inputs, lint rules, secret
  259. 9:43scanners, source component analysis, and
  260. 9:45security tests based on defined rules.
  261. 9:48Why do these matter so much for agents?
  262. 9:50First, they're less expensive than using
  263. 9:51tokens and faster to run on every loop.
  264. 9:54Second, they give you clear feedback
  265. 9:56like the exact file, line number, and
  266. 9:58error message. Prompt instructions or
  267. 10:00skills are great guidelines, but models
  268. 10:03don't always follow them perfectly. A
  269. 10:04hard deterministic gate is still a
  270. 10:06safety net to keep AI randomness more
  271. 10:09under control.
  272. 10:10Most people focus on security guard
  273. 10:12rails first, but security is a part of
  274. 10:14quality and overall stability.
  275. 10:16When an agent tries to rewrite half your
  276. 10:18code base, ignores helper functions you
  277. 10:20already have, or breaks code that was
  278. 10:23working fine 5 minutes ago, you will
  279. 10:25feel the impact even if there are no
  280. 10:26security vulnerabilities.
  281. 10:28These are the gates that catch it. When
  282. 10:30writing new code, make sure new tests
  283. 10:32actually fail first, otherwise they're
  284. 10:34not really testing new functionality.
  285. 10:37Before writing implementation code, the
  286. 10:39harness runs the new test. If it passes
  287. 10:41right away, it's not testing anything
  288. 10:43new, so kick it back out. Moving in tiny
  289. 10:46red green refactor steps keeps commits
  290. 10:48small, so if something breaks, you know
  291. 10:51exactly what caused it. Agents can be
  292. 10:53sneaky when trying to get to green. They
  293. 10:55might change assertions, add skip tags,
  294. 10:57or disable linters. Don't just ask them
  295. 11:00nicely in the prompt, set up actual git
  296. 11:02hooks. Fail the run automatically if
  297. 11:05existing tests get edited, if test
  298. 11:07counts or coverage drop, or if config
  299. 11:10files get modified.
  300. 11:12Always rerun new tests a few times to
  301. 11:14catch flakiness. If a test only passes
  302. 11:1680% of the time, block it until it's
  303. 11:19solid.
  304. 11:20Having tests clean up their own database
  305. 11:22state and run against a real local
  306. 11:23database helps keep things reliable.
  307. 11:26Security gates use the exact same idea.
  308. 11:28Consistent inputs, predictable outputs,
  309. 11:31and clear error reports.
  310. 11:33Run secret scanning on every commit.
  311. 11:36Even if your prompt tells the agent
  312. 11:37never to hard code keys, a scanner
  313. 11:39guarantees that if one slips in, it
  314. 11:42can't get committed.
  315. 11:43Use static analysis tools to catch
  316. 11:45common mistakes, things like building
  317. 11:47SQL queries with string concatenation or
  318. 11:49unvalidated user input. It either
  319. 11:51matches a rule or it doesn't.
  320. 11:54Keep dependencies tight. Make sure new
  321. 11:56packages get pinned in lock files and
  322. 11:58scanned for known vulnerabilities.
  323. 12:00This also stops slop squatting where an
  324. 12:02agent hallucinates a package name that
  325. 12:04someone else actually published
  326. 12:06maliciously. When a gate fails, send the
  327. 12:08raw error log straight back to the
  328. 12:10agent, rule ID, file, line number,
  329. 12:12failing assertion. Set a retry limit
  330. 12:14like three attempts. If it still can't
  331. 12:16fix it, stop and hand it over to a human
  332. 12:19with the log attached. Infinite retry
  333. 12:21loops just waste time and tokens.
  334. 12:23Never let the agent modify gate
  335. 12:25configurations or hook scripts. Keep
  336. 12:27those files out of its right scope or
  337. 12:29fail the build automatically if it tries
  338. 12:30to touch them. Every gate failure leaves
  339. 12:32useful data behind. Over time, you'll
  340. 12:35spot patterns. Maybe the agent keeps
  341. 12:37using outdated libraries or forgets
  342. 12:39tenant filters or writes weak mocks.
  343. 12:42Use those failure logs to refine your
  344. 12:44agent skills and prompt context.
  345. 12:46When you figure out a recurring fix, add
  346. 12:49that pattern into your repository skill
  347. 12:51files so future agents get it right on
  348. 12:53the very first try.
  349. 12:55Even after updating a skill, keep the
  350. 12:56gate active. Skills help the agent
  351. 12:58produce better code, but gates are what
  352. 13:00keep bad code from getting merged. If a
  353. 13:03new issue keeps popping up unchecked,
  354. 13:05write the deterministic gate first, then
  355. 13:08update your skill files second.
  356. 13:10By the time code reaches human review,
  357. 13:12it should already have passed every
  358. 13:13objective check automatically. That
  359. 13:15leaves you free to focus on high-level
  360. 13:18questions. Is this good architecture? Is
  361. 13:20this change worth making?
  362. 13:22>> So Aaron just taught you how to guard
  363. 13:24your agentic system, but passing 100% of
  364. 13:27your unit test still doesn't mean that
  365. 13:30you can hit merge. So how do you
  366. 13:32actually check if, for example, a
  367. 13:34massive amount of AI generated code
  368. 13:37works as it should?
  369. 13:38That is where the review layer comes in.
  370. 13:41And next up, we have YK, and he's going
  371. 13:44to show us how he reviews massive AI
  372. 13:47generated code.
  373. 13:49>> After you have your agent in a loop
  374. 13:51generate a bunch of code, what are the
  375. 13:53best ways to review it, whether it's you
  376. 13:56who generated it or someone else?
  377. 13:58Essentially, how do you deal with a PR
  378. 14:00that's 200,000 lines long?
  379. 14:03The first thing you want to check is is
  380. 14:05it actually a valid PR?
  381. 14:08What I mean by that is does it need to
  382. 14:10be 200,000 lines long? Could it be 10
  383. 14:14PRs with 20,000 lines of code each, or
  384. 14:17could it be maybe 50,000 lines of code
  385. 14:20instead of 200,000 to achieve the same
  386. 14:23results? Before AI, it was the best
  387. 14:26practice to keep each PR small, and it
  388. 14:29is still the best practice. So
  389. 14:31definitely look at that aspect first, no
  390. 14:34matter who generated it, whether it's
  391. 14:36from a loop or someone else.
  392. 14:39But these days, the reality is it's
  393. 14:41sometimes difficult to keep your PRs
  394. 14:44small. Sometimes it's not feasible or
  395. 14:46realistic. So what should we do about
  396. 14:48that?
  397. 14:49So personally, I think a code review
  398. 14:51like eating a watermelon.
  399. 14:54It used to be the case that you could
  400. 14:55eat the whole watermelon because each
  401. 14:58PR, at least in theory, was small enough
  402. 15:00to read line by line.
  403. 15:03But with a large PR, the best you can do
  404. 15:06is slice it in a few different ways.
  405. 15:08So to show what this looks like in
  406. 15:11practice, we're going to take a look at
  407. 15:14this particular PR from this repo right
  408. 15:17here.
  409. 15:18First, you might already have a system
  410. 15:21for automatically reviewing your PR, and
  411. 15:24that's great if you already do. So here
  412. 15:27it looks like this where Gemini
  413. 15:29automatically reviews every single open
  414. 15:31PR and gives you comments on
  415. 15:34specific parts of the PR.
  416. 15:37And then as a reviewer or as the person
  417. 15:40who submitted this PR,
  418. 15:43you need to address them, resolve them,
  419. 15:45and so on. And that's a great first
  420. 15:47step. And I consider these systems
  421. 15:51to be essentially one-shot AI code
  422. 15:54review systems.
  423. 15:55And even though these one-shot AI code
  424. 15:57review systems are great,
  425. 16:00they're often not sufficient by
  426. 16:02themselves. So what I recommend to add
  427. 16:05on top of that is more of an interactive
  428. 16:08code review. So the way you can do that
  429. 16:10is you can specify the PR you want to
  430. 16:12review and say
  431. 16:14I'm in the process of reviewing this PR.
  432. 16:17Can you give me a summary of each file?
  433. 16:19Just a quick one-sentence summary so I
  434. 16:21can understand it better.
  435. 16:23So that way you can get a quick summary
  436. 16:25for each file.
  437. 16:27And then the next few steps I recommend
  438. 16:30are what I consider to be multimodal
  439. 16:33code review. Uh you can use a few
  440. 16:35different things for it. You can
  441. 16:36actually use for one
  442. 16:39this code itself that's already merged
  443. 16:42here in this PR that we were just
  444. 16:43reviewing as practice.
  445. 16:46It's called repo walkthrough. It's a
  446. 16:49skill for turning any code
  447. 16:52diff PR or repo into an interactive
  448. 16:56visualizer and a video so you can review
  449. 16:59it from a different angle. Here I
  450. 17:02already have the skill
  451. 17:04installed
  452. 17:06so I can just say
  453. 17:12can you turn this PR, just this entire
  454. 17:14PR into a walkthrough
  455. 17:18visualizer, website, and video so I can
  456. 17:21check it that way.
  457. 17:24So that's the prompt you can use once
  458. 17:26you install it.
  459. 17:27The way it looks is
  460. 17:30once you get the result is like this.
  461. 17:33You have different layers of this PR and
  462. 17:35then you can look at this layer by
  463. 17:37layer. So what's the top layer? You have
  464. 17:40readme, skill.md and then a few
  465. 17:43different sort of top layer files.
  466. 17:45And then it goes into this SVG graph and
  467. 17:48diff visualizer.
  468. 17:51And
  469. 17:53it goes
  470. 17:54through uh this data ADK file as well.
  471. 17:59So you can start to get an understanding
  472. 18:02of the architecture that way, a visual
  473. 18:05understanding of that as well.
  474. 18:07Alternatively, you can just ask
  475. 18:08questions about the architecture too.
  476. 18:11The second concept I wanted to introduce
  477. 18:14is the fact that you can automate a lot
  478. 18:16of visual QA testing as well.
  479. 18:20So I created a system for example that
  480. 18:23uses Gemini 4 Hydrogen
  481. 18:25to first automatically record the screen
  482. 18:29for your website in different screen
  483. 18:31sizes
  484. 18:32and then have Gemini 4 Hydrogen critics
  485. 18:35watch the videos as well as the
  486. 18:36screenshots
  487. 18:38to make sure there's no issue and if
  488. 18:40there are issues, they report back to
  489. 18:43the main thread and the main thread is
  490. 18:45able to either just report it or fix it
  491. 18:48automatically. For example, these you
  492. 18:51know overlapping elements, it's able to
  493. 18:53fix them automatically. So that way you
  494. 18:56still need to do QA testing yourself.
  495. 18:58You still need to click around and make
  496. 19:00sure everything is good, but it's able
  497. 19:02to catch a lot of these bugs
  498. 19:04automatically too.
  499. 19:05And finally, if you're more of an audio
  500. 19:08person, if you're more of a podcast
  501. 19:10person, then there's an option to turn
  502. 19:12your PR or PR description, whatever you
  503. 19:15need to review into an audio format too.
  504. 19:18So a skill that I have per privately
  505. 19:20here is I can take this PR
  506. 19:24and say
  507. 19:26can you take this PR, just the whole PR
  508. 19:29and then uh give me a few paragraphs
  509. 19:32summary and give me an audio review site
  510. 19:35for that.
  511. 19:37And then after all of that, one thing to
  512. 19:40keep in mind is that the best way to
  513. 19:43review and test your code depends on the
  514. 19:46nature of the project and the nature of
  515. 19:48the PR itself as well.
  516. 19:50For example, if you're building UI
  517. 19:52intense applications, let's say websites
  518. 19:54or front end applications and stuff like
  519. 19:57that, then you might want to
  520. 20:00write end-to-end tests through browser
  521. 20:02tests, things of that nature to make
  522. 20:04sure there's no regression, hopefully
  523. 20:07not a lot of bugs there.
  524. 20:09If you're writing a CLI application, you
  525. 20:11might want to write end-to-end tests
  526. 20:13just for that using something like tmux.
  527. 20:16If you're writing a data intensive
  528. 20:18application or you know sending a PR to
  529. 20:20a data intensive application,
  530. 20:22then you might want to create tests that
  531. 20:25test different kinds of data to make
  532. 20:27sure it works with different types of
  533. 20:28data, different volumes of data as well.
  534. 20:32So that part highly depends on the
  535. 20:34particular application you're building,
  536. 20:36but quick note before we move on to the
  537. 20:39next segment,
  538. 20:40it's always important to check your code
  539. 20:43and make sure you have best security
  540. 20:45practices
  541. 20:47as we've covered in the last section of
  542. 20:50this video.
  543. 20:51>> With learn, guard, and review in place,
  544. 20:55you're almost complete with your agentic
  545. 20:56system.
  546. 20:58But there is one thing left waiting in
  547. 21:00production.
  548. 21:01For example, a teammate of yours might
  549. 21:03tweak a few lines in your agent.md file,
  550. 21:07or maybe they swap your agent to include
  551. 21:10a newer model. So your current task
  552. 21:13might get 20% faster, but 10 other
  553. 21:16workflows might actually silently break
  554. 21:18behind your back.
  555. 21:19And if you aren't scoring the system
  556. 21:21itself, you're not really engineering,
  557. 21:24you're just guessing.
  558. 21:25So let's close the loop with layer
  559. 21:27number four.
  560. 21:28Annie is going to teach us how to
  561. 21:30evaluate your agentic system.
  562. 21:34>> All right, let's get started.
  563. 21:36So Annie, when you say agent evaluation,
  564. 21:39what does that mean? Am I just grading
  565. 21:41the model's final answer?
  566. 21:42>> You know, grading the answer is just
  567. 21:44only one piece. LLM model can generate
  568. 21:46text. It can say, yes, I've refunded
  569. 21:49your payment, but it cannot actually do
  570. 21:52anything.
  571. 21:53But agent take actions with tools.
  572. 21:57So agent evaluation checks the whole
  573. 21:59system.
  574. 22:00We can check did it follow your rules,
  575. 22:02take the right steps, actually process
  576. 22:04the refund, and give a helpful reply.
  577. 22:07You need to consider the tool use and
  578. 22:10context management.
  579. 22:11>> Amazing. Okay, so we can actually take a
  580. 22:13look at agent evaluation in four
  581. 22:15different patterns as you said. So
  582. 22:17pattern one is when you talk about
  583. 22:20agents having actions with tools, right?
  584. 22:22So how do we actually evaluate how an
  585. 22:25agent uses its tools.
  586. 22:28>> So let's break agent evaluation into
  587. 22:30four practical patterns.
  588. 22:32And pattern one is evaluating tool use.
  589. 22:37It's very like a unit test for an
  590. 22:40agent's action.
  591. 22:42So when an agent uses tools to look at
  592. 22:44orders or issue refunds, we measure
  593. 22:47three things.
  594. 22:48First is did it choose the right tool?
  595. 22:51Second is did it pass the right inputs
  596. 22:54like exact order ID?
  597. 22:57And third is do we call them in the
  598. 22:59right order such as checking eligibility
  599. 23:02need to before issuing a refund?
  600. 23:05So in practice, we run those checks
  601. 23:07against mocked tools and sample data so
  602. 23:10we can test agent's decision
  603. 23:12consistently without ever moving real
  604. 23:14money.
  605. 23:15>> Oh, okay. That's amazing. And I think
  606. 23:17also the second thing that people will
  607. 23:19be talking about is actually agent
  608. 23:22evaluation when it comes to the fact
  609. 23:24that agents they are not deterministic,
  610. 23:26right? So that is the second pattern
  611. 23:28here. And how do you deal with, you
  612. 23:30know, the fact that if you run the same
  613. 23:32test twice, you can get two different
  614. 23:34replies?
  615. 23:35>> So pattern two is handling agent being
  616. 23:38non-deterministic by measuring both the
  617. 23:40outcome and also trajectory.
  618. 23:43You know, agents are non-deterministic.
  619. 23:45So if you run the same test twice, you
  620. 23:47might get two completely different
  621. 23:49reply.
  622. 23:50So it's very different from traditional
  623. 23:52unit test. You cannot rely on exact
  624. 23:54word-for-word string matches.
  625. 23:57Instead, we look at two things.
  626. 24:00First is the outcome and response match.
  627. 24:04So rather than exact matching, we
  628. 24:07measure similarity.
  629. 24:10We need to check how close the final
  630. 24:12response is to your expected answer and
  631. 24:14whether it followed the refund policy.
  632. 24:18And second is we need to check the
  633. 24:20trajectory.
  634. 24:21Trajectory means how the agent uses the
  635. 24:24tools step by step to get there.
  636. 24:27We can use trace to evaluate that
  637. 24:29trajectory and measuring that is the two
  638. 24:32cost match and exact sequence follow the
  639. 24:35required order or we can simply pass LM
  640. 24:38as a judge for efficiency.
  641. 24:40>> So we talked about pattern one and two
  642. 24:41when it comes to agent evaluation and
  643. 24:44then the third thing is actually scope.
  644. 24:46So how should I think about scoping my
  645. 24:48evals because it can get complicated
  646. 24:50really fast?
  647. 24:51>> Pattern three is expanding from
  648. 24:53singleton prompts all the way to
  649. 24:55multi-turn conversations.
  650. 24:58You know, in a singleton test the
  651. 25:00customer gives everything in just one
  652. 25:03message. Hi, I'm Annie. Please refund
  653. 25:05order 101
  654. 25:07and we grade the immediate reply.
  655. 25:10But real conversations are usually
  656. 25:11multi-turn, right? So turn one might
  657. 25:13just be Hi, I'm Annie. I want a refund.
  658. 25:16The agent asks for a order number.
  659. 25:18Annie gives order 101 in turn two.
  660. 25:21And then in turn three says Oh, wait. I
  661. 25:24should mean order two or two, not order
  662. 25:26101. So multi-turn evaluation tests
  663. 25:29memory and state across turns.
  664. 25:31Does the agent remember who Annie is and
  665. 25:34keep track of her refund request and
  666. 25:36refund the updated order 202 instead of
  667. 25:38101?
  668. 25:39>> Amazing. Thank you, Annie, for
  669. 25:41explaining the first three patterns of
  670. 25:42agent evaluation. The last pattern is
  671. 25:45actually multi-agent system evaluation,
  672. 25:47right? So what happens if you're working
  673. 25:50with a lot of different agents and how
  674. 25:53do you actually evaluate that system?
  675. 25:55>> So pattern four is evaluating workflows
  676. 25:58and multi-agent systems.
  677. 26:00We're moving from integration tests all
  678. 26:02the way to end-to-end tests. You know,
  679. 26:06larger systems usually look like
  680. 26:08workflows, multi-agent systems, or a mix
  681. 26:11of both.
  682. 26:13Workflow connects deterministic function
  683. 26:15nodes with agent nodes in a graph.
  684. 26:18Multi-agent system that agents
  685. 26:20dynamically delegate tasks to other
  686. 26:22specialist agents. Just like integration
  687. 26:24tests, you start by testing the handoff
  688. 26:26between nodes.
  689. 26:28In a workflow, test the handoff between
  690. 26:30functional and agent nodes, make sure
  691. 26:32data pass cleanly from code to the
  692. 26:35agents and back to downstream code. In a
  693. 26:38multi-agent system, we need to test
  694. 26:40agent-to-agent handoff on two levels.
  695. 26:42Level one is did it delegate to the
  696. 26:44right specialist agent? Level two is did
  697. 26:47it hand off the right information like
  698. 26:49Annie's updated order 202 not Annie's
  699. 26:52order 101?
  700. 26:54So once handoffs work, we need to zoom
  701. 26:56out all the way for an end-to-end
  702. 26:58evaluation, verifying that the entire
  703. 27:01system work together from the customer's
  704. 27:04first message all the way to the
  705. 27:06complete refund.
  706. 27:08>> You have now learned the four layers of
  707. 27:11agentic engineering. You can continue
  708. 27:13learning by clicking on the video here.
  709. 27:16Leave a comment on what you thought
  710. 27:18about this video and click the like
  711. 27:19button to show your support. Don't
  712. 27:21forget to check out all the links
  713. 27:23mentioned in the description box below.

About this transcript

This page contains the full transcript of How Google engineers build AI agents in production (complete roadmap) by Google Cloud Tech, generated from the public captions YouTube serves with the video. The transcript has 4,384 words across 713 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.