Total Recall: Agent Memory and Harness Engineering — Ignacio Martinez, Oracle

AI Engineer · 60 min · 523 sentences · from YouTube's caption track

Each timecode opens YouTube at the start of that sentence. Line anchors (#s42) are the cue ids in the WebVTT, and every line carries its start and end seconds. All transcripts has every talk, and the whole corpus as one file.

  1. 00:12Hello.
  2. 00:12Hello.
  3. 00:13Perfect.
  4. 00:15Yep.
  5. 00:16So, perfect.
  6. 00:18Yeah, this this volume is perfect.
  7. 00:20It's just a website that I I registered the domain on Saturday just to do the registration of the workshop.
  8. 00:27But for those of you who are going to follow along with me, just know that after you complete that that process in the in the workshop, you will get an invitation to the repository
  9. 00:40and just view the invitation, accept it, and then you will be able to run the workshop.
  10. 00:45We'll be running the workshop on GitHub Codespaces.
  11. 00:47So, if you want to start that up, it takes like five minutes.
  12. 00:51Um, just for reference, I'm going to use the first 30 minutes to give you an introduction to agent harness and lots of other concepts and then in the next hour and a half, we're going to go actually go through uh the workshop
  13. 01:07together.
  14. 01:08Sound good?
  15. 01:10Okay, perfect.
  16. 01:11And thank you, by the way, for being here because I know it's Monday 9:00 a.m. So, I commend you all for for being here.
  17. 01:19Uh just two minutes before we begin.
  18. 01:22So I will shut up.
  19. 03:22All right.
  20. 03:23Well, let's let's begin, guys.
  21. 03:25So, thank you for being on this uh at this time here with me.
  22. 03:32Um, I know it's 9:00 a.m. like I said, so hopefully I can and and we me and my team can make your time worthwhile.
  23. 03:41At the end of this session, what I would like you to leave with is some knowledge on agent memory and agent harnesses.
  24. 03:48How you can build your own agent harness, which is nowadays one of the hot topics on AI, I would say.
  25. 03:55Um lots of people are talking about models constantly but the thing is that models like language models they are the frozen part of the reasoning right we just have to
  26. 04:06accept what we are given and uh during the past few weeks you will if you're following the news you will have seen that this is this has never been more true than now.
  27. 04:17So the harness is what we're going to talk about.
  28. 04:21For those of you who weren't here, uh you can scan this QR code or go to that website workshopwaiting room.com and just register.
  29. 04:31You will get an invitation to a GitHub repo and on this GitHub you will be able to create a GitHub code space where we will run the workshop and
  30. 04:44you will have everything set up for you.
  31. 04:46So just little introduction on on who I am.
  32. 04:50I've been working for Oracle for seven years.
  33. 04:53I've been a developer advocate for about four of them and you can find you know my talks and I'm very active on GitHub as well.
  34. 05:02So if you're a GitHub user uh just check out my GitHub profile if you like.
  35. 05:07Uh what is the highlight of my career so far?
  36. 05:10I launched a course with Andrew Ang on agent memory.
  37. 05:15So if you're interested on the memory components of what we're going to what we are going to discuss today, you could just check out that course if you'd like.
  38. 05:24Um these are the things that we are going to uh talk through today.
  39. 05:28Right.
  40. 05:29Uh first of all, we're going to do an little introduction on what the agent stack is and then we're going to zoom into the data layer where the memory lives.
  41. 05:39Then we're going to explore a little bit about the shapes, the different shapes that AI applications take nowadays.
  42. 05:45Uh what an agent is uh followed by the seven different layers that make up an agent harness.
  43. 05:52So we if you just follow these seven different structures, you will be able to create an agent harness, a minimal agent harness that you can connect any model to.
  44. 06:05Then we're going to finally talk a little bit about continual learning and how as as Oracle we are uniquely positioned to help you achieve and and develop agent harnesses and and AI applications.
  45. 06:20So the agent stack and by [clears throat] the way if you have any questions just raise your hand.
  46. 06:24I'm very happy to to take questions as well.
  47. 06:27So the agent stack, the agent stack like every agent, every AI agent sits on on these five layers.
  48. 06:36You either you have an application which is the product surface, right?
  49. 06:41What we interact with as users, you have data and that has lots of components.
  50. 06:47You have memory, you have knowledge, you have retrieval, encoding, search, you have the model itself, the reasoning large language model that is behind everything.
  51. 06:57Uh infrastructure which is the orchestration, what model do we serve depending on the reasoning effort that we need and things like that.
  52. 07:04And then we have compute which is the cloud or GPUs and also the the database engine and the application the model the infrastructure and the compute these four layers except for the data
  53. 07:19they are uh increasing increasingly commoditized.
  54. 07:22What do I mean by that?
  55. 07:24They are trying to take away the complexity from these layers out of out of our domain.
  56. 07:32Right?
  57. 07:33So the thing that we have the most control over when working with AI applications is actually the data and that's the part that we're going to focus in because the agent harness excels and you know lives very closely with the with the data layer.
  58. 07:48So let's focus on the on the data layer.
  59. 07:53The data layer is where an agent harness appears and it has you know many components.
  60. 08:00The first component is the gateway and MCP is interesting because that's the one that connects an agent harness to data and tools.
  61. 08:11So kind of think of of a large language model like a isolated thing that wouldn't be able to work at all if it didn't have access to things like
  62. 08:23data.
  63. 08:24Right?
  64. 08:24So you you you then have like the memory layer, the semantic layer, retrieval layer, context layer, and tools and skills that are built on top of the gateway and MCP
  65. 08:38layer.
  66. 08:38Let's say for instance that you have a I don't know an application on your computer and your large language model doesn't have access to it.
  67. 08:45For instance, Outlook, right?
  68. 08:48So if you might want to have your large language model connect to that, you can create an MCP, you specify some functions and then the LLM all of a sudden is able to communicate with this program.
  69. 09:01So gateway and MCP is like the layer that connects a large language model to the outside world or the factor to our computer or wherever you're working.
  70. 09:12And AI applications today they take up four different um four different shapes right you have LLM chat bots which are very passive uh they just respond when you ask a question
  71. 09:26you also have rag applications which are semi-passive because they have to do some kind of processing in the background but then you also have a passive nature of it and then you have the more active components of AI applications which are what we kind of use every day
  72. 09:42like cloud code etc etc which are a combination of LLM driven workflows that provide automation and AI agents that provide autonomy and we'll go we'll we'll explain later what what I mean by that but first I want you to have
  73. 09:59a very clear definition of what an AI agent is so to me an AI agent is essentially a model large language model plus a hardness The model itself will be the reasoning
  74. 10:14and everything else will be the harness.
  75. 10:17Um so this definition is something like this.
  76. 10:22An autonomous entity whose cognitive functions are powered by a large language model for reasoning.
  77. 10:28They are augmented by a database or files for memory.
  78. 10:34They are extended through tools for actions and grounded in inputs that let it p perceive uh its environment.
  79. 10:42So an agent is a a model plus the harness.
  80. 10:47So if the agent is the model plus the harness in this diagram, right, we have reasoning and the reasoning is the part that we don't control.
  81. 10:58It's the part that we are that's that's heavily subsidized.
  82. 11:02the part that we rent.
  83. 11:04If uh if you're like me, you're subscribed to every imaginable subscription on earth and that's the thing that we do not control, right?
  84. 11:13We have no control over what we are offered and then we have memory tools and perception that actually we get some customiz customizability that we can do.
  85. 11:25Um so the goal of harness engineering is to create reliable and predictable outputs over and over.
  86. 11:35Whereas a reasoning model is very non-deterministic.
  87. 11:39You might give it the same out the same input and it might produce different outputs every time.
  88. 11:44Right?
  89. 11:46So I said that you know in a AI applications the most typical ones nowadays cloud codeex uh and any other type that you can think of is a combination
  90. 11:59of automation plus autonomy.
  91. 12:02Why?
  92. 12:02Well because automation provides reliability to a system and autonomy gives flexibility.
  93. 12:09And this is a combination that is very convenient when we are developing ourselves.
  94. 12:15By the way, raise of hands.
  95. 12:17Who is working as an AI engineer or as an AI developer?
  96. 12:22Oh my god.
  97. 12:23Okay, good.
  98. 12:24So, you must all have used one of these systems, right?
  99. 12:29So, all of them they have this commonality which is they have autonomy and they have flexibility.
  100. 12:36Um, yeah.
  101. 12:38So the idea is that these systems right they are built on top of an a proprietary agent harness and an agent harness is nothing more than everything that we spoken about an AI agent
  102. 12:54all the things that you need to do around that to enable it to produce reliable and repeatable outcomes right so the model itself nondeterministic same input different outputs every
  103. 13:09But the harness, what we want to do with the harness is to turn this nondeterministic nature of a large language model and be able to produce reliable and repeatable results.
  104. 13:21So the reasoning which is the part that we do not control, we're not going to focus actually the harnesses are built on top of models that are kind of swappable.
  105. 13:32you just need like a common interface like an open AI protocol or the anthropic API specification, right?
  106. 13:38All these things make it so that the model part is swappable and the harness is what we're going to focus on today.
  107. 13:48So, seven things that make up an agent harness.
  108. 13:52And as I said, we're not going to touch on the model layer because we have no control over it.
  109. 13:58But let's go a little bit more uh in detail into each of these.
  110. 14:02Right?
  111. 14:03You need a storage layer on your agent harness that essentially determines where the data is going to live, where the memory physically lives.
  112. 14:15uh and we'll see about this dilemma that has been going on about the last six months about files versus databases and why I think a hybrid uh combination of both is actually the best part.
  113. 14:29Then you also have memory engineering components which are all the encoding, the search and the retrieval components of it.
  114. 14:38And also the semantic layer which is kind of the the hidden things that happen or the hidden vocabulary that we assume that a large language model knows that is kind of proprietary to our companies or our knowledge.
  115. 14:53What we don't say to the LLM kind of that's the semantic layer.
  116. 14:57We'll lightly touch on agent loops and what an agent loop is and how to implement a very very minimalistic agent loop and finally go about some context engineering techniques
  117. 15:10that you know keep the window as salient as possible the context window as salient as possible.
  118. 15:16You want to minimize the context window as much as possible so that that the task that you're solving stays relevant.
  119. 15:24So until here we have done an introduction to what an AI agent is right its use cases and now we're going to dive deeper into uh an agent harness and each one of the individual
  120. 15:38components.
  121. 15:39So the model layer right the frozen reasoning core I say it's frozen because typically the weights of a model don't change and I say typically because uh we are actually
  122. 15:52I'm actually in the process with Casio sitting right there.
  123. 15:55We're going to record a new course with Andrew on continue learning for a agents.
  124. 16:01So if you're interested just check that out in a couple couple weeks.
  125. 16:04But the thing is that 99.9% of the time you will have a model and the weights of the model will never change uh unless you have millions of dollars or you know a lot of time or GPUs
  126. 16:18it's very hard to change the weights of a model.
  127. 16:21So there are other ways in which you can affect the reasoning without actually changing the weights of the model.
  128. 16:27But this is motivation for for the continual learning part that we will see in the workshop.
  129. 16:34where does the memory live right the files versus databases dilemma that we've been having uh since January kind of some people are very maximalists of files and some of us are
  130. 16:47well oh I will not include myself but some of some people are also maximalists of the database um and you know both things are right files have convenient things convenient characteristics
  131. 17:00and also the databases So the files right they are very easy to like they are very they match the model's instincts they are very easy to create they are very easy to insert and append data into files right it's very it has a very unstructured
  132. 17:19nature to it and databases on the other hand or the conception that people have is that they have a very structured way right but that's when you're thinking about SQL like SQL
  133. 17:31And the thing is that you don't actually need to like choose one or the other.
  134. 17:38You can actually use both of them.
  135. 17:40Like files are attractive because the models picks them and they kind of work very very easily with operating systems.
  136. 17:48They follow posic semantics.
  137. 17:50So they are compatible on Debian, Ubuntu, any other operating system that you might want.
  138. 17:57And they also have some disadvantages.
  139. 18:00for instance they don't have transactional consistency.
  140. 18:04So this is uh one of the problems that I wanted to talk about.
  141. 18:08If you are a degenerate like me and you are working I don't know with 8 16 32 agents at a time.
  142. 18:18Uh the problem with this is that files cannot be modified and inserted and modified at the same time.
  143. 18:25So what is the solution nowadays to not having transactional consistency and working with files?
  144. 18:32Any suggestions?
  145. 18:35Work trees.
  146. 18:36Exa.
  147. 18:36Exactly.
  148. 18:37So agents what they when they want to modify a file but another agent is working on this thing, they just create a different work tree, right?
  149. 18:46They will do all the progress in the work tree and then after the implementation is done they will merge to master or the merge to main sorry.
  150. 18:55So this is the way that is a workaround against not having transactional consistency right and you also have other characteristics like for instance hybrid search um this is not available on files but is very very easily achieved on databases.
  151. 19:14Um you don't have backups either.
  152. 19:17So if your operating system gets corrupted or something, you will just lose everything.
  153. 19:23And these are things that the database fixed 354 years ago and people have kind of forgotten about that.
  154. 19:30So what I want to do is to give you kind of the best of each of the of the implementations, right?
  155. 19:38You can get the benefits of files and the benefits of databases in the same place.
  156. 19:43And we'll see why.
  157. 19:44But these are some of the advantages, right?
  158. 19:46You have acid consistency.
  159. 19:49So atomic operations, consistent operations, isolated and durable.
  160. 19:55You have high availability.
  161. 19:57You might replicate the database and let it be, you know, in three different places in the world with a replication factor.
  162. 20:04You also have vector search, which is very easy.
  163. 20:07In files, you just have to do like regular expression matching or a derivative of that.
  164. 20:14and you know lots of other lots of other things.
  165. 20:17So what we will do on the on the actual workshop is we're going to run an actual example of trying to modify a file with three different agents that will be working on the same file and trying to update a counter on this file and let's see who's faster.
  166. 20:35I know the answer of course but you will you'll get to know it later.
  167. 20:40But what I want to introduce to you is that we have a thing called the Oracle DBFS or the database file system where you can store files inside the database on a file system and that
  168. 20:54gives you you know lots of the advantages that we said.
  169. 20:57You will get files with acid trans uh transactional consistency.
  170. 21:01You will get vector search relations security high availability etc. Right?
  171. 21:08And my suggestion is that since a hybrid system works best um we can have things like for instance uh short-term memory right that lives in files and when something needs to be promoted into a long-term memory for instance user preferences
  172. 21:24things like this they can go into a more structured space like a database and this is what we'll do in the workshop for the encoding the search and the retrieval which was another
  173. 21:37of the components in the agent harness.
  174. 21:41We also have a lang chain integration that I want to mention called langchain Oracle DB that makes it very easy to insert into vector stores, search in the vector stores and retrieve from the vector stores.
  175. 21:55So also we have another thing called in database embeddings.
  176. 22:00Have you ever heard about in database embeddings?
  177. 22:02Yes.
  178. 22:03Okay.
  179. 22:04So in database embeddings is very convenient especially for enterprise customers because you will get the embedding model inside the database so that when you're doing embeddings you don't have to call a third party service
  180. 22:18and that's very convenient for isolate like data retention and data security purposes.
  181. 22:25So this is what a an an embedding searching and reranking model would look like from a chatbot interface for instance right you have a lot of documents then you kind of use a benccoder so a benccoder is essentially an embedding model
  182. 22:41you will create eno embeddings out of these document you will split them and create vectors put it into a vector store right and then you will get a user prompt a user query a question
  183. 22:53you can also create an embedding out of that and then compare it to what you had previously on your vector store.
  184. 23:00And this is how you get the most relevant vectors in in an answer.
  185. 23:06Then you will run an a cross encoder which is a reranker and take a look at the question plus the result and that's how questions are answered kind of in in in rag applications.
  186. 23:19Right?
  187. 23:20So these things we are also going to to touch briefly on the workshop and the things that you know imagine this rag application from the beginning from the documents
  188. 23:32you create you do lots of things right you do tokenization then you create the embeddings um you have to do things like the duplicating the data normalization uh personal
  189. 23:45like redacting personally identifiable information lots of things right and then on your on your store you have textual data from the documents you have metadata which is typically stored in JSON
  190. 23:58you have vectors which are represented as as dense embeddings of 32 uh bits like you have so many types of data that you need to work on that typically what people have is for instance I don't know I will not name names so I don't get in trouble but
  191. 24:15you know you might need like different databases for each one of these, right?
  192. 24:20You you get what I mean?
  193. 24:22So there is a very high nowadays very high data synchronization logic overhead for AI engineers or even for agents, right?
  194. 24:32So lots of maintenance required and and and lots of engineering effort on it.
  195. 24:37And this is something that we want to avoid.
  196. 24:40So what I want you to do today is just to try us out as Oracle.
  197. 24:46Uh try our database.
  198. 24:48We have support for every type of data imaginable that you can think of.
  199. 24:54Um we are called the converg database.
  200. 24:56We are the only converg database in the market that we support JSON, we support relational, we support uh spatial, graph, JSON, anything that you can think of you'll be able to to create with us
  201. 25:08and you'll get like one database engine uh one query interface and uh one single development stack.
  202. 25:17everything will be in the same database.
  203. 25:18So also for data security purposes, you just have to you know secure and save all your data in one place.
  204. 25:28So a single attack vector is what you need to worry about.
  205. 25:32You don't need to worry about updating five different database.
  206. 25:35You can just worry on securing one database.
  207. 25:40So we can be the engine of your AI applications, not just a single step, which is what people think of when they're working with databases, right?
  208. 25:50Um, yeah.
  209. 25:54So agent memory, agent memory is essentially a description of all the mechanisms and the systems that allow an agent to retain, reuse, refine and recall information.
  210. 26:11We want to reuse the data and refine it in the process.
  211. 26:14But we want to reuse the data.
  212. 26:15So that the next time that an agent or us as engineers we are working on a problem that took us three hours, the next time that we observe this problem,
  213. 26:26the problem becomes easier either for AI agents or for us.
  214. 26:31And agent memory has lots of lots of components, right?
  215. 26:34We have short-term memory, we have long-term memory, and then we have shared memory, which is something that's relatively new.
  216. 26:41Um and this shared memory is kind of what happens when a sub agent is communicate with it is communicating with it with its parent for instance or two agents are trying to collaborate on solving one specific problem uh together
  217. 26:54and then what I want you to to see is that depending on the type of memory or or or the type of thing that we want to store it will be in one place or the other right so short-term memory is kind of ephemeral
  218. 27:09is very shortlived And it's very useful for things that are happening right now.
  219. 27:15For instance, the to-do list on a coding agent, right?
  220. 27:19It's happening right now, but you actually don't want to save that u you know in long term.
  221. 27:25But then there are things like for instance episodic memory things that previous conversations that you've had that's very useful to have for instance um I don't know if you if you use clot some people are using cloud
  222. 27:38um here uh but in in cloud you might take your previous conversations and try to refine all your workflows and your skills based on the things that you've done in the past.
  223. 27:49So this is something that makes sense to to save in the long run, right?
  224. 27:54You also have things like procedural memory, previous workflows that have worked very well for your system.
  225. 28:00For instance, you worked on this front end and then you created a very beautiful design that you like.
  226. 28:08You might take the whole conversation and turn that into a workflow that is repeatable and re reusable so that the next time you're working on a front end the results will be similar to the previous one.
  227. 28:19Right?
  228. 28:20So these are the things that we we will see on the workshop and some people say okay why do I even need all of these like people that are very
  229. 28:30that have animosity towards agent memory people say okay let's just put like 15 million uh context window even though it's not not possible yet but some people really believe that this is the the thing right but the context window is a type of short-term memory
  230. 28:47so it's useful for some things but not for all of them.
  231. 28:51And one of the problems that that happen with with working with a with a context is this thing called context rot or context degradation over time.
  232. 29:02And what happens is that the more things that you put into the context window, the less attention there will be for each one of the things that are in the context.
  233. 29:12So at the beginning of a conversation and this is a a famous problem that that the context window has is at the beginning of the conversation it will stay on track
  234. 29:22a lot because you are just you just started the conversation.
  235. 29:26So let's say that for instance like in school, right?
  236. 29:29Or if I'm having a conversation with you, um I might have the a chat with you for 30 minutes and your attention to me is very very high because
  237. 29:38I just started speaking.
  238. 29:40But if the conversation goes on for eight hours, then you want to punch me, right?
  239. 29:45Because I haven't shut up and you haven't learned almost anything at the end.
  240. 29:50And the the problem is that attention like us humans is very limited.
  241. 29:54So the more things that you put in the context window, the attention matrix of the neural network will all also degrade and it will like scale quadratically because the attention matrix
  242. 30:07you know is one token.
  243. 30:09It's essentially a reference of one token for every other token in the context window.
  244. 30:14So the bigger the context window is, the matrix scales on the number of rows and on the number of columns as well, which is a problem.
  245. 30:22So you want to keep the context window as small as possible to avoid context rot and memory engineering the components of memory engineering.
  246. 30:33Um so it's like designing building and doing everything around building agent memory for AI agents and we want to retain recall reuse and refine this data in some type in some way.
  247. 30:50So it is a discipline right and here we have Valentine for instance and we have people from Oracle uh my colleagues all over the the room.
  248. 31:00So if you see them you can say hi to them.
  249. 31:04Valentine here he's working on the development or he worked on the development of this agent memory package.
  250. 31:11So if you have any questions about this you can ask him.
  251. 31:14Um, OAMP or Oracle agent memory package is the managed answer that we have in Oracle to lots of the problems that you will find when working with this type of data.
  252. 31:26For instance, as an engineer, if you do not have a managed solution, you need to make a lot of decisions.
  253. 31:34You need to see when do I do context compaction, when do I summarize, how do I write it, the summarizer, what do I keep, what do I not keep,
  254. 31:45um what do I extract from my previous conversations and when, how many tokens do I use for this problem and lots of these things, right?
  255. 31:56With OAMP, an Oracle agent memory package, you can actually just do all of this in one single line of code.
  256. 32:04And we want to make it easier so that we reduce the cognitive load of AI engineers and AI agents as well.
  257. 32:13And with this context card uh thing, you will get something like what you see on the left.
  258. 32:19And this is kind of an explanation of what each part does on it.
  259. 32:26But essentially the the topics uh that you see for instance from any conversation you can create a context uh card from the thread or from the conversation.
  260. 32:35The topics will orient the model.
  261. 32:37The summary will compact the thread and it will state the current intent of an AI agent and the relevant information has three different parts which is the the facts,
  262. 32:50the preferences and the memories that are associated to this conversation.
  263. 32:55uh then you have the episodic memories that explicit explicitly track the unanswered question that is going on right now and the recent messages give like local context to the model.
  264. 33:08So whenever you're feeling like unsure what do I need to do right now with the data that I have or this conversation you might use the Oracle agent memory package
  265. 33:18on on Python and it is all assembled by one single call.
  266. 33:23Yes.
  267. 33:24So you're not suggesting that this goes directly into the model.
  268. 33:29This is actually something that is used by the harness.
  269. 33:32Exactly.
  270. 33:33What's going into the model?
  271. 33:35Yes.
  272. 33:35Yes.
  273. 33:35The component that you're talking about that uses it knows about the structure.
  274. 33:41Exactly.
  275. 33:42Exactly.
  276. 33:42So this structure
  277. 33:44this is an abstraction that we build on top of the model because the model we have no control over in most cases, right?
  278. 33:50Um the thing is that we can build on top of that whatever abstractions we want to make the model perform as reliable as reliably as possible.
  279. 34:01Yep.
  280. 34:04So the memory and the semantic layer they kind of work together.
  281. 34:06We I know we talked only about memory components.
  282. 34:10Uh I'm going to walk you quickly because I'm I don't have a lot of time um to the semantic layer to the semantic components of it.
  283. 34:19Right?
  284. 34:19And the semantic layer is the the meaning of what's going on behind it that you kind of assume that that happens.
  285. 34:27Right?
  286. 34:28So anyone from Germany?
  287. 34:32Okay.
  288. 34:32So I apologize for my pronunciation but I'm going to try.
  289. 34:36So the is like the ambient of a model and this was coined by Jacob von Wexul.
  290. 34:45Um and this guy said that essentially every organism in the world uh that is living perceives its reality through a lens and the lens is what it has access to.
  291. 34:57For us humans for instance, we have our eyes, our senses, right?
  292. 35:01So everything that we perceive and everything that we leave, all our experiences are seen through this lens, right?
  293. 35:09And an agent doesn't have human like senses, but it has also a kind of semantic layer or a semantic lens that everything that you ask it is filtered through.
  294. 35:22And this lens is essentially what you train it with.
  295. 35:26And then what you also give context to.
  296. 35:29So everything that you talk to the agent right when you talk to the agent this agent will look it through the belvelt and the semantic layer is essentially the agent's velvet.
  297. 35:43So the onset is what what what I want to focus on like for instance organizational knowledge or enterprise knowledge things that when you're working with a colleague you don't mention this because this is already
  298. 35:58you know known between you and your colleague you need to specify everything that you work on every day.
  299. 36:04If there was someone else like a a child that wanted to that [clears throat] wanted to start uh working with you, you would have to specify everything very very in detail.
  300. 36:16These are all the answers and this is what the semantic layer captures.
  301. 36:20So the answer is the actual tribal knowledge that that an enterprise has right institutional knowledge as well like how the data is modeled, how the queries are executed, what is the metadata,
  302. 36:34all these things are in the semantic layer.
  303. 36:38Um and quickly just for you to know that we're also going to implement a very minimalistic agent loop.
  304. 36:45And an agent loop is like the driver of the model, right?
  305. 36:48It lets a model be kind of independent and autonomous and it is what makes a model it it turns a model into an agent, right?
  306. 37:02And this is like the simplest agent look that you can find is kind of this observing and reasoning and then acting part that happens all of the time.
  307. 37:14All of the time.
  308. 37:15And you know it's it has to be failure uh failure resistant so that we never exit the loop.
  309. 37:23This is the idea that the agent you give autonomy to the agent.
  310. 37:27Well you give autonomy to the model so that it becomes the agent.
  311. 37:31And then on the context engineering part which is the last part of the seven layers of an agent harness.
  312. 37:38You also have lots of things that you can do.
  313. 37:41For instance, the toolbox pattern and the skillbox pattern which we are this is on the workshop as well.
  314. 37:47And these are ways in which you can store the available tools and the available skills of a model so that they are retrieved optimally.
  315. 37:56And what you want to do is only retrieve the tools and the the skills when they are actually needed and put it on the context window only when needed.
  316. 38:07every iteration of an agent loop you will see if this is actually the right place and then if it's not you can just take them out temporarily so uh oh sorry I thought I saw a question
  317. 38:23so we will see all of this in the workshop I don't want to take up too much time but the idea is that we will assemble the context at every iteration
  318. 38:31on the agent loop and then continue learning is the part that that we talked before about the ability to get better over time with the things that we've done with a model, right?
  319. 38:45So a frozen model as we saw it doesn't get better, right?
  320. 38:50But there are ways in which we can make an agent improve in the weights which is the parts that we are going to work on uh in the representation
  321. 39:01part.
  322. 39:02So on the embedding and the reranking part and also in the context window and these are the three types of continual learning techniques.
  323. 39:11We are going to focus on the workshop on the context and the token space because it's one of the easiest ones and one of the least expensive ones as well.
  324. 39:22I assume no one is a millionaire or not many of us are millionaires.
  325. 39:26So this is also the most achievable and the most realistic way to change the model behavior over time.
  326. 39:36So without further ado, I just want to introduce you to this part which is skill promotion and workflow workflow promotion.
  327. 39:47So those skills or those workflows that you've done for three four hours, right?
  328. 39:53you've been working for the whole day on a workflow, you were able to successfully do your job.
  329. 40:00Um, and then these things can actually be retrieved, they can be stored into the memory components that we'll see.
  330. 40:08And then we will see about skill promotion.
  331. 40:10So if we promote a skill for instance, we can promote it through a distillation process and create a better skill.md than the original.
  332. 40:20So we will retire the old version and update from the new version.
  333. 40:25And this allows us to do some kind of continual learning on our own skills that turn them into more customized skills for ourselves, for our tone, our way to work,
  334. 40:38our preferred like our preferences.
  335. 40:40Like for instance, let's use this specific library because I really like the look and feel of it.
  336. 40:45let's use this uh specific database engine because it has less bugs or I found it easier to work with.
  337. 40:53All these things can be promoted into reusable and improvable skills over time.
  338. 41:00So this is what the whole harness would look like at the end of the of the workflow uh sorry at the end of the workshop and hopefully what you leave this uh you'll leave today with a better understanding of all the specific components
  339. 41:17that make up an agent harness.
  340. 41:20So let me go to here before I forget.
  341. 41:27If you are interested in the Oracle agent memory package or are working on the agent memory package, we have a discord server in which you can just chat with us as stuff.
  342. 41:39If you're a Discord user, just feel free to to join this discord server.
  343. 41:44I'll put the link later as well.
  344. 41:46But without further ado, let's begin with the actual workshop and I will tell you how.
  345. 41:54So let me show you first what we are going to build right this is an app book.
  346. 42:00Oh sorry uh you don't see this.
  347. 42:06Yeah.
  348. 42:15First, yes, the workshop instructions, right?
  349. 42:18So, for those of you who weren't here, you can just go into this website, register with your GitHub user, and then you will get an invitation like this to
  350. 42:30a GitHub repo and from here we will create a GitHub code space.
  351. 42:36Uh, so please make sure to do that right now and all my colleagues are are around the room to answer any questions that you might have during the creation of the code space, etc.
  352. 42:49Yes.
  353. 42:50Yeah.
  354. 42:55The internet.
  355. 42:56Are you having issues with the with the internet?
  356. 42:58Okay.
  357. 42:58Let's see.
  358. 43:00So, do you guys have my the same Wi-Fi?
  359. 43:02Um, AI.gineer Wi-Fi.
  360. 43:07Okay.
  361. 43:07So, can someone assist people with the Wi-Fi if possible?
  362. 43:13Whether you can help each and every one of us, you need to fix the system.
  363. 43:17Yeah, please fix the system.
  364. 43:19Whoever
  365. 43:20do it.
  366. 43:22I can't I can't.
  367. 43:28Yeah.
  368. 43:29Yeah.
  369. 43:29Uh my colleagues will we'll take a look at that if
  370. 43:37Right.
  371. 43:43Yeah.
  372. 43:43Yeah.
  373. 43:44It always happens, you know.
  374. 43:46Yep.
  375. 44:00All right.
  376. 44:04Say again, sir.
  377. 44:05slides that you were showing or they
  378. 44:07Yes, they will go into the AI I believe they they will go into the AI engineer.
  379. 44:12So, if you go into the session, uh I'll make sure to to to go there.
  380. 44:18If not, if you either join the discord or any other, you know, you can just message me as well on LinkedIn.
  381. 44:25I'll gladly give you the the slides if you want.
  382. 44:29All right.
  383. 44:30Um, video team, can you turn me on?
  384. 44:37Uh, sorry, switch me on, please.
  385. 44:43Uh, oh, perfect.
  386. 44:44Thank you.
  387. 44:45So, what I'd like you to to show you is that we have built also apart from the notebook that we're going to go through, we also built this app book.
  388. 44:55And with the app book, you can actually test every of the individual components of an agent harness uh individually, right?
  389. 45:03So just for me to show you that this is possible and you will get this automatically deployed in GitHub code spaces as well.
  390. 45:10So you will have um this uh already deployed and you will say well how am I actually making requests?
  391. 45:18We are going to be making requests to uh Oracle.
  392. 45:23Uh oh.
  393. 45:26Okay.
  394. 45:26Not file.
  395. 45:28Demo time.
  396. 45:29Um the idea is that Yeah.
  397. 45:33Okay.
  398. 45:34I I know what's happening.
  399. 45:35So I lost connection to my to my code space because of inactivity.
  400. 45:38Let me restart.
  401. 45:40Uh this appbook is going to allow you to create and chat and interact with the whole agent harness and the models that we're going to use are actually deployed on a managed service that we have on Oracle called
  402. 45:55OCI the generative AI service.
  403. 45:57We have partnerships with Google, with Meta and with OpenAI and with XAI for the time being.
  404. 46:06And we can actually provide inference to their models through our managed uh server.
  405. 46:11So think of us as the enterprise open router if you'd like.
  406. 46:17So let me just go so you get started.
  407. 46:20Uh you can get started.
  408. 46:21This is the repo, right?
  409. 46:23So the agent harness workshop.
  410. 46:26If you're here and thank you for starting that by the way.
  411. 46:30Um if you're here you just have to click on open in GitHub code spaces and it will take you here and you can select as many course as you like.
  412. 46:42uh if you so if you want to create this with eight or 16 please don't because I I don't I'm paying for this myself but uh you might also
  413. 46:51create this with more resources but just create the code space and I'm going to pay for it as I said so don't worry about that and this will create
  414. 47:00a new a new code space instance and once it finishes which it hasn't yet I will show you what we can do with the appbook and the notebook.
  415. 47:14But the idea is to use the remainder of the time that we have 1 hour and 15 minutes to go through the notebook and you will actually have to let me show you on on GitHub actually.
  416. 47:31Um you can go here and inside the notebook after you deploy the code space you will get uh a student notebook here and this is one part of the of the workshop right and here we're going to implement
  417. 47:47the whole agent harness substrate from scratch.
  418. 47:51So, we're going to start with only the model and then we're going to keep adding layers to the agent harness as we saw the seven layers, right?
  419. 47:59And we're going to be here to to assist you.
  420. 48:02You will have to do some to-dos.
  421. 48:04So, let me show you.
  422. 48:06There are a couple of things to do for you.
  423. 48:10So, for instance, the first thing that you need to do, you need to create a question, right?
  424. 48:17The simplest thing of everything, you just have to communicate with a model with no agent harness implemented, right?
  425. 48:24So the first thing you'll need is to ask any question that you like.
  426. 48:29This will go through the OpenAI completions API and it will return you a response.
  427. 48:34This is the simplest of all.
  428. 48:35And then we will start adding search, retrieval, encoding and all the other components that we that we have seen.
  429. 48:44There are a total of 19 things that you need to do.
  430. 48:47If you finish first, raise your hand and I will give you a hug because I don't have anything else.
  431. 48:57And yeah, so anyone already deployed the code space?
  432. 49:04Okay, one person.
  433. 49:04Okay, good job.
  434. 49:06So any yeah, if you have any questions or any problems, uh, let me know.
  435. 49:12But this is what it looks like when you have it deployed.
  436. 49:14Okay.
  437. 49:15So, let me go through this quickly.
  438. 49:19So, you will get an app, right?
  439. 49:24Um, and the app will already have everything that you need.
  440. 49:29If you want to deploy this app yourself, you might change this total recall port here.
  441. 49:39Let me show you how I did it again.
  442. 49:41I go into ports.
  443. 49:43I clicked on the visibility of the port and I changed this to public.
  444. 49:50And then this is now using a public gateway.
  445. 49:54So that if I open the browser, I can actually get access to my individual u total recall instance.
  446. 50:01So for instance, if I ask a question like show the total revenue by product category and of course this is mission control.
  447. 50:10So this is this has all of the components that we've uh spoken about implemented already.
  448. 50:17You will get also a context window visualization of the things that are going on on the background.
  449. 50:22For instance, these are the tools that were selected by the agent harness to be loaded into the context to answer this question.
  450. 50:30This is the schema that's happening.
  451. 50:32And then we can also take a look at the individual agent traces that are going on.
  452. 50:37For instance, which skills, which skills are being loaded, what sources of data are we taking and what are the tool calls being used like for instance running SQL commands etc to answer your question.
  453. 50:51So the question is still being built.
  454. 50:53It's taking 16 steps and you know it's gonna for instance here it detected an error right but because our agent harness is um fault tolerant it will keep trying because it's part it has an agent loop implemented
  455. 51:09etc right so all these things will actually yield you this result uh from from the data in the database right and you can actually go into the context window see how many tokens we're using
  456. 51:23And if you're particularly interested in some of these parts for instance the Oracle Asian memory package for instance you can interact also with only the uh the context card how to
  457. 51:35how the context card is being created etc etc. So you will all get this deployed in your codebase.
  458. 51:44Yeah.
  459. 51:58So his question for those of you who didn't uh listen where what happens if you have thousands of tools in an organization right well we introduced this concept called the toolbox pattern
  460. 52:13in this course with Andrew Yang and the thing is that you can optimize so that the retrieval of these tools is negligible.
  461. 52:23So you will use uh hierarchical navigable small world indexes that use a graph u a graph structure and then each node in the graph is a vector index or a vector store
  462. 52:36and then you can actually like hnssw indexes they can be create created for these types of problems only in the database not not in files.
  463. 52:46Um, so great question.
  464. 52:49It doesn't have to worry you until you reach millions and millions of users and tool calls like different specific tool calls.
  465. 52:58You might not get 5 million.
  466. 53:01It's more like reading a file, writing a file, grapping, all these kinds of tool calls that that that we do every day, they typically don't ex like exceed 100 or a thousand.
  467. 53:14Um but by being on a vector store you abstract the complexity uh the complexity and the amount of it.
  468. 53:21You can just make a a query 2,000 just as simply as you would 10,000 because of the storage component that we we choose it which is an HNSW index.
  469. 53:45Yeah, some of them they have access to confidential data for instance.
  470. 53:48Some of them don't.
  471. 54:01Yes.
  472. 54:08Great question.
  473. 54:08So his question was what happens if the tool descriptions that two different companies have are very similar, right?
  474. 54:15And one of the things we we can do on the toolbox pattern is actually generate with LLM enhanced toolbox descriptions for these for specific tools to increase the separability
  475. 54:27of the of the tools.
  476. 54:28So if you think that the current descriptions of a tool or of a skill as well are not enough, you can actually enhance them with LLM retrieval like you would
  477. 54:39uh instead of running for instance named entity recognition which is very uh caveman style.
  478. 54:45You can also do something more sophisticated which is enhancing the kind of like dock string uh enhanced representations of a tool so that you increase the separability when you're doing vector search.
  479. 54:59Does that answer the question?
  480. 55:08the agent loop is that?
  481. 55:10Yeah.
  482. 55:15Oh yes.
  483. 55:16Yes.
  484. 55:20We have seen some.
  485. 55:45Yes.
  486. 55:46So there there is a there is a limit of course because we don't have infinite money.
  487. 55:51So we can't just keep trying and trying over and over if the generations are just hallucinations right.
  488. 55:57Uh there is a cutff point that I set depending on the frontier LLM that I'm using for instance for Grog 4.1 fast reasoning which is the one that we're using here.
  489. 56:10Um I found that a value of 8 to 12 like maximum number of tool calls before giving up is correct.
  490. 56:20Uh depends also on the on the accuracy and the and the correctness of the model like for instance in this case it was just able to to to to show it in two before it was able to find it in 16.
  491. 56:33So t sometimes it will have a faster retrieval, sometimes you will need to be a little bit more patient.
  492. 56:39But what I like to define is a variable like a hysterosis variable that holds the amount of patience that the harness will get with the model.
  493. 56:49Then you can do some other things like for instance if the model is garbage.
  494. 56:54You can just use or use like a router for more different like for difficult types of problems you will route this problem to a frontier LLM and then for the easier types of problems you can just attach an open weights SLM for instance which will be more more interesting.
  495. 57:13Do you recommend models for
  496. 57:17Yes.
  497. 57:18Yes.
  498. 57:18I think that's like my personal opinion is that the future is a mixture of small experts for for each type of problem.
  499. 57:28some companies that they have developed like a 100 million parameter models that work exceptionally well for one type of problem and if you just have an aggregator and an orchestrator that routes the correct
  500. 57:43model to that like the correct query to that model then you will have a very token efficient type of uh agent harness.
  501. 57:52So you you can actually do model routing inside the agent harness.
  502. 57:56Some companies are actually essentially only doing that and they will charge you like let's do I'm going to charge you 10% of the tokens that I'm going to save you from the original
  503. 58:08uh amount of money that you were going to spend right uh so let's uh let me show you the the student notebook right so once you are inside the student notebook
  504. 58:20for those of you who are not familiar with Visual Studio Code you might need to select a kernel here so that you run the the notebook.
  505. 58:31So you might select Python 3.12 here and then you can just start reading.
  506. 58:37If you stumble into a to-do that you need to do, you have a docs folder with all the explanations, the individual explanations that you need to solve this specific problem.
  507. 58:49For instance, the first to-do which is just talking to the reasoning core to the model layer without doing anything else.
  508. 58:56It will just explain what you need to implement on that sale so that it works and you can proceed to the next one and also have the solution.
  509. 59:06But if you if you're not lazy, you will try and hope that you that you try and we will be here answering questions around the room.
  510. 59:17I'm gonna turn off my microphone, just come down with my colleagues and then let's chat about it uh for the remainder of the of the session.
  511. 59:27And if you have any questions or you like to talk um more to us, please come by and and swing by the booth, the Oracle booth.
  512. 59:36We'll be there every day uh all the time.
  513. 59:39And you know, it makes it makes us feel good like we are wanted and we have friends.
  514. 59:45So if you want to come up to us, just chat with us a little bit.
  515. 59:49It it will be nice.
  516. 59:55Internet.
  517. 59:55How is the internet?
  518. 60:10I feel like Cesar.
  519. 60:13Right.
  520. 60:21So, I'm gonna leave this here.
  521. 60:23I'm going to keep this here.
  522. 60:25And I'm going to come down.
  523. 60:45[music]