Google’s Free 2-Hour AI Agent Course: Master Harness, Loops & Graph Engineering (0% to 100%) — Transcript
Full transcript
- 0:00There are three popular ways to evaluate
- 0:02your AI agent. First, LM as a judge. It
- 0:05is basically using another model to
- 0:07evaluate the system. You can give
- 0:09another model the agent's response, the
- 0:11fact it should use, and your evaluation
- 0:13criteria. And then it ask questions like
- 0:16was the answer clear? Was it accurate?
- 0:18Was it supported by the facts? The model
- 0:21can then return a score or simple pass
- 0:24or fail result. And second,
- 0:26deterministic evaluation. This is when
- 0:28code checks a fixed rule. For example,
- 0:30ADK's built-in two trajectory average
- 0:32score checks if agents court exact tools
- 0:35in exact order you expected. In this
- 0:38customer refund agent example, this
- 0:41deterministic evaluation two to three
- 0:44average score can check whether the
- 0:46agent looks up the order before issuing
- 0:49the refund. It will compare the actual
- 0:52result with a golden data set using
- 0:56exact match because we are using exact
- 0:58match to compare. The rule is fixed. The
- 1:01same input will always give you the same
- 1:03result every single time. However,
- 1:05building ways are not enough. We need
- 1:07more flexible way to evaluate our
- 1:10system. And that brings us to the third
- 1:12point, a custom function. In this
- 1:15customer refund example, if you want to
- 1:17check whether the agent refunded more
- 1:20money than the customer actually paid,
- 1:22you can write your own function to check
- 1:24that. And this type of customer check
- 1:26can also be deterministic. But of
- 1:29course, it can be non-deterministic if
- 1:31you wrap an LM inside your custom
- 1:33function. And that's our three ways of
- 1:35doing agent eval. We have LM as a judge,
- 1:38deterministic evaluation, and custom
- 1:40function. You can use one approach or a
- 1:43combination of them based on your system
- 1:46needs. With those evaluation steps, you
- 1:48can ensure your AI agents are reliable
- 1:51and production ready. Let's talk about
- 1:54three layers of memory that your AI
- 1:56agent has. Those layers are state,
- 1:58sessions, and long-term memory. So,
- 2:01let's use a travel planning agent as an
- 2:03example. First, state. You can think of
- 2:06state as agents working memory. It keeps
- 2:08information the agent needs right now
- 2:10like remaining budget for your trip or
- 2:12current travel plan. It is like a
- 2:14scratch note that you can put important
- 2:16information on it and pass it among
- 2:17different components in your system and
- 2:20as a plan changes the state gets updated
- 2:23too. And second sessions a session keeps
- 2:26context of one conversation thread. It
- 2:29includes everything in the conversation
- 2:31transcript like messages to calls to
- 2:34results and state. a session service
- 2:36manager saving and loading that
- 2:38information. You could use an in-memory
- 2:40backend for example run for quick and
- 2:43easy context or you can add a persistent
- 2:45database so the session can survive
- 2:48server restarts and continue later. This
- 2:51is really important in the long running
- 2:53process. Third, long-term memory.
- 2:56Long-term memory carries useful
- 2:58information across conversations. In
- 3:00ADK, we have session service to manage
- 3:03all the sessions and memory service to
- 3:06manage the memory across the sessions.
- 3:08To use them in this trip example, you
- 3:10could told the agent that you prefer
- 3:12quiet neighborhoods. A session service
- 3:14can store all the conversations you ever
- 3:16talk to the agent. A memory service
- 3:18source and retrieves that information
- 3:20and then brings relevant memories into
- 3:22the context so you can plan it next
- 3:25trip. So memory service can help us
- 3:27manage cross session context. To
- 3:30summarize, each layer has a different
- 3:32job. State is what this agent is working
- 3:35with right now. Sessions preserve the
- 3:37current conversation and long-term
- 3:39memory carries useful information into
- 3:42the future. And now your AI is context
- 3:45aware and ready for production.
- 3:53Yeah. So today's session uh we are going
- 3:56to talk about how do you book a ticket
- 3:58at a concert you know um you like so
- 4:02this the context is um there's a band
- 4:06called Midnight Signal and you really
- 4:09want to go to this concert uh so both
- 4:11you and your friend Sam you want to go
- 4:13to there to buy a ticket however there's
- 4:15a super long line super long queue so
- 4:19you want to like use an agent to help
- 4:21you get a ticket but this agent is you
- 4:23had to wait in the super long queue. It
- 4:25has to like continuously checking, okay,
- 4:28is it my turn, is it my turn? And then
- 4:29when is your turn? The agent is able to
- 4:32help you, you know, uh, select a seat
- 4:34and then book the ticket for you. And
- 4:36the agent also need to remember your
- 4:38preference such as, oh, Sam only can
- 4:40only go on the weekend, but you prefer
- 4:42to avoid different type of seats. So it
- 4:45need to understand your preference need
- 4:47to remember all your contacts and also
- 4:49it's able to wait in the queue to book
- 4:51the ticket for you and even you refresh
- 4:53the server even you're waiting for like
- 4:56you know days or weeks is it will still
- 4:58like be there waiting for you it's
- 5:00remember uh it's it's a resumable
- 5:03process over there. So that's the uh
- 5:06that is the agent we're trying to build
- 5:07for today and um uh so today um so this
- 5:12is going to be fun. I'm going to play
- 5:13this concert music really soon. But
- 5:16yeah, uh this is not to encourage you to
- 5:19build a bot for your ticket. This is
- 5:22just a a use case, you know, we just
- 5:25want to demonstrate, you know, how to
- 5:26create a longunning uh agent and then
- 5:30how do we have the resumable state, how
- 5:32do we have the human in the loop so that
- 5:34you can configure your budget when you
- 5:36buy the ticket. So this is more like for
- 5:37the learning purpose. It's not for you
- 5:39to create an actual you know bot for you
- 5:41to get get a ticket but like um just
- 5:43want to have that claim at the very
- 5:45beginning but yeah I hope that you're
- 5:47gonna having fun you know learning how
- 5:50to creating this agent and also learn
- 5:51all the concept. So we're gonna uh break
- 5:54down our session into uh six pieces
- 5:57today. So we will learn first of all how
- 5:59do we create a single agent to create a
- 6:01ticket and then we're going to say okay
- 6:03once you want the agent to uh to just
- 6:07send uh to wake up the agent from the
- 6:09sleep to wake up the agent and actually
- 6:11checking the sitting process you will
- 6:13realize that you need a trigger you need
- 6:15to like have a trigger like how do you
- 6:17configure the trigger to uh checking the
- 6:20sitting processing and then uh next
- 6:22we're going to learn all the manage like
- 6:24a state management for the long running
- 6:25things so that even the service Even you
- 6:28restart a server, you will still
- 6:29remember where you are. And then we're
- 6:31going to try uh to pause and restart and
- 6:33resume to actually see how the long
- 6:35running workflow work. And after that,
- 6:37uh we will learn, you know, when when
- 6:39it's actually your turn to purchase the
- 6:41ticket. What if the seat you selected
- 6:43earlier is already gone like uh how do
- 6:47you uh like like even you have a great
- 6:50memory update, but in the imagine like
- 6:52uh many people are going to purchase
- 6:54this ticket at the same time, right? So
- 6:57uh when it's your turn uh the t the seed
- 7:00you selecting might be how do you handle
- 7:01that scenario when you're scaling the
- 7:03system and also how do you avoid
- 7:06purchasing twice when you are uh when
- 7:08you p like when multiple people choosing
- 7:10the same seed and then you are fail to
- 7:12purchase it and then you have to
- 7:13purchase again how do you avoid purchase
- 7:15it twice how do you basically it's a
- 7:18little bit about system design that how
- 7:19do you uh manage this long running
- 7:22workflow but multip multi people uh need
- 7:24to purchase the ticket for the system
- 7:26and lastly we're going to learn uh we're
- 7:28going to deploy all the way to cloud
- 7:29run. So yeah it's going to be um so
- 7:33we're going to um it's we're going to
- 7:34cover every single process of you know
- 7:37ma memory management state management
- 7:39longunning workflow and even like
- 7:41multiple purchasing how do we handle the
- 7:43state update how do you how do we using
- 7:46the callback to help prevent uh how
- 7:49making sure updating the seat selection
- 7:51and also uh prevent the mode uh
- 7:53purchasing twice. Yeah. So, it's a lot.
- 7:56We're going to cover a lot and and then
- 7:57hope that you're learning so much by the
- 8:00end of the session. So, that being said,
- 8:02I'm going to start sharing my screen to
- 8:03help you um set things up and I'm going
- 8:06to share my link to the chat. Making
- 8:09sure you have all the link with me.
- 8:12So, the lab is
- 8:16this is the link and also this is the
- 8:18credits.
- 8:19Hope that you already know all the
- 8:20credits.
- 8:23Okay. So this is the credit uh I'm going
- 8:26to use. And this is the uh lab. I'm
- 8:29gonna stop sharing and uh start sharing
- 8:32my uh screen for the lab.
- 8:37Okay. Yeah. So this is the link that I
- 8:41need to claim the credit. So for those
- 8:42of you who are familiar with the
- 8:43process, making sure you're using the
- 8:45Gmail account, not using a university or
- 8:47organization account. And when you claim
- 8:49the credit, you need to have a recapture
- 8:52installed on your phone. So once you
- 8:54open it, you need to verify you're human
- 8:56with the uh
- 8:59scan the QR code and then open the app
- 9:02on my phone to claim the uh credits.
- 9:08So once I claim the credits, I will open
- 9:11today's lab. So uh if you go to this
- 9:14link, this is the lab for today's link.
- 9:16As always, we already migrating all the
- 9:19lab to this uh interactive app uh format
- 9:22so that you only need to worry about the
- 9:24setup stage. Uh so once you set things
- 9:26up, everything going to be in the one
- 9:28interactive app and we will have all the
- 9:29concept. You have all the theory, all
- 9:31the diagram and all the deep dive and
- 9:34also all the uh testing in one place. So
- 9:37you do not have to you know you check
- 9:39back and forth and then you will learn
- 9:41everything in one place and uh um so you
- 9:44can review them even after the session.
- 9:47So to start all you need to do is just
- 9:49uh clone the ripple and run the setup
- 9:51script. So to clone the ripple again you
- 9:53can clone this uh in your local
- 9:55environment but today as always if
- 9:58you're if you're familiar with the
- 10:00session we are using Google cloud
- 10:01console. This is the VM on cloud. So
- 10:04that is a control environment and to
- 10:06open the to open the uh to open this
- 10:08environment you need to go to the
- 10:09console.cloud.google.com
- 10:11and on the top right we have activate
- 10:13cloud shell. So we are going to do
- 10:15everything in the cloud shell today to
- 10:16have a control environment for everyone
- 10:18but feel free to do it uh in your own
- 10:22local environment if you have UV and
- 10:24everything configured.
- 10:25So now I have I clone this repo and the
- 10:29next thing is I have the seta script. So
- 10:31the set has script probably going to run
- 10:33for like two to three minutes. What it
- 10:35does behind the scene is first it will
- 10:37checking does I redeem the credits and
- 10:39then you will create a Google cloud
- 10:41project for me and then you will link
- 10:43the credit to the project and after that
- 10:45you will configure all the API and then
- 10:47you will configure all the environment
- 10:49download the uh dependency and
- 10:51everything because in this lab you're
- 10:53using a lot of different state
- 10:54management including using the cloud SQL
- 10:56for the persistent data management. So
- 10:58we need to making sure you know um we
- 11:01have this Postgress instance running in
- 11:02the background and also we will need to
- 11:07uh deploy our so we will do like a
- 11:10deployment in the background I think and
- 11:12then and then we also need to configure
- 11:15some uh permissions so that later on we
- 11:18are able to using uh cloud run to for
- 11:22the deployment and more. So those one
- 11:24setup script uh is doing all the
- 11:26configuration for this lab
- 11:29and it usually take around
- 11:322 minute or so and then after that we
- 11:34just need to run the verify to configure
- 11:36to making sure uh things are verified
- 11:38and then run the script making sure um
- 11:43it's loading our solution and then just
- 11:46uh run the workbench script just so that
- 11:48we kick off the workbench and then
- 11:50that's all and then we will going to
- 11:52start work on this workbench.
- 11:53start from um the setup. So, oh okay.
- 11:57So, I need to create a project ID.
- 12:01So,
- 12:05it's like creating a So, I just press
- 12:07enter and then it will create a new
- 12:09project ID for me and then it will link
- 12:11to it.
- 12:13Oh, oh my gosh, I removed this. Sorry
- 12:15about that.
- 12:18Thank you so much for for uh reminding
- 12:20me. almost made the same mistake as last
- 12:23time. Thank you so much.
- 12:28Yeah, claim easily.
- 12:41[snorts]
- 12:41Oh, so this step probably take a little
- 12:43little while. So, I want to show you the
- 12:45uh the music we're playing for today.
- 12:48Um, let me see. I can show it in another
- 12:52screen so that we can listen to the
- 12:54concert while we're waiting for while
- 12:56waiting for this. Let me open one.
- 13:06Oh, okay. I guess another window doesn't
- 13:11Oh, okay. This is working. Let me share
- 13:13my screen for another one because this
- 13:15one is still loading. I have another one
- 13:17that uh I'm already tried it earlier. So
- 13:21I'm going to share this one. Yeah. So
- 13:24this is like what you're going to see
- 13:25later on when you uh spin up this
- 13:27workbench. You will have a multiple
- 13:29step. Um you'll have this multiple step
- 13:32and then we have everything in one
- 13:33place. So this is the ticket master. Uh
- 13:37the ticket monster [laughter]
- 13:40we're gonna work on. So this ticket
- 13:43monster is a is a app that we want to uh
- 13:45use the agent to book the ticket for us.
- 13:48Uh and then you will like waiting in the
- 13:49queue and then checking whether we at
- 13:51the front of the queue and then book the
- 13:52ticket for us. And this is a concert
- 13:55we're going to we will we will see.
- 13:59First I want to making sure I share the
- 14:01screen with music because last time I
- 14:03didn't share the screen with music so
- 14:05you guys couldn't hear my voice. Not
- 14:08making sure. Okay. Share the screen with
- 14:11music. Cool. I'm going to play this.
- 14:13This is the
- 14:15So, we're going to jam is this music
- 14:19this
- 14:25[music]
- 14:29[singing]
- 14:31[music]
- 14:34>> midnight signal. Midnight signal. Yeah,
- 14:36we're burning through a spectral
- 14:37current. Searching for you. No fear in
- 14:39the shadow. No heat in the wire. Jessica
- 14:41[music]
- 14:42fire with a high static in the air.
- 14:46>> Okay, I'm gonna stop playing. Uh yeah,
- 14:49so this is also generated by AI from
- 14:51Google's lyrics model. Uh this whole
- 14:54band music. [laughter]
- 14:56Yeah,
- 14:57gems. Yeah, thank you. So Christina
- 14:59generated this uh uh this this music. So
- 15:01this whole lab is actually kudo to
- 15:03Christina that she created the lab and I
- 15:05re I rework on her lab and then she has
- 15:08some conflict today unfortunately. So I
- 15:10have to like I will deliver the slap for
- 15:11her. Um but yeah this is like a fun
- 15:14energy from the concert and uh yeah so
- 15:18this is the whole uh interface you're
- 15:20going to work on and this is the band
- 15:22you want to watch the concert you want
- 15:24to go and you want to purchase the
- 15:25ticket for this concert and this the
- 15:27whole story. So let me switch back the
- 15:29screen for my setup screen. U making
- 15:31sure I have successfully set up
- 15:33everything. just uh share the screen and
- 15:36um
- 15:39share my screen for another one.
- 15:44Okay. Yeah, as you can see this is still
- 15:47loading. Oh, cool.
- 15:50Right. So, uh once you see something
- 15:52like this, it should work on 4800
- 16:004,800 but uh 4,800.
- 16:03But just to double check. So here is a
- 16:05venue. So this venue is the uh is the
- 16:07ticket monster you're you're going to
- 16:10have. So we deploy this one for you when
- 16:11we run the setup script. So if you want
- 16:13to play the music, you can play the
- 16:15music here. And um
- 16:18over here uh it says uh verify
- 16:21everything. But I just want to making
- 16:22sure I follow the step to
- 16:26just configure everything. So I will
- 16:28making sure I run this your solution so
- 16:31that it can have loading all the
- 16:32solution for me so that I don't have to
- 16:34do the uh change during the during the
- 16:39lab and then and then next step is to
- 16:42load this with 4 4800
- 16:45and then run this um workbench script
- 16:47again it's already uh on 4800. So
- 16:51everyone now need to focus on this is
- 16:54the final step for us to open this app.
- 16:58So the to open this app is making sure
- 17:01uh there's a web preview. So there's a
- 17:03button called web preview and then uh
- 17:06okay just emphasize it twice. There's a
- 17:09button called web preview. So click the
- 17:10web preview and then change the port to
- 17:13um 4800 and then do the change and
- 17:16preview so that you will go to the
- 17:184,800. But if you're in your local host,
- 17:20you should be able to open it in your
- 17:22local host. But if you're on cloud cloud
- 17:24shell, you can preview this on this
- 17:264,800 port. It is on back preview button
- 17:28like it's on the top right back preview
- 17:31button. And then change the port to
- 17:324,800. And then you'll be able to see
- 17:34the things over here. And I feel like uh
- 17:37light mode today. So [laughter]
- 17:39on the top right, you have the light
- 17:40mode. And here we successfully open up
- 17:43our app for today. And this is a
- 17:45midnight signal I just played over
- 17:47there.
- 17:49And um as uh if so we have all the stab
- 17:53over there. So now we do not need to
- 17:55have this uh collab. This collab is
- 17:57mostly just explaining certain things.
- 17:59Um you can just stay in this uh 4800 uh
- 18:03preview and then we have all the step
- 18:05over there. So to go through all the
- 18:07step uh we can first help you get
- 18:09familiar with this uh workbench. So uh
- 18:13at the so step one a mission is just
- 18:16making sure you know explaining things
- 18:18we will learn you will learn how do we
- 18:20uh queue in the system and how do we um
- 18:23what we will learn and then if you click
- 18:26those button if you click this button it
- 18:27will show left hand side and then for
- 18:29the workplace um we we will work in ADK
- 18:33web UI
- 18:35so every every stage we will show you
- 18:38the source code and we will highlight
- 18:40the important on because you know
- 18:42nowadays almost everyone we are coding
- 18:44is AI but we still it's still important
- 18:47to know the fundamental know the concept
- 18:50know what's know the important uh line
- 18:53in the code because you still need to
- 18:55review a lot of uh code do a lot of code
- 18:57review right so um we do not need you to
- 19:00do any copy and paste we just uh the
- 19:03whole purpose for this app is just to
- 19:05show you the theory show you the concept
- 19:07show the fundamental and you'll also
- 19:08know the corresponding key uh code so
- 19:11that you will connect the dot with the
- 19:13theory and the corresponding code
- 19:17and we also do for each step we will do
- 19:20things in ADK web UI. So with ADK web UI
- 19:22we have in the top right so if you click
- 19:25top right button ADK web UI you will
- 19:27able to see the ADK web UI going to
- 19:30start in this uh side panel and you can
- 19:32directly interact with it we're going to
- 19:34show you soon. So if you go to step uh
- 19:37step two like on the top left we have V
- 19:40and this is basically the very first
- 19:41step to help you get familiar with uh
- 19:44the system. So [snorts] this is uh to
- 19:47first give a try with the agent and then
- 19:50and then you can test it with ADK web UI
- 19:53and at each stage you will have you will
- 19:55see this notification uh just making
- 19:58sure it helps you to uh check
- 20:00everything's ready for this section so
- 20:02that you can testing things
- 20:03understanding things. So just making
- 20:05sure go to the every session you can run
- 20:07you can click this button this button is
- 20:09at yeah load the step so that you will
- 20:11basically it will configure all the step
- 20:13for you for this this lab. So once you
- 20:15click this button you will see all the
- 20:17step over there and you will have the uh
- 20:20ADK web UI directly open up here and you
- 20:22can talk to ADK web UI you can open ADK
- 20:24web UI in the new page and you can see
- 20:26all the instruction over here. Yeah. So
- 20:29this whole thing is it's it's containing
- 20:32you know the corresponding key code uh
- 20:34and also the theory explanation and also
- 20:37the app is on always on the left hand
- 20:39side and ADK web UI is always in the
- 20:41side panel. So this is how we are
- 20:43designing this uh this whole experience.
- 20:46So while um like you're exploring this
- 20:48app I'm going to switch back to my slide
- 20:50just to explain more about the theory so
- 20:53that later on we can uh you know switch
- 20:55back to this workbench to play around
- 20:57it. in a pause. Yeah, I hope you like
- 21:00it.
- 21:04Yeah, thank you for the feedback. Yeah,
- 21:06we really want to uh help, you know,
- 21:08trying to simplify trying to simplify
- 21:11things at the same time, you know,
- 21:12putting as much concept as possible in
- 21:15one lab. That's the that's that's the
- 21:18hope. Hope that um reached the goal. Yo,
- 21:20okay. So, James, you like dark mode.
- 21:22Okay, I like light mode for my app. I
- 21:26don't know.
- 21:28made with our organ. Oh yeah, it's made
- 21:32with uh anti-gravity.
- 21:36Let me stop the screen and start to
- 21:39share the slide.
- 21:44Okay. So we explaining the uh the this
- 21:48is a lab layout. So I'm going to you
- 21:50will have that app with you. So you can
- 21:52play the music, you can just play around
- 21:53with with the app and you will you can
- 21:56do the reading yourself. You can do this
- 21:57at your own pace but at the same time I
- 21:59can explain you know uh what are what is
- 22:02the longunning agent we're trying to
- 22:04create for today. So to create a
- 22:07longunning agent for you know to help
- 22:10you purchase a ticket but to get start
- 22:12let's first talk about what is uh the
- 22:15simple agent you can create to purchase
- 22:17a ticket. Um again we are using Google's
- 22:20agent development kit ADK to build the
- 22:22agent. And then as you can see that uh a
- 22:25quick recap for the agent. I know
- 22:26everyone most of you are coming from
- 22:28agent 101 but for those of you who
- 22:30haven't been to the live stream before a
- 22:32quick concept for the agent is vention
- 22:34have the model at the brain has an
- 22:35instruction so that the model will
- 22:37follow the instruction and then we have
- 22:39the tools to connect into external uh
- 22:41world and connecting some API to do
- 22:43things for you and then for this agent
- 22:46to create a simple agent we can have
- 22:48like uh one agent with a model as a
- 22:51brain and then one tool is to ask the
- 22:55seller which concerts exist to search
- 22:58the events. Another like get scene map
- 23:00is to ask okay which section has it and
- 23:03what they cost and then we have the
- 23:05purchase is later we can use the tool to
- 23:07purchase a ticket to make the actual
- 23:09request and then um the model going to
- 23:14like do the reasoning based on the
- 23:15request and then going to picking the
- 23:17corresponding tool to do things for you.
- 23:19So the first thing is I want to try to
- 23:23uh tell this a so because right now I
- 23:26want to do the purchase right um I'm
- 23:29actually in the middle of the line for
- 23:31example if I have a thousand people or
- 23:33like 10,000 people or 100 thousand
- 23:35people like what if like we have like a
- 23:37lot of people for for example Tyler
- 23:39Vifter's uh concert and then I'm like
- 23:41really in the in the line but so uh I I
- 23:44just I want to keep tracking you know uh
- 23:46so while I'm checking the the the queue
- 23:49status stat u maybe I'm not at the
- 23:51frontter uh status right so I need to
- 23:54like come back and check okay what is
- 23:56the status right now can I do the
- 23:57purchase right now so we want to tell
- 23:59the monster uh the sticky monster to say
- 24:02oh suppose suppose we're still in the
- 24:04queue or suppose the sale hasn't opened
- 24:06yet in all the scenario we want to tell
- 24:09the ticking monster to say okay can you
- 24:11check again in 10 seconds and then the
- 24:13agent it might reply to say sure I will
- 24:15keep watching and then uh so for example
- 24:18in this current version if you leave the
- 24:20service running I look for another check
- 24:22even though it is telling you okay I
- 24:24will keep watching but it's not set up
- 24:26the timer and the second check will not
- 24:30start automatically even though the
- 24:32reply it reply sounds helpful but it
- 24:35didn't actually arrange a future work
- 24:38even though we are telling like very
- 24:40detailed instruction you can in the
- 24:41instruction of the to the agent you can
- 24:44just tell like you can be very specific
- 24:46about you know like run every 10 in 10
- 24:49seconds or check in 5 seconds or or
- 24:51anything but um it doesn't work that
- 24:55way. So that that so that bring us uh
- 24:58this point that we really need a
- 25:00trigger. So we need a trigger that event
- 25:02can start the agent uh next piece of
- 25:05work. So we need some something to
- 25:07trigger that I mean and then we need to
- 25:09like actually do the check on okay what
- 25:11is the current status what is the sales
- 25:13uh status and what are status in the
- 25:15queue. So um with a single agent if
- 25:19you're telling the in the instruction to
- 25:22uh telling the agent to check in the 10
- 25:23seconds in it's not even though it's
- 25:26giving the answer it's not working. So
- 25:27here is how we want to set things up. So
- 25:30we want to have uh two part one is a
- 25:33trigger one is a trigger. [laughter]
- 25:36So uh the trigger part is we want to it
- 25:40could be in this scenario if you um
- 25:43follow this uh this arrow. So after 10
- 25:45seconds you want to have a clock. So
- 25:48it's a timer right it's a 10 seconds
- 25:50timer and then it send a request to our
- 25:52application and then it will arrive at
- 25:54the some like v in this specific
- 25:56application we have this endpoint uh
- 25:58called vake endpoint. So it will arrive
- 26:01at this end uh end vake endpoint. So
- 26:06this endpoint how it works behind the
- 26:08scene is it will call the runner and
- 26:11then it will start executing things. So
- 26:15uh for those of you who are I'm not sure
- 26:17how many of you are first time building
- 26:19with ADK
- 26:21um if you're first time building with
- 26:22ADK ADK is agent development kit it's a
- 26:26free open-source framework that you can
- 26:28build in agent so for ADK we have some
- 26:32component that called runner uh runner
- 26:35is basically the event executor it's
- 26:38powering up it's like a engine for your
- 26:40agent it's powering up the whole system
- 26:42for example when you have the user have
- 26:44the uh request and then it's like do the
- 26:47reasoning it's picking the different
- 26:48tools all through the request and then
- 26:50we have the runner that's the event
- 26:51executor to power up the whole thing so
- 26:53that we have this event loop and then
- 26:55you can uh the agent can start doing uh
- 26:58executing things. So uh in this scenario
- 27:02we are we have this clock uh it's
- 27:04trigger this uh trigger this uh to to to
- 27:09uh send the request and then you will uh
- 27:11call this V endpoint and then the the
- 27:15endpoint calls the runner and the runner
- 27:16is like going to executing things. So it
- 27:20will so for example if it fire the clock
- 27:22once you say okay check uh check things
- 27:24in the 10 seconds and follow that
- 27:26request uh and then it will check okay
- 27:28uh did the clock send the things did the
- 27:30things arrive uh did the v uh receive
- 27:33the request and then it will did the
- 27:35runner start and things and then it will
- 27:36start to uh and it will start to follow
- 27:39this order to see whether we have uh
- 27:42successfully
- 27:43uh activate this trigger. So uh we will
- 27:47soon in our web app to see how we can
- 27:50try things with uh single agent this
- 27:53doesn't work and then later on we're
- 27:55going to see how do we create this uh v
- 27:57endpoint to see how it actually modify
- 28:00things and then we will see how do we
- 28:02send this 10-minut uh trigger so that it
- 28:05will trigger this uh v thing and then so
- 28:08you know in a real life example when you
- 28:11actually want to check the things you
- 28:12probably you you might want to do the
- 28:13crown job you might want to
- 28:15uh do the checking things regularly but
- 28:18to get start you first you want to
- 28:19making sure this one trigger work. So
- 28:22once the one trigger work u you can set
- 28:24the schedule job or you can check
- 28:26regularly to making sure things work. So
- 28:28this is the to uh this is to set the
- 28:30stage for later on we can check things
- 28:32uh regularly. So let's uh switch back to
- 28:35the web app to to test uh the server and
- 28:40clock this trigger and to get to connect
- 28:42the data about how ADK runner can
- 28:44executing things and how we can um how
- 28:47the how the trigger work and okay so I'm
- 28:50going to switch back to my screen stop
- 28:53sharing
- 28:56and uh
- 28:59oh you don't see the trigger in the
- 29:01slide uh you will see this in the in the
- 29:03web app.
- 29:06Let me share the screen.
- 29:09Hope this is the right one.
- 29:14[snorts] Oh, it's nice to see you.
- 29:19Yeah, it's like watching things. But uh
- 29:22yeah, so right now I am at uh section
- 29:26two uh at the vake part. So the first
- 29:29part to a prompt is the example that you
- 29:31can keep telling the agent to say oh can
- 29:34you check things so you will ask example
- 29:36and then you will you will see things
- 29:38work and then you can give a try or can
- 29:40you try things uh in
- 29:44let's first just uh get familiar with
- 29:46our very first agent and then later on
- 29:48we will learn um how do we have this
- 29:50trigger so to at the 2A prompt if you go
- 29:54to ADK web UI if you click you can easil
- 29:58click this button or on the top right
- 30:00you can activate this. So we have all
- 30:02the step on the on the panel and uh ADK
- 30:06web UI for those of you who start ADK at
- 30:08the first time uh you know ADK is to a
- 30:11framework to building the agent AD web
- 30:12UI is a way you can directly
- 30:14troubleshooting and talking to your
- 30:16agent so you can verifying testing
- 30:18troubleshooting and then um you can see
- 30:20the tracing and everything so it's a
- 30:22development tool for you to easily um
- 30:24interacting with your the agent you
- 30:26created and over here we putting the ATM
- 30:28UI in this uh interactive app uh in your
- 30:32own development you can start adv is uh
- 30:35by typing ADK web in your command line.
- 30:38So over here if I go to this command
- 30:40line I can start a new session. So on
- 30:42the top right I will start a new
- 30:44session. I will tell this agent to see
- 30:46um uh which which one have the seats for
- 30:50me and send and then you need to keep
- 30:52checking to tell me if things work.
- 30:56So what it does okay will do some recall
- 30:58on the uh on the current uh context. So
- 31:02you will check the current context and
- 31:04then you will see okay those are things
- 31:06it's finding and it will search the
- 31:08event getting the seat map and then
- 31:10basically it is using the uh those tools
- 31:13we just created and then to get more
- 31:16information to the user. However, um
- 31:19when it's trying to when you are trying
- 31:21to ask this agent to keep checking and
- 31:24tell me if anything change, you pretty
- 31:26much want the agent to continuously uh
- 31:28monitor and checking things. But if you
- 31:30don't have things configured, uh you
- 31:32simply just tell the agent to do that.
- 31:34Um if you just have a really good
- 31:36instruction to say continuous checking,
- 31:38uh it may not work. So we will we will
- 31:41explain how to set up the trigger for
- 31:43things connecting with runner. So the
- 31:46whole uh 2A prompt is just to get you
- 31:48familiar with this first uh agent we're
- 31:50creating and uh over here we have we
- 31:54basically highlighted the important
- 31:56instruction for the agent and this is
- 31:58the root agent we have over here we have
- 32:01the instruction we have the tools with
- 32:02search agent get seat map and recall and
- 32:06then uh those are the step you just saw
- 32:08in the ADK web UI.
- 32:10So uh let's go to the second part with
- 32:14the uh something has to listen. So how
- 32:17do you set up uh trigger? This is like
- 32:20uh 2 a 2 b and 2 c. So so first you need
- 32:24to uh we need to take a look at how to
- 32:27have something to actually uh checking
- 32:30the whole status and then so basically
- 32:33as you take as you can take a look we
- 32:34have this uh we have this receiver and
- 32:37the caller. So over here you could pos
- 32:40you could trigger by set a timer or you
- 32:43could trigger by have a corn job or have
- 32:45a click on the website and over here is
- 32:47that you can have pops or or um some API
- 32:50call anything to tri to trigger things.
- 32:54So on the left hand side it's like uh
- 32:56the trigger and on the right hand side
- 32:57is what we call trigger because uh it is
- 33:00the way to start this trigger
- 33:04and and also just like what I mentioned
- 33:06before with uh ADK runner. So ADK runner
- 33:10is like a power app this whole thing
- 33:12that's why it's like has a charger
- 33:13connecting to the whole thing. So
- 33:15whenever the user uh is sending this
- 33:17request to say booting me a ticket and
- 33:20then uh runner it will power up the
- 33:22whole thing by start the new session ID
- 33:24and then it will connect this user
- 33:26information connect the session
- 33:28information and then connect this whole
- 33:30it will start to have the session
- 33:32service to store all the conversation
- 33:35and then you will like it you will
- 33:37basically uh like connecting to the
- 33:40session service and memory service and
- 33:41also uh to this corresponding user and
- 33:44with this corresponding session and then
- 33:46you will start to uh like power up the
- 33:49whole thing. So we will making sure have
- 33:51the new session ID and then you have the
- 33:52store session session later on we will
- 33:54talk about um what is session service
- 33:56and how do we manage all the contacts in
- 33:59this long running process.
- 34:01So making so you will attach the
- 34:02sessions and then it will start a work.
- 34:05So over here you can see we have the
- 34:06space we could have like multi- agent
- 34:08base agent sub agent or only have one
- 34:10agent and then you could have multiple
- 34:12tools. So you could like once you have
- 34:14the connect the session connect the sess
- 34:16uh connect the create a session ID
- 34:18connect the session and then start a
- 34:20work and then you will can call the to a
- 34:22to b and then do the loop. So uh behind
- 34:25the thing we have this runner to uh
- 34:27power up the whole thing. So we have
- 34:29this uh flow over here to uh to explain
- 34:32things. So when whenever we're using ADK
- 34:34web you know ADK web is a development
- 34:36tool. Uh so ADK web already have a
- 34:38built-in runner to power up the things
- 34:41but if you're creating your own server
- 34:43your own application you cannot rely on
- 34:45ADK web right because ADK web is a
- 34:47development tool uh it's not the actual
- 34:50you cannot directly using it so you need
- 34:52to uh often time configure your own
- 34:54runner and in your own runner you need
- 34:56to associate a session and everything to
- 34:58it and over here in the server part
- 35:02basically we are uh this is like a
- 35:04trigger we're talking about over here
- 35:06and uh this is the vake uh endpoint we
- 35:09were talking about earlier and here we
- 35:12have all the implementation
- 35:18[clears throat]
- 35:18and uh let's give a try. So if you want
- 35:21to start a questions through your own
- 35:23server. So once I click this start
- 35:25monster ticket and then you will start
- 35:28this application on left hand side and I
- 35:30can just copy this question to say uh
- 35:32check whether this show still has seat
- 35:34and tell me what you find.
- 35:36Uh this is like a testing for okay uh
- 35:40for this one check I want to check
- 35:42whether it still have the seat and later
- 35:44on what I want to do is I want to like
- 35:45schedule this check. uh I want to set a
- 35:48clock to schedule this check so that I
- 35:50can trigger this check so that every
- 35:52time it will check this whole thing and
- 35:53after that I want to do a schedule this
- 35:56check so I can check every single like
- 35:58every 10 minutes like I set a time
- 35:59interval to to check that so this is uh
- 36:02to start with okay how do I first have
- 36:04this check and then this is example of
- 36:07you know I'm just checking it and on
- 36:09this left hand side this is like a ticky
- 36:11monster app if I go to the console I
- 36:13will see how does it uh it will call the
- 36:16sigma app and then you will tell me the
- 36:18answer and then you will answer me.
- 36:21So this is like example of I'm using
- 36:25this um I wake up this server um because
- 36:29use I wake up the server and then I will
- 36:31um trigger this and and also if you want
- 36:34to uh
- 36:36if you want to uh learn more about it
- 36:37making sure you uh like if you review
- 36:40the code you will see how uh how we are
- 36:42doing the handler and connecting those
- 36:44with a runner to power up the things.
- 36:48So once we know how to check the seats
- 36:52and what's next is you want to
- 36:54potentially set a timer so that you can
- 36:56trigger this check. So once you know how
- 36:58to trigger this check later on you can
- 37:00like continually continuously watching
- 37:02this process. [clears throat]
- 37:06I'm [snorts] going to drink some water.
- 37:11Yeah. So if you go to uh step 2C,
- 37:14this is a clock that send the next
- 37:16request. This is a step that you want
- 37:18schedule [clears throat] your your
- 37:19ticket check. So before we just testing
- 37:22the server, okay, we're testing this
- 37:23check is working correctly. And the next
- 37:26thing is we want to like file once like
- 37:2810 seconds from now on. So I just click
- 37:30this five once 10 seconds from now on.
- 37:32And then um I was going to wait
- 37:36uh in the log. I'm going to wait until
- 37:38like from 10 seconds from now on. Um you
- 37:41can see that it start to trigger this in
- 37:44the log.
- 37:48And then this step is you can compare or
- 37:51this reply how how does a reply uh work
- 37:54compared to the previously uh the reply
- 37:57work. But the whole thing is this clock
- 38:00is a trigger and this direct trigger is
- 38:02to uh we want to trigger this uh we want
- 38:05to trigger this in 10 seconds but later
- 38:07on you can do this uh check in a
- 38:09different way. uh to have this to be and
- 38:11to see we basically connect the dot on
- 38:14you know how do you do this um how do
- 38:16you trigger this check and then how do
- 38:19you set a timer or uh have some action
- 38:22to trigger this check um so this whole
- 38:26process is we first learn you know if
- 38:28you simply putting this in the prompt
- 38:31putting this in the instruction uh it's
- 38:33not working you need to making sure
- 38:35understanding how the ADK runner work
- 38:38and having your server side uh logic and
- 38:41then in this case we have our endpoint
- 38:44to check the situation and then we
- 38:47configure this timer to check uh to to
- 38:51send this message to the vic endpoint so
- 38:53that it will run the agent to do the
- 38:55check for us.
- 38:57So this is the first part that we need
- 39:00to know about how to build this uh agent
- 39:03to book the ticket for us. And the
- 39:05second part we need to learn is how do
- 39:08we uh how do we manage the state because
- 39:11essentially our goal is we want to build
- 39:13a longunning agent that it will uh
- 39:16continuously check for us and even our
- 39:18service shutdown and then when we
- 39:21restart it will continue pick up from
- 39:23what we were before and then you will be
- 39:25able to uh always resume from where you
- 39:28were before. So the next step is you
- 39:30need to learn how do we have the
- 39:32persistent state management so that uh
- 39:35we are able to resume from where we were
- 39:38before and for this part we will learn
- 39:42uh different I think we have a diagram
- 39:44one here no uh maybe it's not over here
- 39:47let me see it's in this diagram one
- 39:51uh see
- 39:54yeah okay I guess I don't have this
- 39:56diagram here maybe it's in one of my
- 39:59previous version. Yeah. So in this part
- 40:02we will learn how do we uh we will learn
- 40:04different type of uh how do we manage
- 40:06the context for uh with ADK. We will
- 40:09learn how do we manage the session
- 40:11service how do we manage the memory
- 40:12service and also the artifact service
- 40:15and in this lab we will um using the
- 40:18persistent memory with cloud SQL and uh
- 40:21we will build our own memory service and
- 40:23we also will have the artifact ser uh we
- 40:26will have the artifact store to store
- 40:28some artifact for our system. So
- 40:30basically it's like uh um so we will
- 40:32explore the estate management for our
- 40:36long runninging process and the point to
- 40:38learn this is so that we can resume from
- 40:40where we were before and then we can so
- 40:43to connect the dot is first you know how
- 40:45to set a trigger and then you know how
- 40:47to have the persistent store and then
- 40:49you know how do we uh resume from a long
- 40:52running process and and then so that you
- 40:54can continuously you can build an agent
- 40:55that contin continuously check uh
- 40:58whether which what are the status is in
- 41:00your in the queue and what is the
- 41:01situation and then even you shut down
- 41:04the machine you can always book the
- 41:05ticket um it will always watch the
- 41:08situation and book the ticket for you so
- 41:10I'm going to start explaining the
- 41:12context part but let me quickly check
- 41:14the chat to see if you have any question
- 41:17oh thanks um pun to answer the question
- 41:21for me
- 41:26oh runner is not like a harness so
- 41:28harness is basically basically
- 41:30everything around the agent. So the
- 41:32concept is more uh it's it's wider. It's
- 41:35basically containing everything about
- 41:37context memory and context. Uh it's it's
- 41:40containing uh how do we do the Q2
- 41:42execution, how do we do the workflow,
- 41:44it's containing how do we do the
- 41:45privacy, how do we do the sandbox uh
- 41:48maintenance and how do we like basically
- 41:50everything around the model could be a
- 41:52harness layer. But runner in ADK concept
- 41:56it's just like event executor. is
- 41:58powering up the whole thing to uh to
- 42:00power up this event loop. So that's uh
- 42:03two different concept. But that's a
- 42:05really good question. [clears throat]
- 42:08Hi,
- 42:10I like your uh profile picture.
- 42:13[laughter]
- 42:14Uh what is in memory here? Yeah, we
- 42:16[snorts] will explore in memory here uh
- 42:18really soon.
- 42:21>> [snorts]
- 42:21>> Okay. So to talk about the context if
- 42:24you were here at agent 101 u you
- 42:26probably we we mentioned this earlier
- 42:28about you know how do we manage the
- 42:31memory for agentic system. We talk about
- 42:33session we talk about service session
- 42:35service memory service and more. So
- 42:37basically when I have a conversation
- 42:38with agent uh every conversation the
- 42:41whole run is one session and inside the
- 42:44one session we will have uh we will have
- 42:47some important important stuff for
- 42:50example I have like breakfast coffee and
- 42:52I will put down in the note and then
- 42:54that is a state will share among
- 42:56different component in the system. So
- 42:58state is like a uh it's like a key value
- 43:01pair important scratch node from the
- 43:03whole conversation uh in one session and
- 43:05then we also talk about the cross
- 43:07session basically if we have all the
- 43:09sessions together that's a session
- 43:11service that store all the conversation
- 43:13here um so over here today in this lab
- 43:16we're using the we're [clears throat]
- 43:18using
- 43:20if if you deploy everything we will
- 43:21using the cloud to store everything
- 43:24about our transcript and then uh So we
- 43:28have like we have a storage to store all
- 43:30our conversation all the transcript. So
- 43:32that's session service the session
- 43:34manager and then we also have memory
- 43:36manager. Memory manager is basically to
- 43:39distill the fact from one uh
- 43:41conversation and we store in a memory
- 43:43thing. So because you do not want agent
- 43:46to always recall the whole conversation
- 43:48you have earlier to understand what's
- 43:50going on. So you want to like store some
- 43:52important uh thing in memory. So here we
- 43:55have the memory service so that it can
- 43:57store the distill fact and then whenever
- 44:00you do the recall you will recall from
- 44:02the memory service so that it has a
- 44:04context from the previous conversation.
- 44:06So that's more like a high level picture
- 44:08for this lab and the very important part
- 44:11for the persistent data for for this one
- 44:14is when we do the session service we
- 44:16need to store them in the um in the
- 44:19[clears throat] actual
- 44:20uh we we need to store them in the
- 44:22database. we cannot store them in the
- 44:24inmemory because if we store the
- 44:26everything in the inmemory when we uh
- 44:28restart the reboot the machine we will
- 44:30lose everything. So the whole point is
- 44:33when we are doing the session service uh
- 44:35over here at this point we have this
- 44:38SQLite to configure to store all the all
- 44:41the conversation and we have the
- 44:43artifact URI to configure the to store
- 44:46the files. For example, if you in your
- 44:49in your talking history, you have some
- 44:50image data, you can store them in the
- 44:53artifact service uh URI. So the whole
- 44:56point for uh this
- 44:59the first part the session DB is it's
- 45:01important to know that you need to store
- 45:04things in the persistent database so
- 45:06that um we can have this uh surviving we
- 45:09can have the long running of longunning
- 45:12workflow survive uh in the restart. So
- 45:15I'm going to switch back to my uh slide
- 45:18to talk more about the the session the
- 45:23doable store and the session and state
- 45:25and then we're going to continue around
- 45:26the lab over here.
- 45:29Let me share the screen. [snorts]
- 45:41Okay. So this is the screen and um
- 45:45So we have the session service and the
- 45:47database. Uh basically as I mentioned
- 45:50before session service manage the
- 45:51session save the records and uh we have
- 45:54in this slide we have SQLite to store
- 45:56some of the records but then when the
- 45:57deploy in the deploy stage uh we will
- 45:59want to deploy them to cloud SQL. So the
- 46:02session service provides a operation and
- 46:05the SQLite is is a storage underneath
- 46:08and then um so you you probably notice
- 46:12we have the event here and we have the
- 46:14state here and what does that mean and
- 46:16what does the event really representing
- 46:18for so in this case um it's important to
- 46:22know that when we talk about our context
- 46:24we have the event that record what
- 46:26actually happened so for example if you
- 46:28ask for uh Amsterdam and then the tour
- 46:31return some shows and then the agent
- 46:33will select for example select Sunday.
- 46:36So we follow that sequence and we
- 46:37understand the whole decision. So that
- 46:39is the uh that the event will record
- 46:43that how that happened and the state is
- 46:46like holding the value for important
- 46:48value in this conversation. For example
- 46:50the party size is two. For example, the
- 46:52target event ID is certain things so
- 46:55that you will refer to this sticky notes
- 46:59and putting things together like memory
- 47:01service giving the agent to retrieve the
- 47:03fact across the session from the early
- 47:05conversation. And then in this lab we
- 47:07have the markdown memory service that
- 47:10you you imple you implement yourself.
- 47:12And in my previous lab we talk about
- 47:14Google has a manager service that is
- 47:16Google cloud uh memory bank that is a
- 47:18managed memory service. But this lab is
- 47:20like a implementation that you can do it
- 47:22yourself. [clears throat]
- 47:24But either way whatever memory service
- 47:26you're using we we usually have a recall
- 47:28and uh remember. So recall uh remember
- 47:32it's basically behind the scene it's
- 47:34using it's doing the memory read and
- 47:35memory write. So we need a way to always
- 47:38read load the existing memory from the
- 47:41pre-existing memory service and also we
- 47:43need a way to add session to memory.
- 47:45Basically we want to distill the fact
- 47:46from the session and save that to the
- 47:48memory. So over here we just call them
- 47:50recall and remember for the memory read
- 47:52and write but they're just fancy word
- 47:53for the read and write. Essentially we
- 47:55just want to do uh memory uh just we
- 47:58want to have this dial file from the
- 48:00session to do that. And you probably
- 48:02also notice that over here we have this
- 48:04user user pref. So user pref will stick
- 48:06to the user and it will also exist
- 48:09across different session
- 48:12and let me share the
- 48:16yeah so basically if you're putting
- 48:17things together we have session service
- 48:19save all the conversation and the task
- 48:21progress in our SQLite database and then
- 48:23we have this memory service to retrieve
- 48:25the selected facts and then we have
- 48:27artifact service to save and load the uh
- 48:29agent load the files that agent creates
- 48:31and use
- 48:36And those are important uh fact uh for
- 48:40the session state for our uh for our
- 48:43lab. So we have some so if you can see
- 48:45we have a temp value. So temp value it
- 48:48just a squash data for current you know
- 48:51you inovocation. It doesn't save as a
- 48:52persistent it's only a temporary thing.
- 48:55And then if you have the user as prefix
- 48:57it will share a cross session for the
- 48:59same app and user. if you have this user
- 49:01prefix. Um, and also we have this memory
- 49:05file as a separate storage for the
- 49:07selected effects and we also have a
- 49:08artifact to for the storage. And another
- 49:12cool thing to know is a compaction.
- 49:15I'm not sure if you notice that when you
- 49:17talk to your coding agent and then when
- 49:19you have a really long conversation, it
- 49:20will automatically do the compact
- 49:22itself. You will basically trying to
- 49:24compact what you have before so that you
- 49:26will have uh do the summary and compact
- 49:28the previous history so that you can
- 49:30continue to talk to to them in the same
- 49:32conversation thread. So ADK also have
- 49:34that feature. Uh we will you will see
- 49:37how ADK is doing the compact by turn on
- 49:40the compact um settings. So basically
- 49:42you will do how how often you're going
- 49:44to compact and then you how what is the
- 49:46overlap so that you can have a
- 49:48continuous uh summary for for all the
- 49:52conversation you have and we also have
- 49:54that in the in the lab for today and uh
- 49:57let me share my screen for the app.
- 50:02[snorts]
- 50:04Here's the app. I think it's over here.
- 50:11Okay. So now I am back to this uh 3B uh
- 50:153A. It's a session one. So in the
- 50:17session one, what I want to do with the
- 50:18lab is I just uh loading the uh just
- 50:21loading this. So I loading this existing
- 50:24uh step three
- 50:30and then I'm opening this ADK web UI. So
- 50:33once I open this ADK web UI, I can
- 50:35follow this uh instruction on the left
- 50:37hand side. So I can start a new session.
- 50:39Uh so and then I will copy this
- 50:45conversation paste it to the chat to say
- 50:48give uh Sam and me two tickets for the
- 50:51show. So it will recall our uh previous
- 50:55uh memory. So in the session state those
- 50:57are existing state uh we have. So we can
- 51:00see oh because uh Sam cannot do weekend
- 51:03so a week night. So we cannot we won't
- 51:05book one for uh for Sam for week night.
- 51:12and it will search the things and then
- 51:13trying to get the map over there.
- 51:19And then if you um think do I
- 51:24so at the session DB part we also
- 51:27covered a little bit about how do you
- 51:29configure the um the D SQLite DB and
- 51:33also artifact DB so that you will have
- 51:34the persistent data stored over here. So
- 51:37if you configure the session service URL
- 51:39you're pointing them to the SQLite you
- 51:42have um you store everything and if you
- 51:44pointing here in this lab you store this
- 51:46JSON but of course you can store any
- 51:48files you want and if you want to deploy
- 51:50things Google has a Google Google cloud
- 51:53uh storage for artifact uh storage on
- 51:57cloud as well. So this is the persistent
- 52:00part and for the memory part uh we have
- 52:03this important uh this is like a user
- 52:06level memory and then you can just uh
- 52:08take a look to see how the agent is
- 52:10doing the memory recall. So when they do
- 52:12the memory uh remember is to do the
- 52:15memory read and recall is to do the
- 52:17memory uh
- 52:19recall sorry remember is to memory write
- 52:20and recall is memory read. So if I go to
- 52:26so previous one when I ask this question
- 52:28it's doing the recall recall is loading
- 52:30the existing memory so that it can book
- 52:32the ticket for me and then if I if I
- 52:35telling this agent to say remember this
- 52:36for the next time we always want this uh
- 52:39type of seat so it will do the memory
- 52:41read and then when I start a new session
- 52:45and then I want to like book the ticket
- 52:46again it's supposed to do the because I
- 52:50read this I write this to the memory and
- 52:51is supposed to recall this and if you
- 52:54check the state
- 52:57this is the previous information. So now
- 53:01um it's able to give you the uh booking
- 53:05more according to your situation. Yeah.
- 53:08So this is just a a quick [laughter]
- 53:10quick exercise for the memory one. You
- 53:12probably see we have this different type
- 53:14of memory service and this one we
- 53:16creating our own memory service and for
- 53:18the in-memory one is like uh usually
- 53:21losing when you stop the process. The
- 53:24memory bank one is the one we covered
- 53:25earlier that you can have your um own uh
- 53:29own memory bank on Google cloud. We also
- 53:31have rag memory if you want to have
- 53:33configure vortex AI rag memory for it.
- 53:36But in this lab we have this own custom
- 53:38memory that you can take a look how we
- 53:40are doing that. Yeah. So that's it for
- 53:42the uh the memory part. So next one is
- 53:46we want to talk about how do we um
- 53:50resume how do we have this long
- 53:51runninging process so that we can uh so
- 53:54we can like pause this we can kill them
- 53:56overnight and we can continue because we
- 53:58have this persistent database so that
- 54:00even like we kill the process in the
- 54:02middle of it uh we can still resume from
- 54:05where we were before. So this is the
- 54:07whole point of the things we want to
- 54:09demo. So do a quick recap of the whole
- 54:11thing the whole high level picture. So
- 54:14over there we are using this workflow to
- 54:17to configure this whole flow. So a quick
- 54:21recap for workflow again and as so this
- 54:24one is agent 102. So we assume that you
- 54:27probably have some foundation for agent.
- 54:30But in case you are first time learning
- 54:32about agent concept or workflow concept,
- 54:35workflow is basically a way for you to
- 54:37have a making sure the system run in a
- 54:40reliable and control way by drawing a
- 54:42graph and then [snorts] you executing
- 54:44things based on the order you draw the
- 54:45graph and over here we are drawing this
- 54:48oneline graph. And this graph is we have
- 54:52we this is like the process. We're
- 54:54trying to buy the ticket. We we open the
- 54:57night. We're picking the show we want.
- 54:58We're doing we're queuing up and we're
- 55:00checking in the front to see okay what
- 55:02is the situation whether I'm at the
- 55:05front or not. And then I'm ready I'm
- 55:07going to purchase the ticket. So this is
- 55:09the uh the workflow for me to purchase
- 55:13the ticket. And then for this whole
- 55:16workflow I'm going to loading this uh
- 55:18some of the process is waiting for the
- 55:21human input and some of the process and
- 55:23my agent is pausing there to check in
- 55:25the situation. So the whole point is uh
- 55:28no matter it's waiting for human input
- 55:30or uh like uh or my agent is pausing
- 55:34there to check okay whether how many
- 55:36when when am I in the in the queue it's
- 55:38able to stay in the workflow and then
- 55:40even I kill the process and then restart
- 55:42it will resume from where it were before
- 55:44and it will continue uh having this long
- 55:46running process.
- 55:50So to check that I will start having
- 55:54this uh new session
- 55:57and
- 55:59having this new session
- 56:01and I'll say um give me two ticket for
- 56:04this show.
- 56:07So over here you can see this is the
- 56:09workflow we're we're talking about. So
- 56:11we have this c we have uh so the p show
- 56:15is able to recall the thing search the
- 56:17event um get the get the map and then
- 56:19it's able to um queue up check the front
- 56:22ready to buy and then and then go to the
- 56:23end.
- 56:30So over here you can say it's paused to
- 56:32say uh you we have this long running
- 56:35process over here to say okay now I am
- 56:37at the queue uh well it's like very late
- 56:40in the queue so it will wake me up again
- 56:42I will check. So what we do over here is
- 56:44you can see we are check we are waiting
- 56:46in the queue and then we are in this
- 56:48line and this line is it's uh it's
- 56:50working but our agent going to just uh
- 56:53pause here and wait to see okay um what
- 56:56is my state if it's it seems I'm pretty
- 56:58far away going to just still be there
- 57:00and wait so remember earlier we talk
- 57:02about we need to wake it up and check
- 57:04the situation so here it's like we're
- 57:06waiting there and then then we want to
- 57:08see okay if I kill this process in the
- 57:11middle of it um can I still remember the
- 57:14queue situation and also remember all
- 57:17the user context. So that's the whole
- 57:21point we want to test. So I'm going to
- 57:23continue over here. So you can see uh
- 57:27you will able to see the uh this is the
- 57:30ADK request state uh request input. This
- 57:33is the variable request users input and
- 57:35over here this is the whole um state
- 57:38management for our uh agent.
- 57:43And next is I want to kill the process.
- 57:45So I just click kill to kill the
- 57:47process. Uh if I open the ADK web app,
- 57:49you can see this ADK already killed. So
- 57:52we're trying to simulate a situation
- 57:53that okay, I have this agent start to
- 57:56waiting for help me purchase a ticket.
- 57:58And you can see the queue is still
- 58:00moving. But what if my service crash or
- 58:02what if I reboot the service, I do the
- 58:04redeployment in my actual production
- 58:06environment. Um I just simulate this by
- 58:08okay I killed this ADK web and then I
- 58:11want to uh so and then I'm gonna restart
- 58:13this I'm gonna show this again.
- 58:15So when I show this again it still have
- 58:18all the context I have earlier. You can
- 58:19see it still remember this situation and
- 58:22then um so it has all the context. So
- 58:26this is the this is the uh why it was
- 58:29important to talk about the resumable
- 58:30state and contest management for agent.
- 58:33>> [clears throat]
- 58:33>> And then once I have this um I will skip
- 58:36the weight. So if I skip the weight just
- 58:38this is just for stimulate. Okay finally
- 58:41um finally I am um at the front. So I'm
- 58:45waiting for the suation I am at the
- 58:46front. So I will click the resume the
- 58:49current state. So hopefully that um it
- 58:52will reach the front and then you will
- 58:54trying to uh then trying to uh checking
- 58:58things for me. So nothing has been found
- 59:00uh nothing has been bobbed so far.
- 59:03And then when we go to the next step uh
- 59:06next step you know this is the workflow
- 59:08we were talking about
- 59:12I'm going to those are the uh important
- 59:15step for how we are configure the
- 59:17resumable workflow by the the key things
- 59:19is to have that resume over there.
- 59:25Uh so when we when we like so when we at
- 59:29the front and you can see that um at the
- 59:33state management it's already to see uh
- 59:36it's it's remember all the all the
- 59:39context I have it's remember the reason
- 59:42uh and it's remember the things and I
- 59:45think the whole thing the whole uh this
- 59:47whole lab about resum uh this whole lab
- 59:50this whole 4C section what we want to
- 59:52share is basically um when you are
- 59:55pausing for user input in this case uh
- 59:59we have this request input and then you
- 1:00:01will able to resume
- 1:00:05from where you were before and then the
- 1:00:07key thing sorry I'm looking for the
- 1:00:09rerun equal to true part I think the key
- 1:00:11key thing is uh if this rerun uh rerun
- 1:00:15of resume is equal to uh false or true
- 1:00:18so this is like the key uh line for you
- 1:00:20to uh in enable whether this is uh we
- 1:00:24can continue this or not. So the point
- 1:00:26is a resumeumo uh a resume signal ask
- 1:00:29for the test to continue and then if you
- 1:00:31have the rerun on resume to be true it
- 1:00:33will make the pause uh queue to verify
- 1:00:35the things and it will continue. So this
- 1:00:37whole la this whole section is like when
- 1:00:39we pause for use input or when we pause
- 1:00:42for the uh section uh we want to set
- 1:00:45this to true so that uh you will can you
- 1:00:48can resume from where you were before
- 1:00:51and let's take a look at the section and
- 1:00:57we can see the checked
- 1:01:01let me see the request input. Yeah. So
- 1:01:04if you go to the request input and uh
- 1:01:08ready to purchase where is the checked?
- 1:01:11Let me see. Ready to buy? Yeah, we have
- 1:01:14the ready to buy. We have the same
- 1:01:16queue. We have the ready to buy uh equal
- 1:01:18to true and everything is working. So um
- 1:01:23where's my agent? Here is true. Yeah. So
- 1:01:27if you take a look at the uh ticket
- 1:01:29monster over here, it's still uh it's
- 1:01:31mentioning that you haven't bought a
- 1:01:33ticket because you just simply uh we
- 1:01:37haven't purchased things yet because uh
- 1:01:38the purchase the actual purchase is the
- 1:01:40last step but this step is basically uh
- 1:01:43the agent is pausing there and waiting
- 1:01:45for your inputs or it's waiting for next
- 1:01:48step. Um so the whole thing is we're
- 1:01:51demonstrating that we have this
- 1:01:54resumable state. So uh we we have this
- 1:01:56persistent state so that uh we have the
- 1:01:58persistent memory and then when you have
- 1:02:00this long running workflow configured
- 1:02:02with a rerun equal to true and with a
- 1:02:04resumable configuration it's able to
- 1:02:07resume from where you were before and
- 1:02:09you won't break the workflow. It won't
- 1:02:10start a new workflow. we will um resume
- 1:02:13from we were before um by have certain
- 1:02:15configuration no matter it is the no
- 1:02:19matter it is the uh pausing for you know
- 1:02:21like in this situation we have this
- 1:02:23agent waiting for the Q situ Q to be the
- 1:02:25front or you can have the human or you
- 1:02:28can have the node that waiting for the
- 1:02:30human input and then can pause there for
- 1:02:32human input. So whatever situation it
- 1:02:33is, if you configure the resumable
- 1:02:36configuration, it will always be able to
- 1:02:39uh resume this process if you have this
- 1:02:42persistent state configured.
- 1:02:45So the next step is you want to finally
- 1:02:48make the purchase because finally you're
- 1:02:50at the front and then you want to uh
- 1:02:52making sure you want to book this
- 1:02:54ticket. However, um when you book the
- 1:02:57tickets, you're not necessarily know uh
- 1:03:00so let me share this script. Sorry, let
- 1:03:02me share this uh presentation.
- 1:03:07Um stop sharing.
- 1:03:15So just [clears throat] quick recap,
- 1:03:16this is a workflow we're talking about.
- 1:03:18So we have this uh whole workflow
- 1:03:19configured in this uh in this line and
- 1:03:22we have um
- 1:03:28so the seller producing the queue and
- 1:03:30the next trigger arrives uh the trigger
- 1:03:33is what we talk about that you will
- 1:03:35check in the situation
- 1:03:37uh it will check should they search
- 1:03:39again or join or check the exist or
- 1:03:41check if if if uh it's checking whether
- 1:03:44the theater is whether the show is what
- 1:03:47we want and the seat situation whether
- 1:03:49we could find a seat what are situation
- 1:03:50in the queue and then um you will load
- 1:03:54the information choose the show and then
- 1:03:56join the queue and then check the
- 1:03:57situation and choose the suitable choose
- 1:04:00the super show and then join the the
- 1:04:02queue follow the rule
- 1:04:04and this is what we had earlier is when
- 1:04:06we have this uh user input or or uh when
- 1:04:10we have this agent pausing there
- 1:04:13basically
- 1:04:14when we have this request input in the
- 1:04:16so request input is one thing we we fire
- 1:04:19in the uh so basically in ADK if you do
- 1:04:22the request input you will pause there
- 1:04:24um waiting for next step waiting for the
- 1:04:27next input to resume your workflow. So
- 1:04:30when you do the request input you will
- 1:04:31basically pause the workflow.
- 1:04:34And uh in this example
- 1:04:37basically uh when we pause the so this
- 1:04:42is a demonstration of how we are pause
- 1:04:44the task and then when we restart a task
- 1:04:46uh you will have the same session loaded
- 1:04:48from the session.db. So you have all the
- 1:04:50information
- 1:04:53and this one is basically um talking
- 1:04:57about
- 1:04:59this um let me see.
- 1:05:07Yeah. So this one is about when we are
- 1:05:09uh so if you the session we have the
- 1:05:12session uh database save the tracking
- 1:05:15the test per uh test progress and also
- 1:05:17our app have this resumable with the
- 1:05:19resumable configuration so that ADK can
- 1:05:21always have the safety record to
- 1:05:23continue. So we have this uh P show and
- 1:05:26Q up once they finish ADK can reuse this
- 1:05:29uh recorded output from this result it
- 1:05:32doesn't call this node again on this
- 1:05:34resume we can just use this but the
- 1:05:37check front is different because it stop
- 1:05:39at the waiting point. So if you take a
- 1:05:42look at the code uh in our web app it's
- 1:05:45uh we have this rerun and resume setting
- 1:05:47deciding how it's handling handling the
- 1:05:49errors. So we have uh we have the true
- 1:05:52setting uh to run the node again and we
- 1:05:54have the uh false setting to use the
- 1:05:57answer as a node's output. So or so uh
- 1:06:00in the lab over there we have this true
- 1:06:02or false to handle this correspondingly
- 1:06:08and uh those are the different ways. So
- 1:06:11ADK has this long running function tool
- 1:06:13to wrap the tool so that it will pause
- 1:06:15there and we also have this workflow
- 1:06:17plus request input. Those are two
- 1:06:19different way to represent the long long
- 1:06:21wait. So with a long function tool and
- 1:06:23also workflow plus request input,
- 1:06:24they're pretty much all like pause the
- 1:06:27workflow and resume from where they were
- 1:06:29before.
- 1:06:31Yeah. So that is the resumability from
- 1:06:33the agent. And the next thing we want to
- 1:06:35talk about is imagine that you already
- 1:06:37reach the front and you find a two
- 1:06:39ticket. But you know what if one ticket
- 1:06:41is more expensive than expected? So you
- 1:06:45have two ticket. One ticket is you buy
- 1:06:48you have some certain budget and you
- 1:06:50have two different price. How do you
- 1:06:51know which one is the one you actually
- 1:06:53want to buy? So it's very important to
- 1:06:55have this purchase al authority um to
- 1:06:58add the permission for your purchase.
- 1:07:01For example, if you say I have this two
- 1:07:03tickets um almost
- 1:07:06$250 each. So the agent will read that
- 1:07:10and waiting for for your approvement.
- 1:07:14So we will so basically we want to have
- 1:07:17your um we want to have your request
- 1:07:20input. We want to have your input to
- 1:07:22talk about okay what is your budgeting
- 1:07:24what is your expectation and then we
- 1:07:26want to have your input to say okay
- 1:07:28whether this is correct whether we want
- 1:07:31to have your conf confirmation. So this
- 1:07:32is another type of uh resumable in this
- 1:07:36longunning workflow. So we were talking
- 1:07:38about longunning function tool and also
- 1:07:40the workflow with request input. So here
- 1:07:42we have this request input with the um
- 1:07:46to let user input their budgeting and
- 1:07:49also let the user confirm whether it is
- 1:07:52what they want
- 1:07:54and we will we will show that in the in
- 1:07:56the example about um how do we setting
- 1:07:59the budget and how do we change the
- 1:08:01budget how do we confirm the budget for
- 1:08:03our ticket. So think about that if you
- 1:08:05purchase a ticket uh if you want to
- 1:08:07purchase a ticket for your concert,
- 1:08:08right? Um
- 1:08:12um if you want to purchase a ticket for
- 1:08:13concert, you do not want things to over
- 1:08:15certain budget, right? So this is the
- 1:08:17one way for you to add a permission for
- 1:08:18the agent uh doing things for you. And
- 1:08:21let me share the
- 1:08:25let me share the
- 1:08:30it's over here. Okay,
- 1:08:34let me here's the plan.
- 1:08:39Yeah, so uh currently I'm at 5A. So this
- 1:08:42is like a way for human to add the
- 1:08:43permission.
- 1:08:46I'm going to load step five so that it
- 1:08:48will reset everything for me.
- 1:08:52And this is like uh the budget agreement
- 1:08:54just like what I mentioned before it
- 1:08:56will aget asking for the budget and
- 1:08:59making sure it is the approve agree on
- 1:09:01the budget. So I will start a new
- 1:09:02session. I will [snorts] copy this and
- 1:09:05paste it to say give me two ticket for
- 1:09:08uh I'm sit down and then you can see it
- 1:09:10will pause for waiting for the human
- 1:09:11input. So here if I if I turn off the
- 1:09:14machine and then start again it will
- 1:09:16still pause here because again similar
- 1:09:18to previous one it will resume from the
- 1:09:20previous state.
- 1:09:22and [clears throat] and here if I just
- 1:09:24say uh I'm going to copy this to say two
- 1:09:27ticket up to uh 250 each. So this is
- 1:09:31like here I'm having this permission to
- 1:09:33telling the agent and you can see that
- 1:09:35I'm at this stage right now. So and then
- 1:09:38you asking me okay uh ask my
- 1:09:41confirmation
- 1:09:43uh so making sure you understand
- 1:09:45correctly. So I'm going to say yes,
- 1:09:47that's right. And then it will start uh
- 1:09:50to continue purchasing things for me. So
- 1:09:53this is like for you to add a permission
- 1:09:55from the user side to purchase a ticket.
- 1:10:00Um so once you purchase a ticket,
- 1:10:02another very important thing is when
- 1:10:04it's coming to when it's your turn to uh
- 1:10:08purchase things, you might not able to
- 1:10:11find the uh the the right seat. Maybe
- 1:10:14the seat is already being purchased by
- 1:10:16someone else. But the time you
- 1:10:18time you want to do the purchase, you
- 1:10:21you you have the seat in your mind, but
- 1:10:23at that time the seat is available. But
- 1:10:25when it's your turn to purchase, maybe
- 1:10:27that seat is not available because we
- 1:10:28have multiple people using the system,
- 1:10:31right? So how do you handle that
- 1:10:32situation? Like when you are do the
- 1:10:35actual purchase, what if the ticket is
- 1:10:36already being purchased by someone else?
- 1:10:39How do you add a guard to your system so
- 1:10:41that you will add
- 1:10:44ticket that uh satisfy your budget,
- 1:10:47satisfy your preference at the same
- 1:10:49time, it's not conflict with the ticket,
- 1:10:53it's not like conflict with other
- 1:10:54people. So, how do you configure that
- 1:10:56for you? So, this is uh where we're
- 1:10:58talking about in the 5B section that how
- 1:11:00do you making sure it's not conflict
- 1:11:03with other people. So, let me share my
- 1:11:06screen for the slide.
- 1:11:09Oh, I know this is a long one. I hope
- 1:11:11that everyone's still with me or still
- 1:11:13like
- 1:11:20still here doing the enjoying the
- 1:11:28ticket. So, let me share my slide.
- 1:11:31Okay, so we're here.
- 1:11:36Oh, which one is preferred before long
- 1:11:37running tool and workflow and request
- 1:11:40input? So, it's really depends. So,
- 1:11:43usually a lot of time request input is
- 1:11:45for you to um have the human input you
- 1:11:49know and long running function tool
- 1:11:50often time for example you do not need a
- 1:11:53human input you pretty much just uh for
- 1:11:56example I have a video generation and
- 1:11:58the [clears throat] video generation is
- 1:11:59taking a lot of time. I'm just going to
- 1:12:01wrap the video generation in a long
- 1:12:02runninging function tool and then I'm
- 1:12:04going to just wait until it finish the
- 1:12:06thing. Um
- 1:12:09yeah, so that's how how I usually think
- 1:12:12of it. But even with Yeah. So with
- 1:12:14whatever way you're doing that, you need
- 1:12:15to think about you know how do you set a
- 1:12:17trigger? How do you let the system know
- 1:12:20u you finish doing the things? Yeah. So
- 1:12:23hope that answer your question. [gasps]
- 1:12:25But thanks everyone for still um here
- 1:12:28with me. I'm going to like doing this
- 1:12:29last part. I think this is a very
- 1:12:30important part because often time you're
- 1:12:32building a system in a production. It's
- 1:12:34not a a demo. It's not like you're web
- 1:12:37coding a thing and it's working. You can
- 1:12:38just web coding something to say okay
- 1:12:40this purchase a ticket and it's working.
- 1:12:41But in a real life situation the things
- 1:12:44like this happen a lot like when you're
- 1:12:46actually building distributed system
- 1:12:48you have to worry about you know uh
- 1:12:51those state change right um so I think
- 1:12:54this is a very important part um for the
- 1:12:56system.
- 1:12:58So you know this is in this in this
- 1:13:02situation is that when you booked a
- 1:13:03ticket for you um the seat was still
- 1:13:05available and within budget and we saved
- 1:13:07that in the plan and then we v in the
- 1:13:09queue.
- 1:13:10So that information was correct when we
- 1:13:12read it but now when it's your turn some
- 1:13:16someone else probably purchased that
- 1:13:18with that seat. So the this is out of
- 1:13:21date. So even you are have a really good
- 1:13:25um even you have a really good um memory
- 1:13:28management it's still not working
- 1:13:30because memory will remember the old
- 1:13:31situation perfectly you have a pretty
- 1:13:33good memory however it's not able to
- 1:13:36help with this this situation so how do
- 1:13:38you making sure the model is always
- 1:13:40buying uh how do we enforce our purchase
- 1:13:43so that the purchase is always buying
- 1:13:45the uh valid one right so in this
- 1:13:48example we're using our old friend um
- 1:13:51callback back. Not sure if you're here
- 1:13:53at agent 101, we talk about the call
- 1:13:54back. The call back is basically we
- 1:13:56intercept this whole agent life cycle.
- 1:13:58The agent be so agent has a model using
- 1:14:00a different tools and then before the
- 1:14:02using the model before using different
- 1:14:03tool after using different tool at
- 1:14:05different intercept we are adding our
- 1:14:06custom logic over here right. So um so
- 1:14:09over here we have this before to call
- 1:14:11back. So before ADK executing certain
- 1:14:14tools I want to have this guard have
- 1:14:16this check making sure um the model
- 1:14:19proposes seed and then scar will check
- 1:14:21okay I'll check the book information
- 1:14:23check the quality quantity check the
- 1:14:25currency check the price limit check if
- 1:14:28current is available and if it's not you
- 1:14:31know um if it's not available we should
- 1:14:34reject this so that we trying to making
- 1:14:37sure our tool is doing the right so is
- 1:14:42trying to make sure whenever we purchase
- 1:14:43things it's not um purchased by other
- 1:14:47people right so this is like actual
- 1:14:49guard to check so we have the first
- 1:14:51guard is um adding user permission you
- 1:14:53have to add your preference on the
- 1:14:55budgeting and this is the second guard
- 1:14:56is in the before call back we're making
- 1:14:58sure um the old plan still work when we
- 1:15:01still waiting when we're waiting for the
- 1:15:03queue for so long and the next one is
- 1:15:09even when you purchase things maybe
- 1:15:11someone like at the very last minute
- 1:15:13they purchasing. So when you do the tool
- 1:15:15check it's still working but when you
- 1:15:17are do the actual purchase maybe you
- 1:15:19another person purchase you at the same
- 1:15:21time. So you could still have uh like a
- 1:15:25arrow like four five or three arrow or
- 1:15:27some other issues that when you do the
- 1:15:29purchase you might have the arrow. So
- 1:15:31when you have the arrow you might want
- 1:15:32to um like do purchase again. So in the
- 1:15:36real-time system it's potentially that
- 1:15:38you do the purchase twice and you cost
- 1:15:40you uh money again. So in this situation
- 1:15:43what we want to do is we want to have
- 1:15:44the uh item potency key to enforce that
- 1:15:47we only have one intented purchase
- 1:15:49across the repeated requests so that it
- 1:15:52won't keep charging you at the same
- 1:15:53time. So the whole lab is um we're going
- 1:15:56to learn how do we making sure it's not
- 1:15:58charging you twice and also how do we
- 1:16:00add the guard in the before two call
- 1:16:02back so that you will actually reject
- 1:16:04the request when they are when the seat
- 1:16:07is not up to date.
- 1:16:10I know I'm a little bit over time. I'm
- 1:16:12not sure below you still have time after
- 1:16:14this. Okay, you still have time. I'm
- 1:16:17gonna wrap up soon because um sorry for
- 1:16:20going a little bit over time. just
- 1:16:21really quick to wrap up this guard part.
- 1:16:24Um, so I'm gonna I'm at currently at 5B
- 1:16:28and uh [clears throat]
- 1:16:31and over here is a before call back. Oh,
- 1:16:34it's not before call back. Yeah, those
- 1:16:36are not before callback. Sorry. Yeah, so
- 1:16:39those are some logic to check uh the
- 1:16:41available to check the to check uh the
- 1:16:44uh the available tickets. So if I open
- 1:16:48the
- 1:16:51if I open this so basically it's like if
- 1:16:54I open this order and when I do the
- 1:16:56purchase what it does behind the scene
- 1:16:58is before I do the purchase it will
- 1:17:00actually do the check first and once the
- 1:17:02if the check refuse then the purchase uh
- 1:17:05won't go through. So basically we'll
- 1:17:07have another attempt for a different
- 1:17:09ticket number. So uh the whole thing is
- 1:17:11we want to learn like making sure when
- 1:17:13you are doing this uh purchase and after
- 1:17:17the long wait the seat is still
- 1:17:19available. So we need to add this actual
- 1:17:21guard making sure that u we still have
- 1:17:23the valid purchase. And then this one is
- 1:17:25making sure that um it's not
- 1:17:29it's not purchasing twice. So it won't
- 1:17:31charge you even you like do the
- 1:17:33different attempt we will have the item
- 1:17:35opponents and key to uh making sure it's
- 1:17:38uh it's only uh charge you one one time
- 1:17:42so that user doesn't get uh charged
- 1:17:45multiple times. So yeah, I think those
- 1:17:47are the I'm not probably a little bit
- 1:17:48over time so I'm not going to go through
- 1:17:50them step by step but like those are
- 1:17:51very important concept when you are
- 1:17:53building the system that's uh um when
- 1:17:55you have a distributed system you have
- 1:17:57multi-user and then uh we want to scale
- 1:17:59the system those are very important uh
- 1:18:02things to know and the last thing is
- 1:18:03when you scale the system how you can
- 1:18:06deploy the whole thing. Um so basically
- 1:18:08previously we have this uh we learn the
- 1:18:11clock it's a set a timer but over here
- 1:18:14you can set a clockuler so you can
- 1:18:16schedule things regularly to check okay
- 1:18:18whether um whether we're what are
- 1:18:21situation in the in the queue do we have
- 1:18:22to see whether the sales open not and
- 1:18:24then you can resume from and we also
- 1:18:26have the deployment to the cloud run
- 1:18:28with the pops up so yeah basically this
- 1:18:30is like uh how we can deploy everything
- 1:18:32to Google cloud and scale our system why
- 1:18:34we have this long
- 1:18:37workflow. Yeah. So
- 1:18:40the whole thing is we well we start with
- 1:18:43this sticky monster situation that we
- 1:18:45want to learn uh so we first learn that
- 1:18:48you simply tell the agent to do the
- 1:18:50check regularly it's not working. So you
- 1:18:52need to able to you need to making sure
- 1:18:54set explicit trigger and then you need
- 1:18:55to figure out a mechanism to trigger
- 1:18:57them either like every uh set of chrome
- 1:19:00job or whatever to have a mechanism to
- 1:19:02trigger this and then with ADK it's
- 1:19:04important that when you set a trigger
- 1:19:06you need to configure you need to
- 1:19:08integrate with your own runner because
- 1:19:10runner is powering up the whole thing
- 1:19:11and then we learn how do we manage the
- 1:19:14whole thing with uh agent context
- 1:19:16because um we have the we talk about
- 1:19:19session service memory service different
- 1:19:21type of state so that we can resume user
- 1:19:23state. We can have the persistent state
- 1:19:25for for the system and then we have this
- 1:19:28resumable setup. We talk about
- 1:19:30longunning tools and also the request
- 1:19:32input so that in the long running
- 1:19:34workflow you can always pause and then
- 1:19:36resume from there where they were. But
- 1:19:38the backbone the foundation is you need
- 1:19:39to have the persistent memory over here
- 1:19:42so that you can survive the service
- 1:19:46restart. And once you have the you know
- 1:19:49how to set up the trigger you have this
- 1:19:50persistent database set up you know how
- 1:19:52to resume from a long running workflow
- 1:19:54finally when you do the actual purchase
- 1:19:56you need to making sure the purchase is
- 1:19:58uh it's safe you need to making sure the
- 1:20:00purchase up to your standard by first
- 1:20:02set your permission with human input and
- 1:20:04then uh making sure you are doing the
- 1:20:07scar checking that even after this long
- 1:20:09waiting the original request is still
- 1:20:12valid. So you need to have this extra
- 1:20:13check and then um after that resist the
- 1:20:16specific example into making sure user
- 1:20:18doesn't get double charged by making
- 1:20:20sure that we're checking the key to not
- 1:20:22double checked and lastly um this is how
- 1:20:25we can scale the system on Google cloud
- 1:20:27by this is like the whole workflow we're
- 1:20:29building with ADK this is a runner we
- 1:20:31configured and then we we can putting
- 1:20:33the artifact to the cloud storage
- 1:20:35putting the memory artifact to the uh
- 1:20:38clust cloud storage tool and we can also
- 1:20:40have the Google cloud memory bank or
- 1:20:42rack um memory service if you want to
- 1:20:45explore that and we also over here you
- 1:20:47could have cloud SQL to store all the
- 1:20:49event session to store all the
- 1:20:50conversation we have um and here we have
- 1:20:53this uh clouduler to set a timer to
- 1:20:56constantly checking whether things are
- 1:20:57working and we also learned how to have
- 1:20:59the human in the loop with the request
- 1:21:01input to pause the workflow so let's
- 1:21:03continue yeah so I think that is the
- 1:21:06whole thing for this long running
- 1:21:08workflow I'm going to um Pause here and
- 1:21:12then bring Boom back. Thanks Bill for
- 1:21:16help.
- 1:21:16>> Hi. [laughter] Hi.
- 1:21:19For too long.
- 1:21:22[laughter]
- 1:21:22>> Yeah. Thanks for helping me with the
- 1:21:24chat.
- 1:21:26>> I'm going to pause to see if you have
- 1:21:27any questions. If I do I miss anything.
- 1:21:32Yeah, finally.
- 1:21:36I hope that you guys enjoy the session.
- 1:21:40you [snorts] want to broadcast us to the
- 1:21:41next session content the Halloween.
- 1:21:43>> Oh yeah. So next session is a Halloween
- 1:21:45session. We're gonna talk about uh
- 1:21:46multimodel agent. So we all learn how to
- 1:21:49do the multimodel generation, how to
- 1:21:51have a multimodel pipeline ingestion.
- 1:21:52We're going to cover the workflow and uh
- 1:21:55basically um yeah so it's like workflow
- 1:22:00deep dive and multimodel
- 1:22:04multimodel generation multimodel
- 1:22:05ingestion with with rack and um and yeah
- 1:22:09basically how do you build a multimodel
- 1:22:11agent with workflow and next next week
- 1:22:14is about how do you automate the whole
- 1:22:15thing by how to make your video
- 1:22:17generation workflow by it will help you
- 1:22:21automate
- 1:22:22you you actually creating your video and
- 1:22:24you will actually publish your video in
- 1:22:25our own system. So you will able to see
- 1:22:27the video you generate and you able to
- 1:22:29see the video published to our streaming
- 1:22:33service. So cool. Yeah, you will have
- 1:22:36your Halloween video next week if you
- 1:22:39want to. Yeah, if you want to try.
- 1:22:41[snorts]
- 1:22:43>> Is that Asian 103?
- 1:22:45[laughter]
- 1:22:46[sighs]
- 1:22:47>> Oh, I think it's a special edition. It's
- 1:22:51like a festival thing.
- 1:22:52>> 102.5.
- 1:22:55>> Thank you.
- 1:22:58[snorts]
- 1:22:58>> Yeah, we are coming for that fastest
- 1:22:59actually. We're going that fastest. I'm
- 1:23:01going that fastest Atlanta next week and
- 1:23:03also that fastest um Seattle and Boston
- 1:23:07and also trying to go to Vancouver. I'm
- 1:23:10so busy.
- 1:23:18Oh, when is next session? I think let me
- 1:23:22double check my calendar. Um
- 1:23:31I I probably want to do it next
- 1:23:33Wednesday this time. If you guys are up
- 1:23:35for next Wednesday, I'll be here next
- 1:23:38Wednesday, the same time here.
- 1:23:41Let me know if this work for you all.
- 1:23:50Okay. So, it doesn't work for you,
- 1:23:52James.
- 1:23:55That's pretty cool. Hey, uh I want to
- 1:23:58see you you could share the GitHub with
- 1:24:00us.
- 1:24:02Thank you so much. And also kudos to
- 1:24:04Christina. You know, Christina wrote
- 1:24:06this whole lab and then I rebuilt the
- 1:24:09whole thing. I really I kind of like
- 1:24:10modify her lab but she come up with a
- 1:24:12whole design you know how do we how do
- 1:24:15we do this long runninging workflow with
- 1:24:17a ticket purchase.
- 1:24:19So I want to say special thanks to
- 1:24:21Christina even she's not here.
- 1:24:29Yeah that fast is a Google's uh Google
- 1:24:31developer group event. [clears throat]
- 1:24:34Do you have any do you see any fun
- 1:24:36comments you want to
- 1:24:38>> uh in I just try to get the GitHub link
- 1:24:42of that cool AI wise agent.
- 1:24:45[snorts]
- 1:24:48>> Yeah, thank you everyone for stay here.
- 1:24:51Now I know this is like a longer session
- 1:24:54than previous.
- 1:24:57I think it's a important like useful one
- 1:24:59because oftent time that
- 1:25:02I find it's important to know those
- 1:25:04concept to know better about how to code
- 1:25:06with AI and also how do you scale the
- 1:25:08system not sure I'm curious below what
- 1:25:11do you think in your day-to-day job
- 1:25:13>> yeah we had this conversation uh like
- 1:25:16three months ago actually in the team uh
- 1:25:18there are two conversations related to
- 1:25:20that people keeps asking like how could
- 1:25:22we let my agent running for a long time
- 1:25:24>> like I think it's that's why I feel this
- 1:25:27content is super super useful. [snorts]
- 1:25:31>> P in Google, how what is your I'm just
- 1:25:34curious when you how do you code with
- 1:25:38AI, you know, like just curious your
- 1:25:41>> with our internal coding agent.
- 1:25:44>> Yeah. Yeah.
- 1:25:45>> And add some harness like anti-gravity.
- 1:25:49>> Yes. And you write your own harness like
- 1:25:52your skills and you try to see the
- 1:25:55context window try to control the
- 1:25:57hallucination and you also have a lot of
- 1:26:00rules and also you bundle with this like
- 1:26:02today's concept super useful like you
- 1:26:05can make your Asian more powerful. Yeah.
- 1:26:08>> Do you spend a lot of time read code
- 1:26:11like review code or spend a lot of time
- 1:26:12writing PR? Oh, I feel this this the
- 1:26:15bottleneck is reviewing everything like
- 1:26:17review the design doc review the code
- 1:26:20it's all about review stuff like AI can
- 1:26:22easily generate a tons of thing
- 1:26:27although we already have the code review
- 1:26:28agent these days to help with us but
- 1:26:30still need human to interact
- 1:26:33>> when you [snorts] review PR do you re
- 1:26:35review line by line or just review or
- 1:26:38just relying on you know the AI agent
- 1:26:41>> yeah do you review code line by line
- 1:26:43just curious
- 1:26:45No, like you get the whole concept. Uh,
- 1:26:47and there are several different types of
- 1:26:49code review agent. There's code view
- 1:26:52agent to review the potential test
- 1:26:54failure and code agent to review the
- 1:26:57code readability like you know like we
- 1:26:59need to maintain high quality code. So
- 1:27:01the code need to follow the Google's
- 1:27:03readability. So this readability agent
- 1:27:05also helps to make sure your code looks
- 1:27:07clean.
- 1:27:08>> [snorts]
- 1:27:08>> And after you let them to run the first
- 1:27:11run and after that you start to focus on
- 1:27:14the key logic.
- 1:27:17>> Yeah. I find like nowadays because AI is
- 1:27:20so good at generating code uh then like
- 1:27:22reviewing code becomes harder especially
- 1:27:24working in a group right.
- 1:27:26>> Yes.
- 1:27:29>> Yeah. I think Android now is pretty
- 1:27:31pretty powerful.
- 1:27:35>> Glad we got better model now. [snorts]
- 1:27:38Yeah.
- 1:27:41Oh. Oh. You find it's hard to start with
- 1:27:43video generation model. Um like using VO
- 1:27:46or Omni. I think Omni is a pretty cool
- 1:27:48model to do the generation as well. If
- 1:27:52you haven't tried it,
- 1:27:56I'm not sure what your question about
- 1:27:58URL, but for next week I will just
- 1:28:00schedule the session at the YouTube. So
- 1:28:02I don't have a URL for next week.
- 1:28:09Yeah, we need more more code need to
- 1:28:11review.
- 1:28:13It's called slot review, right?
- 1:28:19[clears throat] Oh, anyone have any
- 1:28:20questions?
- 1:28:24Yeah, of course. You know, Ver's using
- 1:28:26antiquarity like internal version of it,
- 1:28:28right?
- 1:28:34Bill, do you have like a harness set up
- 1:28:36like I don't know like a workflow setup
- 1:28:38to have like automate your coding gener
- 1:28:41like automate your task and automate
- 1:28:43your uh for example create a design do
- 1:28:46create your code just curious yeah uh
- 1:28:51basically you you just get the skeleton
- 1:28:55um the workflow I think depends on the
- 1:28:58work for example if you want to do the
- 1:29:00coding like normally inside we have some
- 1:29:02bio organization tool and you got the
- 1:29:05link of that back bization tool and ask
- 1:29:09AI to help you analysis and you just run
- 1:29:12around check if the AI is hallucination
- 1:29:14or is doing the right work and after
- 1:29:17then you create an implementation plan
- 1:29:18and uh ask AI to implement the code and
- 1:29:24then uh have the code review agent to
- 1:29:27self-re your own code first before
- 1:29:29sending it out and you also we also have
- 1:29:31a lot of testing automation using AI
- 1:29:34these days. So this testing automation
- 1:29:36AI tool can help us verify the results.
- 1:29:39Yeah. And the evalu becomes more and
- 1:29:41more important in this way and then you
- 1:29:43send it out and after you receive the
- 1:29:46feedback coding feedback you can ask AI
- 1:29:49to help you address the thing. So you
- 1:29:51can write the whole flow as a skill.
- 1:29:54>> Oh that's pretty cool.
- 1:29:57>> Yeah. I'm just very curious how people
- 1:29:58nowadays are working with AI. How how
- 1:30:00how everyone's be a native. I think
- 1:30:02that's pretty cool. Um, yeah, we have
- 1:30:04for uh ta ta ta asking, thank you for uh
- 1:30:10sharing this and you've been down a lot
- 1:30:12of work and are you thinking about
- 1:30:13organizing? Yeah, I will definitely
- 1:30:15organizing a GitHub and putting things
- 1:30:17together uh so that it's in one place
- 1:30:21and it's easier for for you to review.
- 1:30:22Actually, I'm working on uh putting all
- 1:30:25the agent 101 into one ripple so that
- 1:30:27you can have everything all together and
- 1:30:30I want to like uh so I'm still polished
- 1:30:32at ripple maybe uh learn from bel uh you
- 1:30:36know code review skill to quickly roll
- 1:30:38out the ripple and I will share this
- 1:30:41with you. I can I will share this
- 1:30:42probably uh once I have this I will pin
- 1:30:45this in the comment for all the video if
- 1:30:47that's helpful or maybe I can share this
- 1:30:50with the
- 1:30:53email for everyone who registered for
- 1:30:54this one but I I guess for the agent 101
- 1:30:56I u maybe it's a bit too late but I will
- 1:30:59share this in the comment thanks this is
- 1:31:01a good suggestion
- 1:31:08yeah okay so I think It's a bit late and
- 1:31:12then thank you everyone for joining.
- 1:31:15Thank you Annie. Bye.
- 1:31:18Bye bye. I'm going to stay here for one
- 1:31:21more minute just to check the um check
- 1:31:24the comments. See you soon. Thank you so
- 1:31:26much for joining.
- 1:31:30Thank you for joining. I just want
- 1:31:31making sure. Yeah, I'll definitely
- 1:31:33putting things to the to one uh collab.
- 1:31:36Yeah, I know. But my GitHub I need to
- 1:31:38organize my GitHub. I think that's a
- 1:31:40good call. Thank you so much. You want
- 1:31:42to get for browser control using voice
- 1:31:43agent. Also, I'm using something called
- 1:31:46uh harness. Um so it's a skill uh to
- 1:31:50control the um yeah I will sh I think I
- 1:31:53shared that in my video but I will I'll
- 1:31:55organize my GitHub and share this with
- 1:31:57you. Thank you for suggestion. Thank you
- 1:31:59so much everyone for joining. Thank you
- 1:32:01so much for staying this long. Thank you
- 1:32:03so much and uh I will see you next week
- 1:32:05next Wednesday about Halloween about
- 1:32:07multimodel thing. If you want to learn
- 1:32:09more about
- 1:32:11really look forward to see all of you
- 1:32:13together. Thank you so much again. I'll
- 1:32:15see you next week. Bye.
About this transcript
This page contains the full transcript of Google’s Free 2-Hour AI Agent Course: Master Harness, Loops & Graph Engineering (0% to 100%) by frugle 1.7M, generated from the public captions YouTube serves with the video. The transcript has 16,191 words across 2,219 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.