Open Reader

Memory-Aware Agent Harnesses for Anti-Money Laundering — Nacho Martinez, Oracle

completed 51:48 Oct 17, 2026 Watch on YouTube

Current Status

completed

Video ID

KtBivPzmOM8

RAG / Chat

Enabled
Memory-Aware Agent Harnesses for Anti-Money Laundering — Nacho Martinez, Oracle
Description

The model is the part you can't change. The harness around it is where you can make real gains. Nacho Martinez walks through the full agent stack (agent loop, short- and long-term memory, context engineering, the toolbox and skillbox patterns, skill distillation and continual learning) and applies it to an autonomous agent that flags suspicious bank transactions around the clock. 🎟️ Join us at the next one: AIE CODE Summit → https://aie.codes Speaker Nacho Martinez — LinkedIn: https://www.linkedin.com/in/jasperan/ GitHub: https://github.com/jasperan Oracle — https://www.oracle.com Workshop: https://workshopwaitingroom.com Timestamps 0:00 Workshop setup 2:07 Intro: Nacho Martinez 2:57 Agenda 4:57 The use case: an AML agent for a mid-sized bank 5:57 The agent stack 8:31 Agentic systems = automation + autonomy 9:16 What is an AI agent? 11:06 Why the harness matters more than the model 13:21 Files vs. databases 15:56 Agent memory: short-term, episodic, procedural, semantic 19:01 Context summarization vs. compaction 19:46 The agent loop 20:51 Toolbox & skillbox patterns 22:30 Skill distillation 24:15 How a frozen model gets better: continual learning 26:10 Instruction hierarchy 27:05 Workshop UI walkthrough 33:35 Q&A: Episodic memory & conflicts 34:35 Q&A: Skills, caching & context budgets 40:49 Q&A: Keep your memory layer simple 43:29 Q&A: Pre-built SQL vs. dynamic queries 46:14 Hybrid search (semantic + keyword) 47:39 Build small custom harnesses

Summary

Generated by gpt-5.6-terra

At-a-Glance

  • Verdict: Watch fully
  • Core thesis: For durable autonomous agents, performance and safety depend less on choosing a frontier model than on designing a task-specific harness that controls memory, context, tool access, retrieval, and the agent loop.
  • Why it matters: The session offers a reusable control-plane pattern for long-running, memory-aware agents—particularly relevant to financial operations, database-connected agents, and any system that must constrain costs, context growth, and unsafe autonomous actions.
  • Best use: Use it as an architecture review for Ken's agent harnesses: extract its patterns for dynamic context assembly, memory promotion, skill/tool retrieval, bounded loops, and database-safe action interfaces.

Executive Summary

Nacho Martinez argues that frontier LLMs are increasingly interchangeable reasoning engines; the durable competitive and operational advantage lies in the surrounding agent harness. He defines the harness as the controllable scaffolding for perception, tools, memory, retrieval, semantic context, instruction hierarchy, and the loop that repeatedly assembles context, reasons, acts, and observes results.

His core operating constraint is context degradation. A model does not inherently retain useful long-term memory, and he contends that performance falls as the active context grows—even when the model advertises a very large window. The proposed remedy is not to stuff every document, tool, conversation, and instruction into prompts, but to summarize or compact prior work, store it externally, and retrieve only task-relevant material at runtime.

The AML workshop grounds this in a medium-sized bank that autonomously investigates suspicious transactions, gathers evidence from databases and knowledge stores, and drafts or flags suspicious-activity findings for human review. The agent is deliberately not authorized to take irreversible actions such as blocking customers; autonomy is used for analysis and triage, while humans retain consequential decision authority.

The most useful implementation ideas are dynamic skill and tool discovery through embeddings, a small retrieval budget (three candidate tools/skills in the example), optional reranking, separate short-term and long-term memory, and use of databases where concurrent writes and transaction guarantees matter. The talk is conceptually repetitive and light on measured benchmarks, but it contains practical harness design choices directly applicable to agent control planes.

Key Takeaways

  • Claim: The agent harness—not the underlying frontier model—is the primary surface for improving agent reliability and task performance. | Evidence: Martinez defines the harness as the controllable layer around a largely frozen third-party LLM: tool use, memory, perception/inputs, storage, encoding and retrieval, semantic context, context engineering, and the agent loop. He states that the same model can perform better or worse on a task solely from a different harness configuration. | Implication: Treat model selection as one replaceable component of an agent platform; invest architecture effort in context assembly, memory, tool boundaries, and orchestration policies. | Caveat: This is presented as an architectural thesis rather than supported with comparative benchmark results in the session.
  • Claim: Long-running agents need external memory and aggressive context management because larger active context can reduce problem-solving quality as well as increase cost. | Evidence: The speaker distinguishes short-term memory (the current context window) from long-term episodic memory (past conversations, tool logs, and summaries), procedural memory (skills and workflows), and semantic memory (user preferences and implicit operating context). He says models perform worse when operating with 256,000 tokens already in context than from a near-empty state, despite advertised windows up to one million tokens. | Implication: Design memory as a selective retrieval system, not as a transcript archive injected into every prompt. Explicitly measure answer quality against context size, irrelevant-context rate, and loss introduced by summarization. | Caveat: The asserted universal relationship between shorter context and better performance is directionally useful but overstated; some tasks require substantial source context, so relevance and information preservation matter more than minimizing token count alone.
  • Claim: Use summarization and compaction as distinct mechanisms to keep an agent's working set small over extended runs. | Evidence: Summarization replaces prior conversation with a condensed account for the next interaction. Compaction stores chunks externally with identifiers, allowing the agent to retrieve a needed chunk later by ID and offset rather than retaining all content in the active prompt. | Implication: For autonomous runs, implement an explicit lifecycle for working context: retain immediate state, summarize durable conclusions, compact raw traces externally, and provide targeted recall rather than continual prompt accumulation. | Caveat: Both approaches can discard nuance or create retrieval failures if the summaries, chunk boundaries, identifiers, and recall triggers are poorly designed.
  • Claim: Tools and skills should be discovered dynamically rather than loaded wholesale into the prompt. | Evidence: Martinez notes that he has roughly 100 skills, each potentially 3,000-5,000 tokens, making blanket prompt inclusion impractical. In the workshop, separate vector stores hold tool and skill descriptions; the agent loop retrieves the three most relevant candidates for each request, with an optional reranker capable of selecting only the best one. | Implication: Build a capability registry with embeddings, metadata, permissions, and evaluation cases. Retrieve a small tool/skill set per task, then rerank or gate it before exposing it to the model. | Caveat: Semantic retrieval can select the wrong capability, and the workshop's k=3 retrieval policy is an example rather than a universally optimal configuration.
  • Claim: The agent loop is the control plane that should enforce budgets, iteration limits, context policy, and action dispatch. | Evidence: The described loop dynamically assembles context from skills, tools, prior conversations, files, and databases; calls the model for reasoning; executes actions; and repeats. The AML example caps the loop at eight iterations and 60 seconds of reasoning per iteration to prevent uncontrolled usage. | Implication: Centralize execution controls in the loop: token and spend budgets, wall-clock limits, tool-call ceilings, retry policies, approval points, trace logging, and explicit stop/escalation conditions. | Caveat: Hard limits prevent runaway cost but can terminate legitimate complex tasks before completion; stop conditions should reflect task progress and risk, not only iteration count.
  • Claim: Files and databases serve different harness functions; databases are preferable where agents require concurrent writes, consistency, or durable transactional state. | Evidence: Martinez contrasts a file-first approach with database maximalism and cites multiple agents writing to the same file as a consistency problem commonly worked around with worktrees. He argues that transactional ACID guarantees already solve the relevant class of concurrent-write problem. | Implication: Use files for large unstructured artifacts and databases for shared operational state, audit trails, task queues, customer/transaction data, and multi-agent coordination requiring correct concurrent behavior. | Caveat: The talk does not specify a full data model, access-control design, or latency/cost trade-offs for a production AML environment.
  • Claim: In high-consequence AML workflows, agents should autonomously investigate and recommend, while humans retain final authority over harmful or irreversible decisions. | Evidence: The workshop agent runs continuously against bank transaction data, searches evidence and knowledge spaces, invokes tools, and produces suspicious-activity outputs. Martinez explicitly contrasts flagging findings for later inspection with an agent unilaterally blocking a person or bank account. | Implication: For regulated or high-impact agent deployments, separate investigative autonomy from execution authority; make the output an auditable recommendation package rather than an unreviewed operational command. | Caveat: Human review alone is insufficient as a control unless findings are traceable, evidence-backed, prioritized, and subject to clear escalation and accountability procedures.

Detailed Brief

Memory architecture and continual learning options

  • Claims: A simple initial memory architecture can begin with just short-term and long-term stores rather than many specialized abstractions.; An agent can promote information from the active context into long-term memory as raw text, then later vectorize and retrieve it when a new query is sufficiently similar.; The speaker groups continual-learning approaches into parametric memory, representational memory, and non-parametric memory; the session concentrates on non-parametric approaches.
  • Evidence: The suggested recall stage sits between observation and reasoning: query long-term memory, compare similarity distance, inject relevant memory into context, and discard distant material.; Parametric techniques named include fine-tuning and low-rank adaptation; representational techniques include embedding work; the harness-focused approach uses externally stored memories, skills, and retrieved context.
  • Caveats: Memory-layer separation must be intentional: episodic history can confuse the agent if retrieval priority and instruction weight are not well designed.; The speaker recommends keeping memory entities and abstractions limited initially, but provides no formal retention, deletion, privacy, or provenance policy.
  • Implications: Start with a small, inspectable memory design and add types only when evaluation exposes a clear need.; For regulated systems, add governance beyond the workshop design: provenance, retention schedules, PII controls, correction paths, and evidence linking for every recalled memory.

Retrieval, prompt composition, and cost mechanics

  • Claims: Hybrid retrieval combines semantic/vector search with keyword search, aiming to preserve both conceptual similarity and exact-term matching.; The speaker identifies reciprocal-rank fusion (RRF) as a method for combining semantic and keyword search rankings.; A large share of an agent request may consist of tool specifications, retrieved documents, and tool outputs rather than the user's direct query.
  • Evidence: He says raw-file search tends toward keyword or regular-expression matching, whereas precomputed embeddings make skills discoverable by meaning across roughly 384 to 1,000+ dimensions.; He estimates tool outputs and retrieved documents can occupy 35,000-100,000 tokens, or roughly 80% of a request, while a user query may be only 100-1,000 tokens.; He states that provider semantic/prompt caching can reduce the effective cost of repeated static content such as recurring tool and skill definitions; he estimates the absence of caching could make such use four to five times more expensive.
  • Caveats: The token proportions and cost multiplier are speaker estimates, not provider-independent measurements.; Hybrid retrieval improves coverage but adds compute, operational complexity, and another relevance-tuning surface.
  • Implications: Instrument prompt composition by category—system/developer instructions, retrieved memories, tool schemas, tool outputs, and user content—rather than managing context as a single opaque token total.; Benchmark lexical, vector, and hybrid retrieval against real task outcomes before accepting added complexity.

MCP and domain-specific harness construction

  • Claims: MCP is most useful here as a controlled interface to external capabilities, rather than as a requirement for every memory or database problem.; For database interaction, a safer pattern is to expose pre-created, validated SQL queries rather than let the model invent dialect-specific SQL on every request.; Custom harnesses should be smaller and domain-specific rather than attempts to recreate a general-purpose coding agent such as Claude Code or Codex.
  • Evidence: Martinez cites SQL dialect differences across systems such as PostgreSQL, Oracle, and MySQL as a source of agent-generated query failures.; He proposes embedding externally hosted collections of MCP tools and skills so an agent can search them dynamically rather than placing all capabilities in every request.; The AML example uses a constrained, bank-specific harness with database connectivity, vector knowledge stores, investigation tools, and human-reviewed conclusions.
  • Caveats: Predefined SQL reduces hallucinated syntax but does not itself enforce least privilege, row-level access policies, parameter validation, or protections against malicious data and prompt injection.; The recommended 'start from scratch' approach may duplicate proven infrastructure unless teams distinguish domain-specific policies from commodity runtime components.
  • Implications: Expose narrow, parameterized, permission-scoped data operations to agents and keep a reliable audit record of every query and result.; Adopt an extensible core harness, but compose task-specific capability registries and policies for each domain instead of deploying one universal agent configuration.

Notable Concepts & Terms

  • Agent harness: The configurable scaffold around an LLM that determines memory, tools, inputs, retrieval, context policy, and execution behavior; presented as the main performance and reliability lever.
  • Agent loop: The recurring control cycle that assembles context, invokes model reasoning, dispatches actions, observes results, and decides whether to continue within configured budgets.
  • Episodic, procedural, and semantic memory: A proposed long-term-memory taxonomy: prior runs/logs and conversations; reusable skills/workflows; and persistent preferences or implicit facts, respectively.
  • Context summarization and compaction: Methods for limiting active prompt size: replace history with a summary, or store raw chunks externally and retrieve them later by reference.
  • Skill box / toolbox pattern: A dynamically retrieved capability library that keeps a large catalog of skills and tools out of the default context until task relevance is established.
  • Skill distillation: Converting successful prior agent runs or conversations into reusable skill artifacts, such as a skill markdown file, so a frozen model can improve operationally without weight updates.
  • Hybrid search and RRF: The combination of semantic embedding search and lexical keyword search, with reciprocal-rank fusion offered as a way to merge their rankings.
  • Instruction hierarchy: The differing priority assigned to system, developer/application, user, and tool/skill content; used to decide where durable policies versus plug-in capabilities should live.

Operator Notes / Why Ken Should Care

  • Run a harness audit on current agents: quantify baseline prompt tokens, tool-schema tokens, retrieved-document tokens, tool-output tokens, cache-hit rates, loop iterations, and spend per completed task.
  • Implement a capability registry that separates tool discovery from tool authorization; retrieve a limited candidate set, rerank if needed, and apply permission/risk gates before execution.
  • Define a memory promotion and recall policy before adding more memory stores: what is retained, who can access it, when it expires, how it is cited, and how incorrect memories are corrected.
  • For database agents, replace open-ended SQL generation with approved parameterized query/action interfaces, least-privilege credentials, result limits, and complete query audit logs.
  • For any financial, identity, or customer-impact workflow, require agents to produce evidence-linked recommendations and route irreversible actions through named human approval or deterministic policy controls.
  • Evaluate a minimal domain harness first rather than adapting a broad general-purpose agent; retain only the loop, memory, retrieval, and tool components that demonstrably improve the target workflow.

Source/Metadata

  • Title: Memory-Aware Agent Harnesses for Anti-Money Laundering — Nacho Martinez, Oracle
  • Transcript words: 12856
  • Duration seconds: 3108
  • Timestamp note: No usable timestamps or chapter markers were present in the supplied transcript; the transcript also contains substantial duplicated passages and a repeated extraction artifact.

Transcript

8079 words en Processed in 292.4s

Hi. Hi, everyone. Thank you for coming to this session. It's going to be a session about agent harnesses. We don't have a lot of time. It's only one hour session. So hopefully we have time to talk about a lot of things that you guys are interested in. And the session essentially is going to be me talking for 10, 15 minutes about topics that we're going to talk about and solve in the workshop. You have the workshop instructions in a QR code or in a website. And if you don't want to listen to me, you think I'm boring or something, you can start on your own on the workshop as I'm speaking. But essentially, this is what's happening on the website. You just sign up with your GitHub handle. And then you will automatically receive an invitation to the repository. The workshop is hosted on Codespaces. So you can just create a Codespace out of that. And you will receive an invitation automatically to get access to the workshop itself. And you just have to create a Codespace over there, opening GitHub Codespaces. And you're good to go and begin with the workshop. So I'll just put the QR code one more time for those of you who want to take that. And I'll get started. Okay. Perfect. If you have any questions, also, my colleague Richmond is over there. He's going to go through everyone's table. If you have any questions, just raise your hand and he can help out as well. Yeah. There you go. Also the website. You can go to the website workshopwaitingroom.com. I paid too much money for that domain. So use it. Okay. So who am I? My name is Nacho Martinez. I am an AI developer advocate and a data scientist by heart. And if you're interested in anything about me, just find me on YouTube. I have podcasts. I have workshops. I have everything. I am not going to go too much into myself. Just one thing, though. We recently released a course with Andrew Yang and Deep Learning AI about building adaptive AI agents, which is one of the subcomponents that we're going to talk about today. And if you're particularly interested in the things that you can do on a model to make it better and adapt over time, learn over time, just check out that course. It's a free course, a one-hour course that you can check out on Google. So what are we going to go through today? We don't have a lot of time, so I'm going to try to be quick. But these are the things that we're going to talk about. First of all, what is the agent stack? What are the components of an agent stack? What are the different shapes that an AI application can take? What an AI agent is. And what is the agent harness? What is the main motivation of building or working around agent harnesses rather than working with AI agents or with an LLM model directly? And all the subcomponents of an agent harness, such as memory, context engineering, memory engineering, and all these things. So because they told me that there's going to be a lot of people from financial, a lot of people that work on Wall Street, I adapted this workshop to be around a bank. So the idea is that the main premise of the workshop is this. We are hearing lots nowadays, for instance, OpenAI is launching 10,000 agents or 5,000 agents to solve this problem. 10,000 agents to solve this mathematical problem that wasn't solved for 100 years, 200 years. The thing is that these agents are autonomous. They don't have any human in the loop until they arrive at the conclusion or the answers. So the agents themselves don't have the capacity to do this. Why? Because the context window is limited. The memory components are something that a large language model doesn't have inherently. So all these things we need to implement ourselves to make these agents able to solve all these problems for 10 hours, 100 hours autonomously. So the idea is that a lot of people are making focus on, okay, we have these frontier models. But my idea is that we don't need to focus so much on the frontier models. We can use them, but let's work on the harness, which is the interesting part and the thing that you can actually customize more and more. So on this application, the idea is that it's a medium-sized bank that has lots of suspicious transactions sometimes. And they are categorized into five different types. So, for example, if you get a million-dollar transaction that's coming into your bank and automatically for three days you're making $50,000 withdrawals on an ATM. That's suspicious. Because why would you put $1 million in and then just distribute it like that? So the idea is that we have this medium-sized bank that has lots of transactions. And these transactions need to be autonomously decided or at least flagged so that a human that actually works in the bank needs to spend less time actually looking at these things. So let's go to the theory a little bit. What is the agent stack? When we talk with an AI agent, we typically are talking with the application layer, which is what we interact with, either an interface, a chatbot, a mobile application, etc. Then we have the model itself, which is the reasoning core. We don't get any say in what the decisions are. And then we have also the infrastructure that supports it all and then the compute. But what we are going to focus on today is the data part of it. And the data is very important because everything that we can manipulate and work around is on this part. The other parts we get less control over, especially if we're using a third-party model that isn't ours. So the data layer is what we focus on today. First of all, we have the agent loop. And this is arguably one of the most important parts of an AI agent. The agent loop is in charge of essentially driving the whole thing. And it's customizable as well. And inside the data, you also have a gateway and MCP so that you can connect it to third-party external data sources. You also have the memory layer, which we will talk about later. And essentially also some context engineering parts of it that let you automatically summarize and compact and shrink the working context window of a model. And finally, also some tools and skills, which we can do some interesting and intelligent stuff so that we can essentially keep the context window limited. This is one of the main ideas of the workshop. Now, typically the applications that we interact with are either a combination of these four. LLM chatbots, which are very easy. Lots of people just create an AI application, create a chatbot so that you can talk with it. You also have RAG applications, which is essentially a glorified vector search. And then you also have LLM-driven workflows and AI agents. And typically what most of us use, by the way, raise of hands who doesn't use AI agents like Cloud Code, etc. Of course. So Cloud Code, Codex, etc. All these systems are a combination of three and four, which is a combination of LLM-driven workflows that provide automation and AI agents that provide autonomy. So it's a combination of automation and autonomy. And these are called agentic systems. The better systems like Cloud Code, Codex, Py, OpenClaw, Hermes Agent, etc. They are all a combination of these two types. And most of the engineers that I talk to, and this is important, is that we use these systems every day. But a lot of people don't think about these problems when building their AI applications. So you might have an AI application, but then you don't consume it like this. And this is something that we're going to focus on today, because I think this is the better way of consuming AI applications. Not only through chatbots, not only through RAG applications, but also through a combination of automation and autonomy. So what is an AI agent? For those of you who don't know, it's a computational entity that is powered by an LLM, by reasoning, kind of like us humans have our brain. It's augmented by a database for memory, also like our brain. It's extended through tools for actions. So the equivalent of a human would be that we have our extremities, and we can interact with the world, just like an AI agent can interact with an operating system through the tools that we give it. And it's also grounded in inputs. So for instance, it would be our senses for a human, our eyes, etc., that let us perceive information. And the context, our attention, is also limited, like our agents. We can't watch seven movies at the same time. We will not understand any of the movies. We will not focus on any of them. So the context window for humans is similar to AI agents. And we try to assimilate or have some of these notions be closer to our human experience. And this is something that we'll work on today. It's augmented by a database for memory, also like our brain. It's extended through tools for actions. So the equivalent of a human would be we have our extremities, and we can interact with the world, just like an AI agent can interact with an operating system through the tools that we give it. And it's also grounded in inputs. So for instance, it would be like our senses for a human, our eyes, etc. that let us perceive information. And the context, like our attention, is also limited, like our agents. We can't watch seven movies at the same time. We will not understand any of the movies. We will not focus on any of them. So the context window for humans is similar to AI agents. We try to have some of these notions be closer to our human experience. And this is something that we'll work on today. So the reasoning part of it is provided by the Frontier Labs. And we don't get a lot of control over that. And then we also have the things that we do have a little bit more control over, which are the memory, the tool uses, and the perception. Right? And this is the harness itself. The harness is essentially all the scaffolding that you need to do to build these three components: the tool use, the memory, and the perception. And we're not going to focus too much on the model because, as I said, we don't have a lot of possibilities on what to do. Right? So the harness is actually one of the most interesting topics in AI. I think it's the most interesting topic in AI nowadays because these harnesses actually control everything that the AI agent can do. You give it a different configuration than the agent. The same LLM Frontier AI model that you're consuming becomes better or worse. Sometimes it's been proven that by just changing the harness, the same model performs better or worse for specific tasks. So it's really important to make focus on the harnesses. And not a lot of people are doing this. In a harness, there are seven different or eight different components if you consider continual learning as well. But there are lots of decisions that you need to make, right? You have the model. You have the storage, like where do you put the data. You have some encoding and retrieval components, like how do I make the distance between two vectors to actually retrieve the data properly? What do I store in my memory? Do I think of it as short-term memory plus long-term memory, like humans have? Do I think of it in different compartments or different types of memory? Do I have a memory? And then the semantic layer, which is a part that's really interesting because as humans, we are here and we have some context that we have never said to each other, right? But we are sharing this. For instance, I'm a speaker and you are listening. You are not singing right now. Why are you not singing? Because it's not appropriate in the semantics of the context that we are at right now, right? So the model itself also has access to the semantic layer, which talks a little bit about all the things that haven't been said to the model, but they are assumed. Also, the agent loop, which is all the things that drive and automatically and autonomously make the agent work all over again. And this is one of the most important parts and also context engineering. We'll focus on each of them, but I will not deep dive into them because we'll actually do that in the workshop. So just for reference, there was this big discussion around files versus databases. A lot of people were saying we need to use files for everything. Like you just put everything into a file and then magically one month later, the agent becomes better. Some other people are database maximalists and they want to put everything into a database, right? So this dilemma is still going on and I would say that, well, let me give you an example. Can anyone tell me in this example that you see on the screen, can anyone tell me what is the workaround that agents use to solve this specific problem that you're seeing on screen? Multiple agents writing to the same file. How does that work nowadays in AI agents? Any ideas? Work trees, exactly. Good. So work trees is the current solution, right? And this is a workaround because files have an inherent problem in themselves, which is that if multiple writes are coming into the same file, then you have problems with consistency. Like which write came first? If someone is reading, what do I do with this person that read the file before I modified it, etc. Lots of problems, right? So for some things, I will definitely tell you files are great. Files are great at storing lots of unstructured data. Database, on the other hand, is also used for some other types of use cases. But my solution is that for some cases, some of these solutions work with files. For some other cases, they work with databases. So we actually need to reconsider some of these things that are going on, right? And the work tree solution or the workaround has been already solved by databases 30 years ago. And we're trying to reinvent the wheel with some of this. And we don't actually need to reinvent anything because there is an actual solution to this. For example, if you're trying to write to a file at the same time multiple agents, if you have transactional consistency or ACID consistency, like atomic, consistent, isolated, and durable writes into the file, you would not get this issue, right? So files are good for some things, and databases are good for other things. We don't have to go into only one of them, right? So in the agent harness, just consider this as a thought. Another component is all the memory components, right? And this comprises all the mechanics and the systems that are created around an AI agent to make it use the information. And not only use this information, but also be able to refine it and recall it appropriately when it's time, right? And agent memory, as the engineers, you get to choose what are the things in your agent memory layer that you're going to consider? Some people like the short-term versus long-term memory. And in this case, this is part two. We have some short-term memory components. For example, if we are talking with Claude or with Codex, we have short-term memory in the sense that the context window itself is short-term memory. Anything that disappears after the conversation, right? Most things in the context window just vanish. Then you launch another conversation and it starts from zero. That's short-term memory. It's very limited. We cannot put everything into it. And then we also have long-term memory. And inside the long-term memory, we also have some categories that we propose. For example, episodic memory would be all the things that happened, all the episodes of our conversations, all the tool logs, the previous conversations, summaries of previous conversations that you've had with the agent, etc. They all go into this episodic long-term memory category. You also have procedures or procedural memory, which are all the things like skills, workflows, which are a sequence of skills that are being run, etc. All of those go into procedural memory. And also we have semantic memory, which is all the unsaid, as I said. The agent remembers who you are, what are your preferences, what's your favorite framework, etc. All these things go into semantic memory. So the problem, the main issue here, why cannot we put everything into the short-term memory? Because it's limited. And it's not only limited, but actually the bigger the attention matrix is, and the attention matrix is essentially the context window, the bigger it is, the worse it performs. And this happens for every model. There are lots of studies that have shown that if you start at zero tokens on the context window, the problem is being solved much more accurately than if you have 256,000 tokens already. And the limit is a million right now. We're at a million because of the KV cache. All these things need to be considered. And just know that even if the advertised limit stops at 256k or 1 million, if you keep going, the performance goes horribly. So the smaller the context window is, the better it will solve a problem. And this applies for every type of problem that you can think of in humanity. And there are two types of things that tackle this. One is context summarization, which you just ask it, hey, just generate a summary, a short summary for me with all the things that have been said in the context window, and then you get the summary, and then you start off from the summary the next conversation. That is fine. Another one is compaction. And that's similar, but in compaction, you're just putting chunks of the conversation into the database or into a file, and then you just put it with an ID. And if the AI agent needs it later, it has the ID. It just pulls from the ID with an offset, like reading from a file. Right? These are some of the problems that happen in context engineering. So the smaller the context window is, the better it will solve a problem. And this applies for every type of problem that you can think of in humanity. And there are two types of things that tackle this. One is context summarization, which you just ask it, hey, just generate a summary, a short summary for me with this, with all the things that have been said in the context window, and then you get the summary, and then you start off from the summary the next conversation. That is fine. Another one is compaction. And that's similar, but in compaction, you're just putting chunks of the conversation into the database, or into a file, and then you just put it with an ID. And if the AI agent needs it later, it has the ID. It just pulls from the ID with an offset, kind of like reading from a file. Right? These are some of the problems that happen in context engineering. And then we have the agent loop, which is the driver or the car that drives all the components that we have talked about. We have context assembly part that pulls from the skills, pulls from the tools, pulls from the previous conversation, from the files, from the database, all of these things, just brings into the context window dynamically. Then it does some reasoning. It makes an API call to OpenAI or whichever model you're talking to, and decides on what needs to be done. And this happens automatically and infinitely if you want. In my case, in this agent loop that we prepared for the workshop, it has a maximum patience, because I don't want to run out of OpenAI credits or any credits that I have. But the maximum number of iterations in our case will be eight, and a maximum of 60 seconds of reasoning for each one of the iterations. Right? But this is completely configurable. As engineers, we have to say in what goes on into the agent loop. Right? And also the toolbox pattern, the skill box pattern, what we propose for this, for storing tools and skills, which are hundreds. I don't know about you, but I have a hundred skills already installed. I'm not putting a hundred skills at the same time into the context window, because each skill is 3,000, 5,000 tokens. So that would automatically go over the advertised limit in no time. I would have no space for my actual conversation with the agent. So how do you fix that? Well, there are different ways, but what we propose is that you vectorize, you create vector embeddings out of the tools and out of the skills. And through those vector embeddings, once the agent loop wants to retrieve some useful skills or tools, you're going to do vector similarity search against this vector store that you have. You're going to pull the most relevant skill or tool to solve it. You solve the problem and then you offload it again. And that's one of the ways in which you keep the context window relevant in this sense. And using skills and using tools is a very common pattern. Everyone's using tools, a bash command or a change directory. All these are specific tools through bash, right? So we're using tools and skills constantly. This is, for some cases, more than 50% of the context window that's being used, right? So I just want you to be mindful of the vast amount of context window size that is actually being kept by the skills and by the tools. We also have this idea called skill distillation, where you take previous conversations, runs, and actual conversations that you've had with an AI agent, and then you try to create something meaningful out of that. How do you do that? Well, you can do it in several ways, but one of the easiest ways that you can do it is just create a skill MD and put it into the same skill box that you had everything before. And this is one of the ways, like, Hermes agent, one of the innovators in this sense, was creating skills that are particularly good to solve specific problems. Let's say that you're working on a frontend. Well, if you're working on frontend, you might want to create a skill that has worked very well for you with all your preferences, hey, I like this coloring style, etc. And the next time you work on the frontend, since you have created vector embeddings out of this, you can just the agent will automatically choose the more relevant skill. So if you just mention, hey, I like this coloring style that I had in this other skill, it's automatically going to know that you're referring to the new skill because you use the word coloring style, for instance. So skill distillation is one of the techniques that you can use to improve the learning of a model over time. And it's the same. This is related to what I was saying, is that you have dynamic skill discovery in the sense that the agent loop, when assembling or building the context, will pull the right skills and the right tools when it needs. And some people ask, how does a frozen model get better? And what I mean by frozen is that we don't get any control over the frontier models, right? But we do get control over all the data layer of it, right? And some people say, hey, let's modify the weights of the model. Some other people say, let's create an embedding model that works better for this specific problem. And then I'll worry about just retrieving the better embeddings there, etc. So there are different ways to do that. But the idea is that this is the main component of continual learning. And continual learning is one part of the things that you can do to make a model better. And there are three categories, right? You either work on the parametric memory. It's called parametric because it modifies the parameters of the weights of the neural network. You also have representational memory, which works with embeddings, etc. And you also have non-parametric memory, which is everything that we have spoken about today until this point. But if you're interested in any of these three, we have focused on the third one. You also have the other two. And I will not go into those two. There are lots of techniques like creating low rank adaptation, fine tuning a model, creating embeddings, etc. And all these things you can find in that course that I was referring to before, which focuses on the three categories. So if you're interested, just take that course or chat with us after the session. So after the session, we'll be in the event for the rest of the event too. Right? And last thing I want to mention is that all of the things that happen during a chat completions API call to any OpenAI model or anything that you're using is that there is an inherent instruction hierarchy. What do I mean by instruction hierarchy? There is a different weight on the things that are given to the model. For instance, what we used to interact with is the user, the request. In this sense, this is the third most important thing that we can pass to a model. The most important one is the system prompt. Everyone knows about the system prompt concept. And the system prompt is fine, but it cannot hold everything because otherwise things would not have a hierarchy in itself. You need to actually put some of the things in the system prompt, some of the things in the user prompt, and all the tools and the skills and the things that are made available, they have this hierarchy. And this is good because it actually lets us or lets the model focus more on some things than others. And we'll also go through that in the workshop. So just for reference, this is the UI of the workshop. So if you're running it in Codespaces already, you'll see that you have this deployed. I will go through it with you. But this is essentially the way in which I envision someone that works in AML, like a fraud detection system in a bank, interacts with an autonomous agent. The autonomous agent is running in the background 24-7. It doesn't sleep. It doesn't need any of the humanly necessities that we have. It's connected through a harness to a database. And it has all the functionalities that we have mentioned. But on top of that, it's autonomously making decisions for the company, even when we're offline. It's not ruining people's lives by just saying, hey, this guy is suspicious. Let's just block the whole bank and everything, because I would ruin the person's life. But rather, it's making these decisions and just printing them so that a human can actually inspect them later on. But it's going to save a lot of time during the discovery process, et cetera. So by the end of the workshop, if you complete it, you're going to be able to have an agent that connects to a database that is actually working as if it was any company. And it's going to do autonomous analysis and decision-making that then a human is going to take and interact with. So these are all the components that we have talked about, about the harness. And without further ado, I will put the QR code just again or workshopwaitingroom.com. And if you want to check out any of the other workshops that we have, you can just check out this GitHub repo. Let's block the whole bank and everything because I would ruin the person's life. But rather, it's making these decisions and just printing them so that a human can actually inspect them later on. But it's going to save a lot of time during the discovery process, et cetera. So by the end of the workshop, if you complete it, you're going to be able to have an agent that connects to a database that is actually working as if it was any company. And it's going to do autonomous analysis and decision-making that a human is going to take and interact with. So these are all the components that we have talked about regarding the harness. And without further ado, I will put the QR code at workshopwaitingroom.com. And if you want to check out any of the other workshops that we have, you can check out this GitHub repo. We're making a lot of progress and effort into all the things that go in there, everything from workshops, sessions, notebooks, so you can get started on different topics like agent harnesses, et cetera. So just check it out. And let me go to my Firefox and show you how this application works. So first of all, for those of you who didn't receive an invitation, if you go to workshopwaitingroom.com, you will get an invitation via the GitHub API with your user to this repository. So if you just go here and then open on GitHub Codespaces, it's going to ask you to create a Codespace. And of course, I'm paying for it, so don't worry about that. Just be careful with the hardware that you deploy because it's expensive. But the idea is that you will get a deployment like this with a couple of notebooks. And I'll show you the workshop itself. And then my idea is for me to step down in a couple of minutes. And then we'll go through the people who have questions, et cetera. And then we'll solve it together. Essentially making autonomous decisions and some of them it's saying, hey, this one is suspicious, let's add it to the list. And then afterwards you also get a way to visualize the context window of the agent here. You can also check out all the data that's already in the database here, like all the customers, et cetera. And also an autonomous way in which the agent is actually going to make an analysis of all this in real time. So it's going to run through the tool calls that we have available in our toolbox. Sorry, it's a little small. So it's going to go through the evidence, it's going to search for knowledge in the knowledge spaces that we created through vector stores, it's going to make a lot of tool calls, and finally it's going to go through the whole activity, suspicious activity reports automatically. And here is a fancy way of visualizing the 30 most recent events that happened in the back. But the workshop itself is this notebook, the notebookstudent.ipynb. And what I want you to do is first of all check out the different components that we have there because we are implementing them here. And I'm going to go through the first to-do. There are a couple of things that you need to do on the workshop just to confirm that you know what you're doing. So first of all, let me just go ahead and show you the first part of the workshop, right? You have this grok model 4.3 which is running on Oracle Cloud. And let's connect to the database, of course. And after, sorry, let me restart the kernel. Let me run this cell, restart. But yeah, let us know if you have any questions or issues when getting into the code space. And then I'll step down and do this with you and answer any questions. Any questions so far? Okay. Yes? The repo? Yes. You can find it on workshopwaitingroom.com. And let me just put the QR code in. So let me put the QR code here. If you want to scan it, this will automatically give you access to it via GitHub API. Okay. So let me reframe the question for the people who are on YouTube. So he's asking about what happens with the episodic memory and all these memory components. Does it get confused with previous conversations with an agent? Well, it depends on how much weight you give it. And this is why I was mentioning the instruction hierarchy as well. You might want to put this. If it's a really important thing and you actually want it to pull from some place or another place, you can actually decide your memory layer architecture yourself. So you might want to, for instance, in some cases where the episodic memory is really important and you actually want to pull from previous conversations, you might actually want to vectorize that rather than just save it as raw text. It depends a lot on the use case, I would say. In this case, there is no confliction there because we have a clear separation on the memory components of the architecture. Yes. So the skills can be added to the system prompt. They typically have a different... Yes. In the instruction hierarchy, they have the least weight out of the four. If you were to think about it, it's typically here. So it has the least weight. I would think of it as a plug and play place in which you can pull things. And we are experimenting with this, actually, Rismund and I, because we actually want to create a way in which you can plug into external or third-party skill hubs and tool hubs, for instance, a collection of MCPs that you can give your agent availability by pre-computing the embeddings of all of these things. And once you have these pre-computed embeddings, you can say, hey, do vector search against this third-party group of skills or group of tools. But rather than thinking of it as being included, and by the way, this is included in every OpenAI or every chat completions API request that you're making to OpenAI or any other model. This is attached at the bottom. And this typically is 80% of it, 80% of the whole request is tools and skills. But what happens, or why don't you get charged five times more than what you're charged now, is because OpenAI and all these systems have a semantic cache. And they put, if 80% of it was the same as the previous request, it doesn't recompute it. It just goes into the semantic cache. And this allows you, and this allows all of us, to have a way in which to consume the Frontier Labs models in an economical way. And of course, it's still very expensive. But what I want you to understand is that it would be four or five times more expensive if we didn't have the semantic cache that just puts the tools and these skills into it. Because in the response, remember that when you're interacting with a Frontier AI model, you're essentially making the whole thing through an HTTP request. And everything, like this would be, for example, 10k or 5k as a system prompt. You're an AI assistant and then you need to help me solve this, this and that. You have the developer, the specific app instructions, the user query, which is what we type in the chat, which is negligible, 100 tokens, 1,000 tokens maybe. And then the tool outputs and the retrieve docs, which is 80% of the request, 35 to 100,000 tokens. It's already this in every request. Does that answer your question? One last question. Yes. Okay. So his question was, how do you manage the budget? And since there are so many things in the skill box and the toolbox patterns, how do you essentially make this work? Right? We have a clear separation. The context window, we think of it as an n-dimensional matrix that starts at zero, but it's never zero. It's closer to 10,000. I was reading a paper that was comparing the efficiency of each harness on how much they put into the first system prompt and the first completions API request. The user query, which is what we type in the chat, is negligible—like 100 tokens, 1,000 tokens maybe. And then the tool outputs and the retrieve docs, which is 80% of the request, like 35 to 100,000 tokens. It's already this in every request. Does that answer your question? One last question. Yes. Okay. So his question was how do you manage the budget? And since there are so many things in the skill box and the toolbox patterns, how do you essentially make this work? Right? We have a clear separation. The context window, we think of it as an n-dimensional matrix that starts at zero, but it's never zero. It's closer to 10,000. I was reading a paper that was comparing the efficiency of each harness on how much they put into the first system prompt and the first completions API request. At the beginning, you know pi, the harness? That's the most minimalistic and the most efficient harness because it includes about 6,000 tokens at the beginning on every request. But if you go to other harnesses, they have more, like 30,000, 40,000 tokens. How do we have a clear separation? The context window, we just let everything go around the agent loop. Right? So let me go to the agent loop to show you one thing. The agent loop will control everything that it connects to. Right? So here, for example, the agent loop. Oh, I'm at the bottom. Hold on. Just as a reference, the agent loop. So here, right? The context assembly, when you're working with it, you will essentially build... And you can go through this in the notebook. Just explain the notebook. But the context assembly is one part that, first of all, we have a maximum number of defined tools or skills to retrieve. I think the default number is three. So every time a new request is coming, it's determining... And this is done by the model itself. It's determining what is the thing to do. Then it's going to try to assemble the context with the things that it needs to perform. Right? And one of these things is retrieving the three most relevant tools, the three most relevant skills. And we are not using a re-ranker, but what you could also do is at the end of the similarity search, you can also put an embedding model plus a re-ranker that will take those three and tell you, out of these three, this is the most important one out of the three. And you could actually have a better refinement out of that, because you might not want to have a total of three skills loaded for every task. The task might be solvable by only one. Right? So the idea is that you can put whichever strategy you want, just stick with it and stay consistent with it until the end. So the idea in this case, in the particular workshop, is that we have a total number of vector searches that we're doing against one vector store, which holds the tools, another vector store that holds the skills, k equals three, and then out of the three, you can retrieve the most relevant one with a re-ranker. And then it's going to dispatch the tools, of course, and build a context window. But this is entirely the decision and the job of the agent loop. Yep. Okay, so what is the most important or interesting way in which you can interact with the memory layer? The efficiency comes just from the number of entities that you create. Right? So my first recommendation would be just keep it simple. So don't create too many abstractions or too many components of the memory layer. So, for instance, try to experiment, first of all, with only short-term memory and long-term memory. And just have two structures. Right? If you think or if you have an agent that considers that something that was in the short-term memory or in the context window is worth keeping, you promote it to the long-term memory and you just put it somewhere as raw text. That's the easiest thing that you can do. Right? Once you have it in text somewhere else in a long-term memory or component or object, then you can take that, vectorize it, and then let it be explored by the agent loop in some way. So, for instance, here you would just have an extra thing in the middle of observing and reasoning that lets the agent recall memories or something. You can call it recall long-term memory. And this is going to make it be introspective before solving the problem once more. So it's going to go to your vector store or wherever you have this long-term memory episode that you recorded in a previous conversation. And from that, you can let it see, okay, I'm going to let it pull from it. If it considers it to be interesting or if the vector is similar, if the distance between the vector of the query and what I have in my long-term memory is relevant enough and the distance is small enough, then I will consider it into the context window. If it's too big or it's not relevant enough, then I will just discard it. So it will be like an additional abstraction between the observing and the reasoning part. There are ways. We are not doing MCPs right here, but one of the benefits of using MCPs would be to solve... I would say that MCPs not really that relevant in this case, but it depends on what you have in the database. So, for example, if you have a database, you're interacting with a database like we are doing right here, having an MCP is interesting. But one of the main problems that I like to say to people, what does an MCP solve, especially in the database because I'm a database guy because I work in Oracle. So, one of the things that you can solve is letting AI agents make SQL queries, but by not hallucinating or trying to come up with a new SQL query every time. This is one of the bigger problems that AI agents have with SQL. SQL has like 15 engines. Postgres, you have Oracle database, you have MySQL, you have lots of different queries that work on SQL, but they have specific hints or subtleties in the query that makes it not work well. So, the main problem that MCP solves in this case would be, okay, I'm going to pre-create some SQL queries and then let the agents access those. So those queries are proven to work rather than having an agent try to come up with a SQL query dynamically every time. Right? Mm-hmm. Yeah. Good question. Let me give you an example. So the most important thing would be the rapidness and that the meaning of the sentences and what the skill means itself rather than having it as text. And if you were to store this just as text in a file, right, in the operating system, then you would have lots of ways in which an agent can do regular expression matching. So, for instance, all the search would basically be either keyword search or word search based into that skill, which is fine. But the bigger that gets, the less, the harder it gets for an agent. First of all, regular expression matching like grep is inefficient for huge files. And sometimes if the file system grows and grows linearly, the performance of the regular expression matching decreases quadratically. But this is one of the problems, that it doesn't scale as well as the size of the files. Another one would be that if you pre-compute the embeddings of a skill, you're actually also capturing the meaning in these embeddings, the hidden meaning that we as humans cannot comprehend. But rather than just describing it in text, which is fine for us to read, it also has a pre-computation of 384 minimum to a thousand plus dimensions. And this embedding will actually hold things between each one of the tokens in the embedding matrix to be much more discoverable, for instance, by semantic search. And then this is what leads you to try hybrid search, which is a combination of semantic search, which is embeddings, plus keyword search. And this is called RRF, which is a type of hybrid retrieval. It performs much better because it will essentially just have both of them. And it will essentially, and this is, we can, I can show you the example in the workshop because I created this visualization here that explains exactly what I mean. With hybrid search, right, you see? Yeah. So, depending on the, this essentially is a plot that combines the search capability of keyword search plus semantic search. And this gap that you see at the middle is anything that's plotted here when doing hybrid search, it will be more relevant than any of the other two. So, as a summary, the more you can have two different types of search. Each one has its advantages, but if you combine them both, you will effectively do a little bit more compute, but then the quality of the retrieval will be better over time. These are, most of these, I'm thinking of it from the AI agent perspective. So I'm not expecting anyone from this room to just start building their own custom harnesses because we already have great solutions in the market, right? We have Claude, we have Codex, each one has their own preference. With hybrid search, right, so depending on the, this essentially is a plot that combines the search capability of keyword search plus semantic search. And this gap that you see at the middle is anything that's plotted here when doing hybrid search, it will be more relevant than any of the other two. So, as a summary, the more you can have two different types of search. Each one has its advantages, but if you combine them both, you will effectively do a little bit more compute, but then the quality of the retrieval will be better over time. These are most of these, I'm thinking of it from the AI agent perspective. So, I'm not expecting anyone from this room to start building their own custom harnesses because we already have great solutions in the market, right? We have CloudCo, we have Codex, each one has their own preference. By the way, a show of hands for who likes Pi? Okay, less than I expected, but good. So, I would say that I'm thinking of it as from the AI agent perspective. This, what I want you to understand is that you can build custom harnesses for specific problems. And building custom harnesses doesn't have to be as sophisticated as creating the new Cloud Code. And then you're running all of your work in that custom harness. Rather, let's simplify the problems that you're trying to solve and then build custom harnesses that attach onto that. So, in this case, I'm thinking of, if you're a consultant, you are my perfect use case, or my perfect user for this workshop, because you could be creating a custom harness that is working fine for a financial agent and has all the things that it needs to a financial use case. But then if you have another type of customer or with different types of data or with different types of constraints, if you want to solve the next Navier-Stokes problem or something, if those have different constraints. For instance, the OpenAI problems, the mathematical problems, they need an infinite, an automatic compaction or automatic context summarization, because these agents don't have any human in the loop in the middle. So, everything that goes around solving these problems has to have, by default, automatic context summarization. It also has to have infinite patience or near infinite patience. In this case, this agent loop is simplified to only eight steps maximum. All these considerations, right? Depends on the problem. Yeah, I would start from scratch, because that way you get to strip 90% of what you don't need. So, I would definitely, yeah. I mean, everything is built around the chat completions API, and both Anthropic and OpenAI have created their own standards to fight off against this, but everything goes around that API. So, if you just think of the way to communicate with a model just as an additional plug-in to the harness, it becomes much clearer that the smaller everything is, the better it is at the end. Does that answer the question? All right, so let's do this. You guys start with the code base, with the code space. Just set that notebook by yourselves, and then we're going to go. I'm going to go through and do a round, and if anyone has any questions, we can chat in a less aggressive way, because I feel observed, and you probably feel no pressure. So, I'm going to put the pressure on you by stepping off. And if you, yeah, let's keep going. I mean, we don't have a lot of time. Oh, my God. Time flew. But, yeah. Yeah, thank you. Thank you for the clap. Thank you. So, I felt like 15 minutes or 20 minutes went by, but one hour went by. So, one thing. So, I'm going to leave. I set this up so that you can create the code space in the hotel, at home. You can, I will pay for it myself. So, you can use this workshop and play with it as you wish, and I will pay for it. So, don't worry about it. Just, if you want to chat about some of the agent harness concepts, just come to the Oracle booth. We're going to be here until Wednesday evening. And thank you for coming to the session. Yep. Okay. But if you're interested in any of these three, we have focused on the third one. You also have the other two. And I will not go into those two. There are lots of techniques like creating low rank adaptation, fine tuning a model, creating embeddings, etc. And all these things you can find in that course that I was referring to before, which focuses on the three categories. So if you're interested, just take that course or chat with us after the session. So after the session, we'll be in the event for the rest of the event too. Right? And last thing I want to mention is that all of the things that happen during a chat completions API call to any OpenAI model or anything that you're using is that there is an inherent instruction hierarchy. What do I mean by instruction hierarchy? There is a different weight on the things that are given to the model. For instance, what we used to interact with is the user, the request. In this sense, this is the third most important thing that we can pass to a model. The most important one is the system prompt. Everyone knows about the system prompt concept. And the system prompt is fine, but it cannot hold everything because otherwise things would not have a hierarchy in itself. You need to actually put some of the things in the system prompt, some of the things in the user prompt, and all the tools and the skills and the things that are made available, they have this hierarchy. And this is good because it actually lets us or lets the model focus more on some things than others. And we'll also go through that in the workshop. So just for reference, this is the UI of the workshop. So if you're running it in Codespaces already, you'll see that you have this deployed. I will go through it with you. But this is essentially the way in which I envision someone that works in AML, like a fraud detection system in a bank, interacts with an autonomous agent. The autonomous agent is running in the background 24-7. It doesn't sleep. It doesn't need any of the humanly necessities that we have. It's connected through a harness to a database. And it has all the functionalities that we have mentioned. But on top of that, it's autonomously making decisions for the company, even when we're offline. It's not ruining people's lives by just saying, hey, this guy is suspicious. Let's just block the whole bank and everything, because I would ruin the person's life. But rather, it's making these decisions and just printing them so that a human can actually inspect them later on. But it's going to save a lot of time during the discovery process, et cetera. So by the end of the workshop, if you complete it, you're going to be able to have an agent that connects to a database that is actually working as if it was any company. And it's going to do autonomous analysis and decision-making that then a human is going to take and interact with. So these are all the components that we have talked about, about the harness. And without further ado, I will put the QR code just again or workshopwaitingroom.com. And if you want to check out any of the other workshops that we have, you can just check out this GitHub repo. We're making a lot of progress and effort into all the things that go in there, everything from workshops, sessions, notebooks, so you can get started on different topics like agent harnesses, et cetera. So just check it out. And let me go to my Firefox and show you how this application works. So first of all, let me just, for those of you who didn't receive an invitation, if you go to workshopwaitingroom.com, you will get an invitation via the GitHub API with your user to this repository. So if you just go here and then open on GitHub Codespaces, it's going to ask you to create a Codespace. And of course, I'm paying for it. So don't worry about that. Just be careful with the hardware that you deploy because it's expensive. But the idea is that you will get a deployment like this with a couple of notebooks. And I'll show you the workshop itself. And then my idea is for me to step down in a couple of minutes. And then we'll go through the people who have questions, et cetera. And then we'll solve it together. Each game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game game essentially making autonomous decisions and some of them it's saying, hey, this one is suspicious, let's add it to the list. And then afterwards you also get like a way to visualize the context window of the agent here. You can also check out all the data that's already in the database here, like all the customers, etc. And also an autonomous way in which the agent is actually gonna make an analysis of all this in real time. So it's gonna run through the tool calls that we have available in our toolbox. Yeah, sorry, it's a little small. So it's gonna go through the evidence, it's gonna search for knowledge in the knowledge spaces that we created through vector stores, it's gonna make a lot of tool calls, and finally it's gonna essentially go through the whole activity, suspicious activity reports automatically. And here is just a fancy way of visualizing the 30 most recent events that happened in the back. But the workshop itself is this notebook, the notebookstudent.ipymb. And what I want you to do is, first of all, just check out the different components that we have there because we are implementing them here. And I'm gonna go through the first to-do. There are a couple of things that you need to do on the workshop just to confirm that you know what you're doing. So first of all, let me just go ahead and show you the first part of the workshop, right? You have this grog model 4.3 which is running on Oracle Cloud. And let's connect to the database, of course. And after, sorry, let me restart the kernel. Let me run this cell, restart. But yeah, let us know if you have any questions or issues when getting into the code space. And then I'll step down and do this with you and answer any questions. Any questions, by the way, so far? Okay. Yes? The repo? Yes. You can find it on workshopwaitingroom.com. And let me just put the QR code in. So, let me just put the QR code here, this QR code, if you want to scan it. And this will automatically give you access to it via GitHub API. Okay. So, let me reframe the question for the people who are on YouTube. So, he's asking about what happens with the episodic memory and all these memory components. Does it get it confused with previous conversations with an agent? Well, it depends on how much weight you give it. And this is why I was mentioning the instruction hierarchy as well. You might want to put this, if it's a really, really important thing and you actually want it to pull from some place or the other place, you can actually decide your memory layer architecture yourself. So, you might want to, for instance, in some cases where the episodic memory is really important and you actually want to pull from previous conversations, you might actually want to vectorize that rather than just save it as raw text. It depends a lot on the use case, I would say. In this case, there is no confliction there because we have a clear separation on the memory components of the architecture. Yes. So, the skills can be added to the system prompt. They typically have a different... Yes. In the instruction hierarchy, they have the least weight out of the four. If you were to think about it, it's typically here. So, it has the least weight. I would think of it as a plug and play place in which you can pull things. And we are experimenting with this, actually, Rismund and I, because we actually want to create a way in which you can plug into external or third-party skill hubs and tool hubs, for instance, a collection of MCPs that you can give your agent availability by pre-computing the embeddings of all of these things. And once you have these pre-computed embeddings, you can just say, hey, do vector search against this third-party group of skills or group of tools. But rather than thinking of it as being included, and by the way, this is, of course, included in every OpenAI or every chat completions API request that you're making to OpenAI or any other model, this is attached at the bottom. And this typically is like 80% of it. Like 80% of the whole request is tools and skills. But what happens, or like why don't you get charged like five times more than what you're charged now, is because OpenAI and all these systems, they have a semantic cache. And they put, if 80% of it was the same as the previous request, it doesn't recompute it. It just goes into the semantic cache. And this allows you, and this allows all of us to have a way in which to consume the Frontier Labs models in an economical way. And of course, it's still very expensive. But what I want you to understand is that it would be four or five times more expensive if we didn't have the semantic cache that just puts the tools and these skills into it. Because in the response, like, remember that when you're interacting with a Frontier AI model, you're essentially making the whole thing through an HTTP request. And everything, like this would be, for example, 10k or 5k as a system prompt. You're an AI assistant, and then you need to help me solve this, this and that. You have the developer, like the specific app instructions, the user query, which is what we type in the chat, which is negligible, like 100 tokens, 1,000 tokens maybe. And then the tool outputs and the retrieve docs, which is 80% of the request, like 35 to 100,000 tokens. It's already this in every request. Does that answer your question? One last question. Yes. Okay. So his question was, like, how do you manage the budget? And since there are so many things in the skill box and the toolbox patterns, like how do you essentially make this work? Right? We have a clear separation. The context window, we think of it as an n-dimensional matrix that starts at zero, but it's never zero. It's closer to like 10,000. I was reading a paper that was comparing the efficiency of each harness on how much they put into the first system prompt and the first completions API request. At the beginning, you know pi, the harness? That's the most minimalistic and the most efficient harness because it includes about 6,000 tokens at the beginning on every request. But if you go to other harnesses, they have more, like 30,000, 40,000 tokens. How do we have a clear separation? The context window, we just let everything go around the agent loop. Right? So let me go to the agent loop to show you one thing. The agent loop will control everything that it connects to. Right? So here, for example, the agent loop. Oh, I'm at the bottom. Hold on. Just as a reference, the agent loop. So here, right? The context assembly, when you're working with it, you will essentially build... And you can go through this in the notebook. Just explain the notebook. But the context assembly is one part that, first of all, we have a maximum number of defined tools or skills to retrieve. I think the default number is three. So every time a new request is coming, it's determining... And this is done by the model itself. It's determining what is the thing to do. Then it's going to try to assemble the context with the things that it needs to perform. Right? And one of these things is retrieving the three most relevant tools, the three most relevant skills. And we are not using a re-ranker, but what you could also do is, like, at the end of the similarity search, you can also put an embedding model plus a re-ranker that will take those three and tell you, out of these three, this is the most important one out of the three. And you could actually have a better refinement out of that, because you might not want to have a total of three skills loaded for every task. The task might be solvable by only one. Right? So the idea is that you can put whichever strategy you want, just stick with it and stay consistent with it until the end. So the idea in this case, in the particular workshop, is that we have a total number of vector searches that we're doing against one vector store, which holds the tools, another vector store that holds the skills, k equals three, and then out of the three, you can retrieve the most relevant one with a re-ranker. And then it's going to dispatch the tools, of course, and build a context window. But this is entirely the decision and the job of the agent loop. Yep. Okay, so what is the most important or interesting way in which you can interact with the memory layer? I mean, the efficiency comes just from the number of entities that you create. Right? So my first recommendation would be just keep it simple. So don't create too many abstractions or too many components of the memory layer. So, for instance, try to experiment, first of all, with only short-term memory and long-term memory. And just have two structures. Right? If you think or if you have an agent that considers that something that was in the short-term memory or in the context window is worth keeping, you promote it to the long-term memory and you just put it somewhere as raw text. That's the easiest thing that you can do. Right? Once you have it in text somewhere else in a long-term memory or component or object, then you can take that, vectorize it, and then let it be explored by the agent loop in some way. So, for instance, here you would just have an extra thingy in the middle of observing and reasoning that lets the agent recall memories or something. You can call it recall long-term memory. And this is going to make it be introspective before solving the problem once more. So, it's going to go to your vector store or wherever you have this long-term memory episode that you recorded in a previous conversation. And from that, you can let it see, okay, I'm going to let it pull from it. If it considers it to be interesting or if the vector similar, like if the distance between the vector of the query and what I have in my long-term memory is relevant enough and the distance is small enough, then I will consider it into the context window. If it's too big or it's not relevant enough, then I will just discard it. So, it will be like an additional abstraction between the observing and the reasoning part. There are ways. We are not doing MCPs right here, but one of the benefits of using MCPs would be to solve... I would say that MCPs not really that relevant in this case, but it depends on what you have in the database. So, for example, if you have a database, you're interacting with a database like we are doing right here, having an MCP is interesting. But one of the main problems that I like to say to people, like what does an MCP solve, especially in the database because I'm a database guy because I work in Oracle. So, one of the things that you can solve is letting AI agents make SQL queries, but by not hallucinating or trying to come up with a new SQL query every time. This is one of the bigger problems that AI agents have with SQL. SQL has like 15 engines. Postgres, you have Oracle database, you have VSQL, you have lots of different queries that work on SQL, but they have specific hints or subtleties in the query that makes it not work well. So, the main problem that MCP solves in this case would be, okay, I'm going to pre-create some SQL queries and then let the agents access those. So, those queries are proven to work rather than having an agent try to come up with a SQL query dynamically every time. Right? Mm-hmm. Yeah. Good question. Let me give you an example. So, the most important thing would be the rapidness and that the meaning of the sentences and what the skill means itself rather than having it as text. And if you were to store this just as text in a SQL file, you would be able to, sorry, in a file in the file system, right, in the operating system, then you would have lots of ways in which an agent can do regular expression matching. So, for instance, all the search would basically be either keyword search or like word search based into that skill, which is fine. But the bigger that gets, the less, like the harder it gets for an agent. First of all, regular expression matching like grep is inefficient for huge files. And sometimes if like the file system grows and grows linearly, the performance of the regular expression matching decreases exponentially. Well, not exponentially, quadratically, let's say just quadratically. But this is one of the problems, that it doesn't scale as well as the size of the files. Another one would be that if you pre-compute the embeddings of a skill, you're actually also capturing the meaning in these embeddings, the hidden meaning that we as humans cannot comprehend. But rather than just describing it in text, which is fine for us to read, it also has a pre-computation of 384 minimum to a thousand plus dimensions. And this embedding will actually hold things between each one of the tokens in the embedding matrix to be much more discoverable, for instance, by semantic search. And then this is what leads you to try hybrid search, which is a combination of semantic search, which is embeddings, plus keyword search. And this is called RRF, which is a type of hybrid retrieval. It performs much better because it will essentially just have both of them. And it will essentially, and this is, we can, I can show you the example in the workshop because I created this visualization here that explains exactly what I mean. With hybrid search, right, you see? Yeah. So, depending on the, this essentially is a plot that combines the search capability of keyword search plus semantic search. And this gap that you see at the middle is anything that's, that's plotted here when doing hybrid search, it will be more relevant than any of the other two. So, as a summary, the more like, the more, like, the more you can have two different types of search. Each one has its advantages, but if you combine them both, you will effectively do a little bit more compute, but then the quality of the retrieval will be better over time. These are, like most of these, I'm thinking of it from the AI agent perspective. So, I'm not expecting anyone from this room to just like start building their own custom harnesses because we already have great solutions in the market, right? We have CloudCo, we have Codex, each one has their own preference. By the way, a show of hands for who likes Pi? Okay, less than I expected, but good. So, I would say that I'm thinking of it as from the AI agent perspective. This, what I want you to understand is that you can build custom harnesses for specific problems. And building custom harnesses doesn't have to be as sophisticated as creating the new Cloud Code. And then you're running all of your work in that custom harness. Rather, let's simplify the problems that you're trying to solve and then build custom harnesses that attach onto that. So, in this case, I'm thinking of, you know, if you're a consultant, you are my perfect use case, or my perfect user for this workshop, because you could be creating a custom harness that is working fine for a financial agent and has all the things that it needs to a financial use case. But then if you have another type of customer or with different types of data or with different types of constraints, if you want to solve the next Navier-Stokes problem or something, you know, if those have different constraints. For instance, the OpenAI problems, the mathematical problems, they need an infinite, an automatic compaction or automatic context summarization, because these agents don't have any human in the loop in the middle. So, like everything that goes around solving these problems have to have, by default, automatic context summarization. It also has to have infinite patients or near infinite patients. In this case, this agent loop is simplified to only eight steps maximum. All these considerations, right? Depends on the problem. Yeah, I would start from scratch, because that way you get to strip 90% of what you don't need. So, I would definitely, yeah. I mean, everything is built around the chat completions API, and both Anthropic and OpenAI have created their own standards to fight off against this, but everything goes around that API. So, if you just think of the way to communicate with a model just as an additional plug-in to the harness, it becomes much clearer that the smaller everything is, the better it is at the end. Does that answer the question? All right, so let's do this. You guys start with the code base, with the code space. Just set that notebook by yourselves, and then we're going to go. I'm going to go through and do a round, and if anyone has any questions, we can chat in a less aggressive way, because I feel observed, and you probably feel no pressure. So, I'm going to put the pressure on you by stepping off. And if you, yeah, let's keep going. I mean, we don't have a lot of time. Oh, my God. Time flew. But, yeah. Yeah, thank you. Thank you for the clap. Thank you. So, I felt like 15 minutes or 20 minutes went by, but one hour went by. So, one thing. So, I'm going to leave. I set this up so that you can create the code space in the hotel, at home. You can, I will pay for it myself. So, you can, you know, use this workshop and play with it as you wish, and I will pay for it. So, don't worry about it. Just, if you want to chat about some of the agent harness concepts, just come to the Oracle booth. We're going to be here until Wednesday evening. And thank you for coming to the session. Yep. Okay.