Pular para o conteúdo

Lembrança total: memória de agents e engenharia de harness — Ignacio Martinez, Oracle

Ver no idioma original →

Autoria: AI Engineer · Assistir no YouTube

Vídeo de autoria do canal indicado, não da IANIA; todos os direitos pertencem ao criador. Transcrição, resumo e tradução gerados automaticamente; o conteúdo no idioma original é preservado na versão em idioma original.

Idioma original: inglês

Vídeo original: Total Recall: Agent Memory and Harness Engineering — Ignacio Martinez, Oracle · Canal: AI Engineer · 1:00:20 · Assistir no YouTube

Tópicos: Agentes de IA, Dados, bancos de dados e embeddings, Engenharia de prompts e contexto, RAG, busca e recuperação de informação

Ignacio Martinez apresenta o agent harness como a camada que, ao redor do modelo, ajuda a produzir resultados confiáveis e repetíveis. Ele percorre sete componentes do harness, com destaque para armazenamento híbrido em arquivos e bancos de dados, engenharia de memória, camada semântica, agent loops e gestão de contexto. Também explica tipos de memória e como skills e workflows podem ser refinados e reutilizados para promover aprendizado contínuo sem alterar os pesos do modelo. Na parte prática, demonstra um workshop que monta um harness progressivamente e mostra uma aplicação com ferramentas, rastros de execução e janela de contexto.

  • Um AI agent é apresentado como um modelo somado a um harness, que oferece memória, ferramentas e percepção.
  • O harness busca tornar mais confiáveis e repetíveis os resultados de modelos não determinísticos.
  • O palestrante recomenda combinar arquivos e bancos de dados, aproveitando as características de cada um.
  • A memória de agents pode ser de curto prazo, longo prazo ou compartilhada, conforme o tipo de informação e seu uso.
  • A context window pode sofrer context rot quando acumula informações demais, por isso o contexto deve permanecer relevante e conciso.
  • A camada semântica reúne conhecimentos tácitos e institucionais que não são explicitados em cada interação.
  • Toolbox e skillbox permitem disponibilizar ferramentas e skills no contexto quando são necessárias.
  • O aprendizado contínuo pode ocorrer por meio de mudanças nas representações, no contexto e nas skills, sem necessariamente alterar os pesos do modelo.
  • O workshop constrói um harness em etapas e demonstra seu funcionamento com uma aplicação que exibe ferramentas, chamadas e rastros do agent.
Início Capítulo Resumo
00:12 Instruções e agenda do workshop Martinez explica como acessar o repo e antecipa uma introdução seguida da atividade prática.
03:22 Apresentação e visão do agent stack O palestrante apresenta sua experiência e descreve as camadas de uma aplicação de IA, destacando a importância dos dados.
06:30 A camada de dados e as formas das aplicações de IA A apresentação situa o agent harness na camada de dados e compara chatbots, aplicações RAG, workflows e agents.
09:05 O que é um AI agent Martinez define um agent como um LLM acompanhado de um harness que fornece memória, ferramentas e percepção.
13:48 Os componentes do agent harness O palestrante introduz componentes como armazenamento, engenharia de memória, camada semântica, agent loops e engenharia de contexto.
16:26 Arquivos, bancos de dados e armazenamento híbrido A palestra compara as vantagens e limitações de arquivos e bancos de dados e propõe combinar os dois.
21:34 Embeddings, busca e RAG Martinez descreve o fluxo de criação de embeddings, busca vetorial e reranking, além de mencionar a integração LangChain OracleDB.
25:45 Tipos de memória e context rot O palestrante explica memórias de curto prazo, longo prazo e compartilhadas, e alerta para a perda de relevância em contextos extensos.
30:57 Oracle Agent Memory Package e context cards A apresentação mostra como o OAMP reúne informações de conversas em context cards para orientar o modelo.
34:04 Camada semântica e conhecimento tácito Martinez descreve a camada semântica como a lente do agent, que inclui conhecimentos institucionais não explicitados.
36:40 Agent loops e montagem do contexto O palestrante apresenta o agent loop e padrões para carregar tools e skills no contexto apenas quando necessário.
38:44 Aprendizado contínuo e promoção de skills A palestra aborda formas de melhorar o comportamento do agent ao longo do tempo, incluindo a promoção de skills e workflows reutilizáveis.
41:50 Preparação do workshop prático Martinez orienta os participantes a acessar o repo e iniciar um GitHub Codespace para acompanhar a atividade.
48:08 Construção do harness e demonstração da aplicação Os participantes começam com uma chamada simples ao modelo e avançam para uma aplicação que mostra contexto, tools e rastros de execução.
55:38 Limites de tentativas e roteamento de modelos Em resposta a perguntas, Martinez comenta limites para chamadas de ferramentas e a possibilidade de encaminhar tarefas a modelos diferentes.

Um AI agent é essencialmente um modelo mais um harness. — 10:08

O objetivo da engenharia de harness é criar resultados confiáveis e previsíveis, repetidamente. — 11:11

Minha sugestão é que, como um sistema híbrido funciona melhor, usemos memória de curto prazo em arquivos e promovamos informações importantes para um espaço mais estruturado, como um banco de dados. — 21:01

Você quer manter a context window tão pequena quanto possível para evitar context rot. — 29:55

Minha opinião pessoal é que o futuro é uma mistura de pequenos especialistas para cada tipo de problema. — 57:11

  • Ignacio Martinez (pessoa): Palestrante da Oracle que apresenta conceitos de memória de agents e agent harnesses.
  • Oracle (empresa): Empresa em que Ignacio Martinez trabalha e cujos produtos de banco de dados e IA são apresentados.
  • Andrew Ng (pessoa): Pesquisador e educador com quem Ignacio Martinez lançou um curso sobre memória de agents.
  • agent harness (conceito): Camada de componentes ao redor do modelo que fornece recursos como memória, ferramentas e controle de contexto para apoiar resultados confiáveis.
  • agent memory (conceito): Conjunto de mecanismos que permite a um agent reter, reutilizar, refinar e recuperar informações.
  • Oracle Agent Memory Package (OAMP) (ferramenta): Pacote gerenciado da Oracle apresentado para lidar com operações de memória, como resumir conversas e montar context cards.
  • Oracle DBFS (ferramenta): Sistema de arquivos de banco de dados da Oracle, apresentado como forma de armazenar arquivos com recursos de banco de dados.
  • LangChain OracleDB (ferramenta): Integração citada para inserir, pesquisar e recuperar dados em vector stores.
  • OCI Generative AI service (ferramenta): Serviço gerenciado da Oracle usado no workshop para fornecer inference a modelos.
  • MCP (conceito): Camada de conexão mencionada para ligar um LLM a dados, ferramentas e programas externos.
  • context rot (conceito): Degradação da atenção e da relevância do contexto à medida que mais conteúdo é acumulado na context window.
  • toolbox pattern (conceito): Abordagem para organizar e recuperar ferramentas de modo que sejam incluídas no contexto quando necessário.
  • HNSW (conceito): Estrutura de índices vetoriais citada para tornar eficiente a recuperação de ferramentas em grandes conjuntos.

00:12 Olá, olá. Perfeito. Sim. Então, perfeito. É, esse volume está perfeito. É só um site cujo domínio registrei no sábado, apenas para fazer a inscrição no workshop. Mas, para quem vai acompanhar comigo, saibam que, depois de concluírem esse processo durante o workshop, vocês receberão um convite para o repositório. É só visualizar o convite e aceitá-lo,

00:42 e então vocês poderão fazer o workshop. Vamos realizá-lo no GitHub Codespaces. Então, se quiserem iniciar o ambiente, isso leva uns 5 minutos. Só para dar uma ideia, vou usar os primeiros 30 minutos para apresentar o agent harness e vários outros conceitos; depois, na próxima hora e meia, vamos fazer o workshop juntos. Tudo bem? Certo, perfeito. E, aliás, obrigado por estarem aqui, porque sei que é

01:14 segunda-feira, 9h. Então, admiro todos vocês por estarem aqui. >> Só mais 2 minutos antes de começarmos, então vou ficar quieto.

03:22 >> Certo. Bom, vamos começar, pessoal. Obrigado por estarem aqui comigo neste horário. Sei que são 9h, como eu disse, então espero que eu e minha equipe consigamos fazer valer o tempo de vocês. Ao final desta sessão, gostaria que vocês saíssem com algum conhecimento sobre memória de agentes e agent harnesses, e sobre como criar o próprio agent harness, que hoje em dia é um dos temas mais quentes da IA, eu diria.

03:55 Muita gente fala constantemente sobre modelos, mas o fato é que os modelos, como os modelos de linguagem, são a parte congelada do raciocínio, certo? Só precisamos aceitar o que nos é oferecido. E, nas últimas semanas, se vocês têm acompanhado as notícias, viram que isso nunca foi tão verdadeiro quanto agora. Então, vamos falar sobre o harness. Para quem não estava aqui, vocês podem escanear este QR code ou acessar

04:26 o site workshopwaitingroom.com e fazer a inscrição. Vocês receberão um convite para um repo no GitHub. Nesse GitHub, poderão criar um GitHub Codespace, onde faremos o workshop. E tudo já estará configurado para vocês. Então, só uma breve apresentação sobre mim. Trabalho na Oracle há 7 anos. Sou developer advocate há cerca de quatro anos.

04:56 E vocês podem encontrar minhas palestras e, sabe, também sou bastante ativo no GitHub. Então, se vocês usam o GitHub, deem uma olhada no meu perfil, se quiserem. Qual é o destaque da minha carreira até agora? Lancei um curso com Andrew Ng sobre memória de agentes. Então, se tiverem interesse nos componentes de memória do que vamos discutir hoje, podem conferir esse curso, se quiserem. Estas são as coisas que vamos

05:27 discutir hoje, certo? Primeiro, faremos uma breve introdução sobre o que é a pilha de agentes; depois, vamos nos aprofundar na camada de dados, onde fica a memória. Em seguida, vamos explorar um pouco as formas, os diferentes formatos que as aplicações de IA assumem atualmente, o que é um agente, e depois as sete camadas diferentes que compõem um agent harness. Então, seguindo essas sete estruturas diferentes, vocês poderão

05:58 criar um agent harness, um agent harness mínimo ao qual vocês podem conectar qualquer modelo. Por fim, vamos falar um pouco sobre aprendizado contínuo e sobre como nós, na Oracle, estamos em uma posição única para ajudar vocês a criar e desenvolver agent harnesses e aplicações de IA. Então, a pilha de agentes. E, aliás, [limpa a garganta] se tiverem alguma pergunta, é só levantar a mão. Ficarei muito feliz em responder também. Então, a pilha de agentes.

06:30 A pilha de agentes: todo agente de IA se apoia nessas cinco camadas. Temos uma aplicação, que é a superfície do produto, certo? Aquilo com que interagimos como usuários. Temos os dados, que incluem muitos componentes: memória, conhecimento, recuperação, codificação, busca. Temos o próprio modelo, o grande modelo de linguagem de raciocínio que está por trás de tudo. Temos a infraestrutura, que é a orquestração. Qual modelo servimos,

07:01 dependendo do esforço de raciocínio de que precisamos e de coisas assim. E então temos a computação, que inclui a nuvem ou GPUs, além do mecanismo de banco de dados. Essas quatro camadas — aplicação, modelo, infraestrutura e computação —, ao contrário dos dados, estão se tornando cada vez mais comoditizadas. O que quero dizer com isso? Estão tentando tirar a complexidade dessas camadas do nosso

07:31 domínio, certo? Então, aquilo sobre o que temos mais controle ao trabalhar com aplicações de IA são, na verdade, os dados. E é nessa parte que vamos entrar, porque o agent harness se destaca e, sabe, está muito ligado à camada de dados. Então, vamos nos concentrar na camada de dados. É nela que aparece um agent harness. E ela tem muitos componentes. O primeiro componente é o gateway e

08:02 o MCP. É interessante porque é isso que conecta um agent harness aos dados e às ferramentas. Então, pensem em um grande modelo de linguagem como algo isolado, que não conseguiria funcionar de jeito nenhum se não tivesse acesso a coisas como dados, certo? Depois, temos a camada de memória, a camada semântica, a camada de recuperação, a camada de contexto e as ferramentas e

08:33 skills construídas sobre a camada de gateway e MCP. Vamos supor, por exemplo, que vocês tenham uma aplicação no computador e que o grande modelo de linguagem não tenha acesso a ela. Por exemplo, o Outlook. Certo? Se quiserem conectar o grande modelo de linguagem a ele, podem criar um MCP, especificar algumas funções e, de repente, o LLM consegue se comunicar com esse programa. Então, gateway e MCP são a camada que conecta um grande modelo de linguagem ao

09:05 mundo externo ou, na prática, ao nosso computador ou ao ambiente em que vocês estiverem trabalhando. E hoje em dia as aplicações de IA assumem quatro formatos diferentes, certo? Temos chatbots de LLM, que são muito passivos. Eles só respondem quando fazemos uma pergunta. Também temos aplicações RAG, que são semipassivas porque precisam fazer algum tipo de processamento em segundo plano, mas também têm uma natureza passiva. E então

09:36 temos os componentes mais ativos das aplicações de IA, que são os que usamos no dia a dia. Como o Cloud Code etc., que combinam workflows orientados por LLM, que oferecem automação, e agentes de IA, que oferecem autonomia. Mais adiante, vamos explicar o que quero dizer com isso. Mas, primeiro, quero que vocês tenham uma definição bem clara do que é um agente de IA. Para mim, um agente de IA é essencialmente um modelo

10:08 — um grande modelo de linguagem — mais um harness. O próprio modelo é responsável pelo raciocínio, e todo o resto é o harness. Então, a definição é mais ou menos assim: uma entidade autônoma cujas funções cognitivas são viabilizadas por um grande modelo de linguagem para raciocinar. Elas são ampliadas por um banco de dados ou arquivos que servem como memória, estendidas por ferramentas para realizar ações e fundamentadas em entradas que permitem

10:39 que ele perceba o ambiente. Então, um agente é um modelo mais o harness. Se o agente é o modelo mais o harness, neste diagrama temos o raciocínio. E o raciocínio é a parte que não controlamos. É a parte que é fortemente subsidiada, a parte que alugamos. Se vocês forem como eu, assinam todas as assinaturas imagináveis da Terra. E essa é a

11:11 parte que não controlamos, certo? Não temos controle algum sobre o que nos é oferecido. E então temos memória, ferramentas e percepção, que, na verdade, conseguimos personaliz… Então, o objetivo da engenharia de harness é criar resultados confiáveis e previsíveis repetidamente. Já um modelo de raciocínio é muito não determinístico. Podemos dar a ele a mesma entrada e

11:42 podem produzir resultados diferentes todas as vezes, certo? Então, eu disse que, sabe, nas aplicações de IA mais comuns hoje em dia, como Claude Code, Codex e qualquer outro tipo que você consiga imaginar, há uma combinação de automação e autonomia. Por quê? Bem, porque a automação traz confiabilidade para um sistema, e a autonomia dá flexibilidade. E essa é uma combinação muito

12:12 conveniente quando estamos desenvolvendo por conta própria. A propósito, levantem a mão: quem trabalha como engenheiro de IA ou desenvolvedor de IA? Meu Deus, certo. Ótimo. Então, todos vocês devem ter usado um desses sistemas, certo? Todos eles têm algo em comum: autonomia e flexibilidade. É, então a ideia é que esses sistemas, certo? Eles são construídos

12:44 sobre um agent harness proprietário. E um agent harness não é nada além de tudo o que falamos sobre um agent de IA. Todas as coisas que você precisa fazer em torno dele para permitir que produza resultados confiáveis e repetíveis, certo? Então, o modelo em si é não determinístico. A mesma entrada, resultados diferentes todas as vezes. Mas, com o harness, o que queremos fazer é transformar essa natureza não determinística de um grande

13:14 modelo de linguagem e conseguir produzir resultados confiáveis e repetíveis. Então, não vamos nos concentrar no raciocínio, que é a parte que não controlamos. Na verdade, os harnesses são construídos sobre modelos que podem ser trocados. Você só precisa de uma interface comum, como um protocolo da OpenAI ou a especificação de API da Anthropic, certo? Todas essas coisas permitem que a parte do modelo seja trocada, e o harness é no que vamos nos concentrar hoje.

13:48 Então, são sete elementos que compõem um agent harness. Como eu disse, não vamos abordar a camada do modelo, porque não temos controle sobre ela. Mas vamos analisar cada um desses elementos um pouco mais detalhadamente, certo? Você precisa de uma camada de armazenamento no seu agent harness que determine essencialmente onde os dados vão ficar, onde a memória fica armazenada fisicamente. E vamos ver esse dilema que vem se prolongando há cerca de seis

14:20 meses sobre arquivos versus bancos de dados. E por que acho que uma combinação híbrida dos dois é, na verdade, a melhor opção. Você também tem componentes de engenharia de memória, que são todos os componentes de codificação, busca e recuperação. E também a camada semântica, que é meio que o conjunto de coisas ocultas que acontecem, ou o vocabulário oculto que presumimos que um grande modelo de linguagem conhece, algo que é específico das nossas

14:51 empresas ou do nosso conhecimento. Aquilo que não dizemos ao LLM. Isso é, de certa forma, a camada semântica. Vamos falar brevemente sobre os loops de agent, o que é um loop de agent e como implementar um loop de agent bem, bem minimalista. E, por fim, vamos abordar algumas técnicas de engenharia de contexto que, sabe, mantêm a janela o mais relevante possível, a context window o mais relevante possível. Você quer minimizar a context window o máximo possível para que a tarefa que está resolvendo continue relevante.

15:24 Até aqui, fizemos uma introdução sobre o que é um agent de IA, certo? Seus casos de uso. Agora vamos nos aprofundar em um agent harness e em cada um dos componentes individuais. Então, a camada do modelo, certo? O núcleo de raciocínio congelado. Digo que é congelado porque, em geral, os pesos de um modelo não mudam. Digo “em geral” porque, na verdade, estou em processo, com Cassius sentado bem ali, de

15:55 gravar um novo curso com Andrew Ng sobre aprendizado contínuo para agents de IA. Então, se tiver interesse, confira daqui a algumas semanas. Mas o fato é que, em 99,9% do tempo, você terá um modelo cujos pesos nunca vão mudar. A menos que tenha milhões de dólares ou, sabe, muito tempo ou GPUs, é muito difícil mudar os pesos de um modelo. Então, há outras maneiras de afetar o raciocínio sem realmente mudar os pesos do

16:26 modelo. Mas essa é a motivação para a parte sobre aprendizado contínuo que veremos no workshop. Onde a memória fica armazenada, certo? O dilema entre arquivos e bancos de dados com que temos lidado, meio que desde janeiro. Algumas pessoas são muito maximalistas em relação a arquivos, e alguns de nós… Não vou me incluir nisso. Mas algumas pessoas também são maximalistas em relação ao banco de dados. E, sabe, os dois lados têm razão.

16:56 Arquivos têm características convenientes, assim como os bancos de dados. Então, os arquivos, certo? São muito fáceis de… eles são muito… combinam com os instintos dos modelos. São muito fáceis de criar. É muito fácil inserir e acrescentar dados a arquivos, certo? É algo de natureza muito… muito não estruturada. E, por outro lado, os bancos de dados, ou a ideia que as pessoas têm deles, é que têm uma estrutura muito rígida, certo? Mas isso é quando você está

17:28 pensando em SQL, como SQL. E, na verdade, você não precisa escolher um ou outro. Pode usar os dois. Arquivos são atraentes porque os modelos falam essa linguagem e funcionam muito facilmente com sistemas operacionais. Seguem a semântica POSIX, então são compatíveis com Debian, Ubuntu e qualquer outro sistema operacional que você queira. E

17:58 também têm algumas desvantagens. Por exemplo, não têm consistência transacional. Esse é um dos problemas de que eu queria falar. Se você é um degenerado como eu e está trabalhando, sei lá, com oito, 16 ou 32 agents ao mesmo tempo, o problema é que os arquivos não podem ser modificados e receber inserções ao mesmo tempo. Então, qual é a solução atual para não ter consistência transacional

18:30 e trabalhar com arquivos? Alguma sugestão? Worktrees, exatamente. Então, quando os agents querem modificar um arquivo, mas outro agent está trabalhando nele, eles simplesmente criam uma worktree diferente, certo? Fazem todo o progresso na worktree e, depois que a implementação é concluída, fazem o merge para master, ou para main, desculpe. Então, essa é uma solução alternativa para

19:00 a falta de consistência transacional, certo? E também há outras características, como, por exemplo, a busca híbrida. Isso não está disponível em arquivos, mas é muito fácil de obter em bancos de dados. Também não há backups. Então, se o seu sistema operacional for corrompido ou algo assim, você simplesmente perde tudo. E essas são coisas que os bancos de dados resolveram há 35, 40 anos, e as pessoas meio que se esqueceram disso. Então, o que eu

19:30 quero fazer é oferecer a vocês meio que o melhor de cada uma das implementações, certo? Vocês podem ter as vantagens dos arquivos e as vantagens dos bancos de dados no mesmo lugar. E vamos ver por quê. Mas estas são algumas das vantagens, certo? Você tem consistência ACID. Ou seja, operações atômicas, consistentes, isoladas e duráveis. Você tem alta disponibilidade. Pode replicar o banco de dados e deixá-lo, sabe, em três lugares diferentes do

20:01 mundo, com um fator de replicação. Você também tem busca vetorial, que é muito fácil. Com arquivos, você só tem correspondência por expressão regular ou algo derivado disso. E, sabe, muitas outras coisas. Então, no workshop propriamente dito, vamos executar um exemplo real de tentativa de modificar um arquivo com três agents diferentes trabalhando no mesmo arquivo e tentando

20:31 atualizar um contador nesse arquivo. E vamos ver quem é mais rápido. Eu sei a resposta, claro, mas vocês vão descobri-la mais tarde. Mas o que quero apresentar a vocês é algo chamado Oracle DBFS, ou sistema de arquivos do banco de dados, onde você pode armazenar arquivos dentro do banco de dados em um sistema de arquivos. E isso dá a você, sabe, muitas das vantagens que mencionamos. Você terá arquivos com consistência transacional ACID. Você

21:01 terá busca vetorial, relações, segurança, alta disponibilidade etc., certo? E minha sugestão é que, como um sistema híbrido funciona melhor, podemos ter coisas como, por exemplo, memória de curto prazo, certo? Que fica em arquivos. E, quando algo precisa ser promovido a memória de longo prazo, por exemplo, preferências do usuário e coisas assim, pode ir para um espaço mais estruturado, como um banco de dados. E é isso que vamos fazer no workshop.

21:34 Para a codificação, a busca e a recuperação, que eram outros componentes do agent harness, também temos uma integração com o LangChain que quero mencionar, chamada LangChain OracleDB, que facilita muito inserir dados em bancos de vetores, fazer buscas no banco de vetores e recuperar dados dele. Também temos outra coisa chamada embeddings no banco de dados. Já ouviram falar de embeddings no banco de dados? Sim? Certo. Então, embeddings no banco de dados são muito

22:06 convenientes, especialmente para clientes corporativos, porque o modelo de embedding fica dentro do banco de dados. Assim, quando você gera embeddings, não precisa chamar um serviço de terceiros. Isso é muito conveniente para fins de isolamento, retenção de dados e segurança dos dados. Então, é assim que seria um modelo de busca de embeddings e reranqueamento em uma interface de chatbot, por exemplo, certo? Você tem muitos documentos e, então, usa uma espécie de

22:37 bi-encoder. Um bi-encoder é essencialmente um modelo de embedding. Você cria embeddings a partir desses documentos. Divide-os e cria vetores, que coloca em um banco de vetores, certo? Depois, recebe um prompt do usuário, uma consulta do usuário, uma pergunta. Você também pode criar um embedding a partir disso e, então, compará-lo com o que já tinha no banco de vetores. É assim que você obtém os vetores mais relevantes em uma resposta. Depois, executa um

23:07 cross-encoder, que é um reranqueador, e analisa a pergunta junto com o resultado. É assim que as perguntas são respondidas em aplicações de RAG, certo? Também vamos abordar essas coisas brevemente no workshop. E o fato é que, sabe, imagine essa aplicação de RAG desde o início. A partir dos documentos, você faz muitas coisas, certo? Faz a tokenização e, depois, cria os embeddings. É preciso fazer coisas

23:40 como deduplicar os dados, normalizá-los, remover informações de identificação pessoal e muitas outras coisas, certo? E, no seu armazenamento, você tem dados textuais dos documentos. Tem metadados, que geralmente são armazenados em JSON. Tem vetores, representados como embeddings densos de 32 bits. Há tantos tipos de dados com que você precisa trabalhar que, normalmente, o que as pessoas fazem, por exemplo, é — não

24:11 sei. Não vou citar nomes para não me meter em encrenca, mas, sabe, talvez você precise de bancos de dados diferentes para cada uma dessas coisas, certo? Entendem o que quero dizer? Então, hoje em dia, há uma sobrecarga muito alta de lógica de sincronização de dados para engenheiros de IA e até mesmo para agents, certo? É preciso fazer muita manutenção e muito trabalho de engenharia. E é isso que queremos evitar. Então, o que quero que vocês façam

24:42 hoje é simplesmente nos experimentar como Oracle. Experimentem nosso banco de dados. Oferecemos suporte a todos os tipos de dados imagináveis em que vocês conseguirem pensar. Somos chamados de banco de dados convergente. Somos o único banco de dados convergente do mercado que oferece suporte a JSON, dados relacionais, dados espaciais, grafos, JSON, qualquer coisa em que vocês conseguirem pensar; poderão criar isso conosco. E terão um único mecanismo de banco de dados, uma única interface de consulta e

25:14 uma única stack de desenvolvimento. Tudo ficará no mesmo banco de dados. Também para fins de segurança dos dados, vocês só precisam proteger e manter todos os dados em um só lugar. Assim, só precisam se preocupar com um único vetor de ataque. Não precisam se preocupar em atualizar cinco bancos de dados diferentes. Só precisam se preocupar em proteger um banco de dados. Então, podemos ser o mecanismo das suas aplicações de IA, e não apenas uma etapa isolada,

25:45 que é o que as pessoas pensam quando trabalham com bancos de dados, certo? Sim. Então, a memória de agent. A memória de agent é essencialmente uma descrição de todos os mecanismos e sistemas que permitem a um agent reter, reutilizar, refinar e recuperar informações. Queremos reutilizar os dados e refiná-los nesse processo. Mas queremos reutilizar os dados para que, da próxima vez que um agent ou

26:18 nós, como engenheiros, trabalharmos em um problema que levou três horas, na próxima vez que nos depararmos com esse problema, ele fique mais fácil, seja para os agents de IA, seja para nós. A memória de agent tem muitos componentes, certo? Temos memória de curto prazo, memória de longo prazo e memória compartilhada, que é algo relativamente novo. Essa memória compartilhada é mais ou menos o que acontece quando um subagent se comunica com seu agent pai, por exemplo,

26:49 ou quando dois agents tentam colaborar para resolver juntos um problema específico. E o que quero que vocês percebam é que, dependendo do tipo de memória ou do tipo de coisa que queremos armazenar, ela ficará em um lugar ou em outro, certo? A memória de curto prazo é mais ou menos efêmera, dura muito pouco e é útil para coisas que estão acontecendo agora. Por exemplo, a lista de tarefas de um agent de programação, certo? Ela é relevante agora,

27:20 mas, na verdade, você não quer salvá-la a longo prazo. Mas há coisas como, por exemplo, a memória episódica: conversas anteriores que você teve. Isso é muito útil, por exemplo. Não sei se vocês usam Claude. Algumas pessoas aqui usam Claude. No Claude, vocês podem pegar as conversas anteriores e tentar refinar todos os seus workflows e skills com base nas coisas que fizeram no passado. Então, faz

27:51 sentido salvar isso a longo prazo, certo? Também há coisas como a memória procedural: workflows anteriores que funcionaram muito bem para o seu sistema. Por exemplo, você trabalhou neste frontend e criou um design muito bonito de que gostou. Pode pegar a conversa toda e transformá-la em um workflow que possa ser repetido e reutilizado. Assim, da próxima vez que estiver trabalhando em um frontend, os resultados serão parecidos com os anteriores, certo? Então, essas são as coisas que vamos

28:22 ver no workshop. E algumas pessoas dizem: “Certo, por que eu precisaria de tudo isso?” São pessoas que têm muita animosidade em relação à memória de agent. Elas dizem: “Certo, vamos simplesmente colocar uma context window de 15 milhões de tokens.” Embora isso ainda não seja possível, algumas pessoas realmente acreditam que esse é o caminho, certo? Mas a context window é um tipo de memória de curto prazo. Então, é útil para algumas coisas, mas não para todas. E um dos problemas que acontecem

28:53 quando se trabalha com um contexto é algo chamado deterioração do contexto, ou degradação do contexto ao longo do tempo. O que acontece é que, quanto mais coisas você coloca na context window, menos atenção haverá para cada uma delas. Então, no início de uma conversa — e esse é um problema bem conhecido da context window —, o agent se mantém muito mais no assunto porque

29:24 você acabou de começar a conversa. Por exemplo, na escola, certo? Ou se eu estiver conversando com você, posso conversar com você por 30 minutos, e sua atenção a mim será muito, muito alta porque acabei de começar a falar. Mas, se a conversa durar oito horas, você vai querer me dar um soco, certo? Porque eu não parei de falar, e, no fim, você quase não aprendeu nada. O problema é que a atenção, assim como para nós, seres humanos, é muito limitada. Então, quanto

29:55 mais coisas você coloca na context window, mais a matriz de atenção da rede neural também se degrada, e ela cresce de forma quadrática, porque a matriz de atenção, sabe, é essencialmente uma referência de um token para cada outro token na context window. Portanto, quanto maior a context window, maior fica a matriz, tanto no número de linhas quanto no de colunas, o que é um problema. Então, você quer manter a context window tão pequena quanto possível para evitar a deterioração do contexto. E a engenharia de memória, os componentes da engenharia de memória, é como projetar, construir e fazer tudo o que envolve criar memória de agent para agents de IA. E queremos reter, recuperar, reutilizar e refinar esses dados de alguma forma. Então, é uma disciplina, certo? E aqui temos Valentin, por exemplo, e temos pessoas da Oracle,

30:27 que estão no workshop. E algumas pessoas dizem: “Certo, por que eu precisaria de tudo isso?” São pessoas que têm muita animosidade em relação à memória de agent. Elas dizem: “Certo, vamos simplesmente colocar uma context window de 15 milhões de tokens.” Embora isso ainda não seja possível, algumas pessoas realmente acreditam que esse é o caminho, certo? Mas a context window é um tipo de memória de curto prazo. Então, é útil para algumas coisas, mas não para todas. E um dos problemas que acontecem

30:57 meus colegas espalhados pela sala. Então, se vocês os virem, podem dar oi. Valentin está aqui; ele está trabalhando, ou trabalhou, no desenvolvimento deste pacote de memória para agents. Então, se tiverem alguma dúvida sobre isso, podem perguntar a ele. O OAMP, ou Oracle Agent Memory Package, é a solução gerenciada que temos na Oracle para muitos dos problemas que vocês encontrarão ao trabalhar com esse tipo de dado. Por exemplo,

31:28 como engenheiro, se você não tiver uma solução gerenciada, precisará tomar muitas decisões. Precisa decidir: quando faço a compactação de contexto? Quando faço um resumo? Como escrevo o summarizer? O que mantenho? O que não mantenho? O que extraio das conversas anteriores e quando? Quantos tokens uso para esse problema? E muitas outras coisas desse tipo, certo? Com o OAMP e o Oracle Agent Memory

31:58 Package, você pode fazer tudo isso em uma única linha de código. E queremos facilitar as coisas para reduzir a carga cognitiva dos engenheiros de IA e também dos agents de IA. Com esse recurso de cartão de contexto, você terá algo como o que vê à esquerda. E isso é uma espécie de explicação do que cada parte faz. Mas, essencialmente, os tópicos que vocês veem, por

32:29 exemplo, podem ser criados a partir de qualquer conversa, gerando um cartão de contexto com base no thread ou na conversa. Os tópicos orientarão o modelo. O resumo compactará o thread e indicará a intenção atual de um agent de IA. E as informações relevantes têm três partes: os fatos, as preferências e as memórias associadas a essa conversa. Depois, vocês têm as memórias episódicas, que registram explicitamente a

33:01 pergunta não respondida que está em aberto no momento. E as mensagens recentes fornecem um contexto local para o modelo. Então, sempre que você estiver em dúvida sobre o que fazer agora com os dados que tem ou com essa conversa, pode usar o pacote Oracle Agent Memory em Python, e tudo é montado com uma única chamada. Sim. >> Então, você não está sugerindo que isso vá diretamente para o modelo. Na verdade, isso é usado pelo harness

33:32 >> Exatamente. >> para controlar o que entra no modelo. >> Sim. Sim. >> E esse é o componente de que você está falando, que a Oracle usa. Ele conhece a estrutura e usa essa estrutura para… >> Exatamente. Exatamente. Essa estrutura é uma abstração que construímos sobre o modelo, porque, na maioria dos casos, não temos controle sobre ele, certo? A questão é que podemos construir sobre isso quaisquer abstrações que quisermos para fazer o modelo se comportar da forma mais confiável possível. Isso.

34:04 Então, a memória e a camada semântica trabalham juntas, de certa forma. Sei que falamos apenas sobre os componentes de memória. Vou apresentar rapidamente a camada semântica, os componentes semânticos dela, porque não tenho muito tempo, certo? E a camada semântica é o significado do que acontece por trás disso, aquilo que você meio que presume que está acontecendo, certo? Alguém aqui é da Alemanha? Certo, peço desculpas pela pronúncia, mas vou tentar. Então,

34:36 Umwelt é como o ambiente de um modelo, e esse termo foi cunhado por Jakob von Uexküll. E esse sujeito disse que, essencialmente, todo organismo vivo no mundo percebe a realidade por meio de uma lente. E essa lente é aquilo a que ele tem acesso. Nós, humanos, por exemplo, temos os olhos e os sentidos, certo? Então, tudo o que percebemos e tudo o que vivemos, todas as nossas experiências, são vistos

35:07 por meio dessa lente, certo? E um agent não tem sentidos como os humanos. Mas também tem uma espécie de camada semântica, ou lente semântica, pela qual tudo o que você pede a ele é filtrado. E essa lente é, essencialmente, aquilo com que você o treina e também o contexto que você fornece. Então, tudo aquilo de que você fala com o agent, certo? Quando você fala com o agent, ele observa isso por meio da Umwelt.

35:39 E a camada semântica é, essencialmente, a Umwelt do agent. Quero me concentrar no que não é dito. Por exemplo, o conhecimento organizacional ou o conhecimento empresarial. São coisas que você não menciona quando trabalha com um colega, porque já são conhecidas por você e por ele. Não é preciso especificar tudo em que vocês trabalham todos os dias. Mas, se houvesse outra pessoa, como uma criança, que quisesse começar a trabalhar com você, [limpa a garganta] você teria de especificar tudo com muitos detalhes. Esses são todos os elementos não ditos, e é isso que a camada semântica captura. Então, o não dito é o verdadeiro conhecimento tribal que uma empresa tem, certo? Também inclui o conhecimento institucional, como a forma como os dados são modelados, como as consultas são executadas e quais são os metadados. Todas essas coisas fazem parte da camada semântica. E, rapidamente,

36:10 só para vocês saberem, também vamos implementar um agent loop bem minimalista. E um agent loop é como o driver do modelo, certo? Ele permite que o modelo seja meio independente e autônomo. É o que faz um modelo… transforma um modelo em um agent, certo? E este é o agent loop mais simples que vocês podem encontrar. É essa parte de observar, raciocinar e depois agir

36:40 que acontece o tempo todo, o tempo todo. E ele precisa resistir a falhas para que nunca saiamos do loop. Essa é a ideia. Você dá autonomia ao agent. Bem, você dá autonomia ao modelo para que ele se torne o agent. E, na parte de engenharia de contexto, que é a última das sete camadas de um agent harness, há também muitas coisas que você pode fazer. Por exemplo, o padrão toolbox

37:11 e o padrão skillbox, que vamos abordar também no workshop. Essas são maneiras de armazenar as ferramentas e skills disponíveis para um modelo, para que sejam recuperadas de forma otimizada. O que você quer é recuperar as ferramentas e as skills somente quando forem realmente necessárias e colocá-las na context window apenas quando necessário. A cada iteração do agent loop, você verá se este é realmente o lugar

37:43 certo e, se não for, poderá simplesmente removê-las temporariamente. Então… Ah, desculpe. Achei que tinha visto uma pergunta. Vamos ver tudo isso no workshop. Não quero tomar tempo demais. Mas a ideia é montar o contexto a cada iteração do agent loop. E o aprendizado contínuo é a parte sobre a qual falamos antes: a capacidade de melhorar com o tempo com as coisas que fizemos com o

38:13 modelo, certo? Então, como vimos, um modelo congelado não melhora, certo? Mas há maneiras de fazer um agent melhorar nos pesos, que é a parte em que vamos trabalhar. Na parte de representação, ou seja, em embedding e re-ranking, e também na context window. Esses são os três tipos de técnicas de aprendizado contínuo. No workshop, vamos nos concentrar no contexto e

38:44 no espaço de tokens, porque é uma das opções mais fáceis e também uma das menos caras. Imagino que ninguém aqui seja milionário, ou que não haja muitos milionários entre nós. Portanto, essa também é a maneira mais viável e realista de mudar o comportamento do modelo ao longo do tempo. Então, sem mais delongas, quero apresentar esta parte: promoção de skill e promoção de workflow, workflow

39:14 promotion. Então, essas skills ou esses workflows em que você trabalhou por 3 ou 4 horas, certo? Você passou o dia inteiro trabalhando em um workflow. Conseguiu realizar seu trabalho com sucesso e, então, essas coisas podem ser recuperadas. Elas podem ser armazenadas nos componentes de memória que veremos. Depois, vamos falar sobre promoção de skill. Por exemplo, se promovermos uma skill, podemos promovê-la por meio de um processo de destilação e

39:45 promoção. Então, essas skills ou esses workflows que você fez durante 3 ou 4 horas, certo? Você passou o dia inteiro trabalhando em um workflow. Conseguiu fazer seu trabalho com sucesso, e então essas coisas podem ser recuperadas. Elas podem ser armazenadas nos componentes de memória que veremos. Depois, veremos a promoção de skills. Então, se promovermos uma skill, por exemplo, podemos promovê-la por meio de um processo de destilação e

40:16 criar um skill.md melhor que o original. Então, vamos aposentar a versão antiga e atualizar para a nova. Isso nos permite fazer algum tipo de aprendizado contínuo com nossas próprias skills, transformando-as em skills mais personalizadas para nós, para o nosso tom, nosso jeito de trabalhar e nossas preferências. Por exemplo, vamos usar esta biblioteca específica porque gosto muito da aparência e da experiência de uso dela. Vamos usar este

40:48 mecanismo de banco de dados específico porque tem menos bugs ou porque achei mais fácil trabalhar com ele. Todas essas coisas podem ser promovidas a skills reutilizáveis e aprimoráveis ao longo do tempo. Então, é assim que todo o harness ficaria no final do fluxo de trabalho. Desculpem, no final do workshop. E espero que vocês saiam daqui hoje entendendo melhor todos os componentes específicos que compõem um agent

41:18 harness. Então, deixa eu mostrar isto aqui antes que eu me esqueça. Se vocês tiverem interesse no pacote de memória de agent da Oracle ou estiverem trabalhando nele, temos um servidor do Discord onde podem conversar diretamente com a nossa equipe. Se vocês usam o Discord, fiquem à vontade para entrar nesse servidor. Também vou colocar o link mais tarde. Mas, sem mais delongas, vamos começar

41:50 o workshop propriamente dito, e vou explicar como. Primeiro, deixa eu mostrar o que vamos construir, certo? Este é um notebook. Ah, desculpem. Vocês não estão vendo isto. Sim. Isso. As instruções do workshop, certo? Para quem não estava aqui,

42:20 basta acessar este site, se cadastrar com sua conta do GitHub e, então, vocês receberão um convite como este para um repo do GitHub. A partir daqui, vamos criar um GitHub Codespace. Então, por favor, façam isso agora. Meus colegas estão espalhados pela sala para responder a quaisquer perguntas que vocês tenham durante a criação do Codespace etc. Sim. Isso.

42:55 A internet? Vocês estão tendo problemas com a internet? Certo, vamos ver. Vocês estão usando a mesma rede Wi-Fi que eu? A rede Wi-Fi ai.engineer? Certo. Alguém pode ajudar as pessoas com o Wi-Fi, se possível? Sim. Por favor, quem puder, conserte o sistema. Façam isso. Eu não consigo, não consigo.

43:28 Sim. Sim. Meus colegas vão dar uma olhada nisso, se… Certo. Sim. Sim, isso sempre acontece, sabem? Sim.

44:00 Certo. Pode repetir, senhor? Sim, eles vão para o… acredito que vão para o AI Engineer. Então, se vocês acessarem a sessão, vou me certificar de ir até lá. Se não, se vocês entrarem no Discord ou em qualquer outro lugar, também podem me mandar uma mensagem no LinkedIn. Terei prazer em enviar os slides, se quiserem. Certo.

44:30 Equipe de vídeo, podem me ligar? Desculpem, podem me colocar no ar, por favor? Ah, perfeito. Obrigado. O que eu gostaria de mostrar é que também criamos, além do notebook que vamos percorrer, este app book. Com ele, vocês podem testar cada um dos componentes individuais de um agent harness

45:02 individualmente, certo? Só para mostrar que isso é possível. E ele também será implantado automaticamente no GitHub Codespaces. Então, vocês já vão ter isto implantado. E podem pensar: “Como faço requisições?” Vamos fazer requisições para a Oracle… Ah, não. Que chato. Hora da demonstração. A ideia é que

45:32 Sim, certo. Sei o que está acontecendo. Perdi a conexão com meu Codespace por inatividade. Deixa eu reiniciá-lo. Este app book vai permitir que vocês criem, conversem e interajam com todo o agent harness. Os modelos que vamos usar estão implantados em um serviço gerenciado que temos na Oracle, chamado OCI Generative AI. Temos parcerias com Google, Meta, OpenAI e xAI por

46:04 enquanto, e podemos oferecer inference para os modelos dessas empresas por meio do nosso serviço gerenciado. Pensem em nós como o OpenRouter empresarial, se quiserem. Então, para começar… Vocês podem começar por aqui. Este é o repo, certo? O workshop de agent harness. Se vocês estiverem aqui, obrigado por adicionar uma estrela, aliás. Se estiverem aqui, basta clicar em “Abrir no GitHub Codespaces”.

46:36 Isso vai levar vocês até aqui. Vocês podem selecionar quantos núcleos quiserem. Se quiserem criar isto com oito ou 16, por favor, não façam isso, porque eu… eu mesmo estou pagando por isto. Mas também podem criar com mais recursos. Basta criar o Codespace. E, como eu disse, eu vou pagar por ele. Então, não se preocupem. Isso vai criar uma nova instância de Codespace. E, quando

47:06 terminar — ainda não terminou —, vou mostrar o que podemos fazer com o app book e o notebook. A ideia é usar o tempo restante, temos 1 hora e 15 minutos, para percorrer o notebook. E vocês vão ter que… Na verdade, deixa eu mostrar no GitHub. Vocês podem acessar aqui. E, dentro do notebook, depois de implantarem o Codespace,

47:37 vocês vão encontrar um notebook do aluno aqui. Esta é uma parte do workshop, certo? Aqui, vamos implementar do zero todo o substrato do agent harness. Então, vamos começar apenas com o modelo e, depois, continuar adicionando camadas ao agent harness, como vimos, as sete camadas, certo? E vamos estar aqui para ajudar vocês. Vocês terão algumas tarefas para fazer. Deixa eu mostrar. Há algumas coisas para vocês fazerem.

48:08 Por exemplo, a primeira coisa que vocês precisam fazer é criar uma pergunta, certo? A coisa mais simples de todas. Vocês só precisam se comunicar com um modelo, sem nenhum agent harness implementado, certo? Então, primeiro, vocês precisam fazer qualquer pergunta que quiserem. Ela será enviada pela API de completions da OpenAI, que vai retornar uma resposta. Esta é a coisa mais simples de todas. Depois, vamos começar a adicionar busca, recuperação, codificação

48:41 e todos os outros componentes que vimos. Há 19 tarefas no total. Se terminarem primeiro, levantem a mão e eu vou dar um abraço em vocês, porque não tenho mais nada para oferecer. Isso. Alguém já implantou o Codespace? Certo, uma pessoa. Muito bem. Então, se tiverem alguma pergunta ou problema, me avisem. Mas é assim que fica quando está implantado, certo? Então,

49:12 é assim que fica depois de implantado, certo? Deixa eu passar por isto rapidamente. Vocês vão ter um app, certo? E o app já vai ter tudo de que precisam. Se quiserem implantar este app por conta própria, podem alterar esta porta do Total Recall aqui. Deixa eu mostrar de novo como fiz isso. Vou até “Portas”.

49:43 Cliquei na visibilidade da porta e alterei para pública. Agora, ela está usando um gateway público, então, se eu abrir o navegador, consigo acessar minha instância individual do Total Recall. Por exemplo, se eu perguntar: “Mostre a receita total por categoria de produto”. E, claro, este é o centro de controle, então já tem implementados todos os componentes de que falamos

50:15 Vocês também terão uma visualização da context window mostrando o que está acontecendo em segundo plano. Por exemplo, estas são as ferramentas que o agent harness selecionou para carregar no contexto e responder a esta pergunta. Este é o esquema que está sendo usado. Também podemos examinar os traces individuais dos agents que estão ocorrendo. Por exemplo, quais skills estão sendo carregadas, quais fontes de dados estamos usando e quais tool calls estão sendo feitas.

50:46 como, por exemplo, executar comandos SQL etc. para responder à sua pergunta. Então, a questão ainda está sendo construída. Está levando 16 etapas. E, sabe, por exemplo, aqui ele detectou um erro, certo? Mas, como nosso agent harness é tolerante a falhas, ele vai continuar tentando, porque tem um agent loop implementado etc., certo? Então, todas essas coisas vão gerar este resultado a partir dos dados no banco de dados, certo? E você pode acessar o

51:19 context window e ver quantos tokens estávamos usando. E, se você tiver interesse especial em algumas dessas partes, por exemplo, no pacote de memória de agent da Oracle, também pode interagir apenas com o cartão de contexto, ver como o cartão de contexto está sendo criado etc. Então, vocês vão receber tudo isso implantado na base de código de vocês. Sim. >> Então, você mostrou que o harness está escolhendo a maioria

51:50 >> Sim. Então, para quem não ouviu, a pergunta dele é: o que acontece quando há milhares de ferramentas em uma organização, certo? Bem, apresentamos neste curso, com Andrew Young, este conceito chamado padrão de caixa de ferramentas. E a questão é que você pode otimizar para que a recuperação dessas ferramentas seja

52:21 desprezível. Então, você vai usar índices HNSW, ou seja, índices hierárquicos navegáveis de mundo pequeno, que usam uma estrutura de grafo, e cada nó do grafo é um índice vetorial ou um armazenamento vetorial. E, de fato, índices HNSW podem ser criados para esses tipos de problemas, desde que os dados não estejam em arquivos. Então, ótima pergunta. Você não precisa se preocupar com isso até chegar a

52:53 milhões e milhões de usuários. E, quanto às chamadas de ferramentas, como chamadas específicas para diferentes ferramentas, talvez você não chegue a 5 milhões. É mais como ler um arquivo, gravar um arquivo, obter coisas e todos esses tipos de chamadas de ferramentas que fazemos todos os dias; normalmente, não passam de 100 ou 1.000. Mas, usando um armazenamento vetorial, você abstrai a complexidade e a quantidade. Você pode fazer uma consulta a 1.000

53:25 com a mesma facilidade que faria a 10.000, por causa do componente de armazenamento que escolhemos, que é um índice HNSW. >> Então, vamos supor que talvez duas unidades de negócios diferentes dentro da organização tenham acesso a alguma coisa, digamos, como… >> Sim, algumas delas têm acesso a dados confidenciais, por exemplo. Outras não.

54:01 Sim. Ótima pergunta. A pergunta dele era: o que acontece se as descrições das ferramentas de duas empresas diferentes forem muito parecidas, certo? Uma das coisas que podemos fazer com o padrão de caixa de ferramentas é gerar, com um LLM, descrições aprimoradas da caixa de ferramentas para ferramentas específicas, a fim de aumentar a distinção entre as ferramentas. Então, se você acha que as descrições atuais de uma ferramenta ou de uma skill também não são

54:33 suficientes, pode aprimorá-las com recuperação baseada em LLM. Em vez de usar, por exemplo, reconhecimento de entidades nomeadas, que é uma abordagem bem rudimentar, você também pode fazer algo mais sofisticado: aprimorar as representações de ferramentas, como docstrings, para aumentar a distinção entre elas ao fazer uma busca vetorial. Isso responde à pergunta?

55:08 O agent loop? É isso? Ah, sim. Sim. É isso.

55:38 No seu harness, como você… Sim. Então, há um limite, claro, porque não temos dinheiro infinito. Não podemos continuar tentando sem parar se as gerações forem apenas alucinações, certo? Há um limite que defino dependendo do LLM de ponta que estou usando. Por exemplo, para o 4.1 fast reasoning, que é o que estamos usando aqui,

56:10 descobri que um valor de 8 a 12, como número máximo de chamadas de ferramenta antes de desistir, é adequado. Também depende da precisão e da correção do modelo. Por exemplo, neste caso, ele conseguiu mostrar isso em duas. Antes, conseguiu encontrar em 16. Então, às vezes, a recuperação será mais rápida. Às vezes, você vai precisar ter um pouco mais de paciência. Mas o que gosto de definir é uma

56:41 variável, como uma variável de histerese, que controla o nível de paciência que o harness terá com o modelo. Depois, você pode fazer outras coisas. Por exemplo, se o modelo for péssimo, pode usá-lo como um roteador: para problemas mais difíceis, encaminhe o problema a um LLM de ponta. E, para os problemas mais fáceis, pode conectar um SLM com open weights, por exemplo, que será mais interessante.

57:11 Sim. Sim. Acho que… Na minha opinião, o futuro é uma mistura de pequenos especialistas para cada tipo de problema. Algumas empresas desenvolveram modelos de 100 milhões de parâmetros que funcionam excepcionalmente bem para um tipo de problema. E, se você tiver apenas um agregador e um orquestrador que encaminhem o modelo correto para…

57:44 a consulta correta para aquele modelo, então terá um tipo de agent harness muito eficiente em tokens. Assim, você pode fazer model routing dentro do agent harness. Algumas empresas estão basicamente fazendo só isso e vão cobrar, digamos: vou cobrar 10% dos tokens que vou economizar para você, em relação ao valor que você gastaria originalmente. Certo? Então, deixe-me mostrar o notebook do

58:15 aluno, certo? Então, quando estiver no notebook do aluno, para quem não conhece o Visual Studio Code, talvez seja necessário selecionar um kernel aqui para executar o notebook. Você pode selecionar Python 3.12 aqui e começar a ler. Se encontrar uma tarefa que precisa fazer, há uma pasta docs com todas as explicações, as explicações individuais de que você precisa

58:46 para resolver esse problema específico. Por exemplo, a primeira tarefa, que consiste apenas em conversar com o núcleo de raciocínio, com a camada do modelo, sem fazer mais nada, vai explicar o que você precisa implementar naquela célula para que funcione e você possa passar à próxima. E também tenho a solução. Mas, se você não for preguiçoso, vai tentar. E espero que tente. Estaremos aqui respondendo às perguntas de todo mundo. Vou desligar meu

59:19 microfone, descer para ficar com meus colegas e conversar sobre isso durante o restante da sessão. E, se tiver alguma pergunta ou quiser conversar mais com a gente, venha ao estande da Oracle. Estaremos lá todos os dias, o tempo todo. E, sabe, isso nos faz sentir bem, como se fôssemos queridos e tivéssemos amigos. Então, se quiser vir falar com a gente, pode conversar um pouco. Seria

59:50 legal. Internet, como está a internet? Estou me sentindo como César.

1:00:20 Certo, vou deixar isto aqui. Vou manter isto aqui e vou descer. >> [música]

Transcrição original

[00:12] Hello, hello. Perfect. Yep. So, perfect. Yeah, this this volume is perfect. It’s just a website that I registered the domain on Saturday just to do the registration of the workshop. But, 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. And just view the invitation, accept it,

[00:42] and then you’ll be able to run the workshop. We’ll be running the workshop on GitHub code spaces. So, if you want to start that up, it takes like 5 minutes. Um 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 together. Sound good? Okay, perfect. And thank you, by the way, for being here because I know it’s

[01:14] Monday 9:00 a.m. So, I commend you all for for being here. >> Uh just 2 minutes before we begin, so I will shut up.

[03:22] >> All right. Well, let’s let’s begin, guys. So, thank you for being on this uh at this time here with me. Um 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. At the end of this session, what I would like you to leave with is some knowledge on agent memory and agent harnesses, how you can build your own agent harness, which is nowadays one of the hot topics on AI, I would say.

[03:55] Um 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 accept what we are given. And 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. So, the harness is what we’re going to talk about. For those of you who weren’t here, uh you can scan this QR code or go to

[04:26] that website workshopwaitingroom.com and just register. You 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 you’ll have everything set up for you. So, just a little introduction on on who I am. I’ve been working for Oracle for 7 years. I’ve been a developer advocate for about four of them.

[04:56] And you can find, you know, my talks and I’m very active on GitHub as well. So, if you’re a GitHub user, just check out my GitHub profile if you like. Uh what is the highlight of my career so far? I launched a course with Andrew Ng on agent memory. So, if you’re interested on the memory components of what we’re going to what we are going to discuss today, you can just check out that course if you’d like. Um these are the things that we are going

[05:27] to talk through today, right? First of all, we’re going to do a little introduction on what the agent stack is, and then we’re going to zoom into the data layer where the memory lives. Then we’re going to explore a little bit about the shapes, the different shapes that AI applications take nowadays, uh what an agent is uh followed by the seven different layers that make up an agent harness. So, we if you just follow these seven different structures, you will be able

[05:58] to create an agent harness, a minimal agent harness that you can connect any model to. Then, 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 develop agent harnesses and and AI applications. So, the agent stack. And by the way, [clears throat] if you have any questions, just raise your hand. I’m very happy to to take questions, as well. So, the agent stack.

[06:30] The agent stack, like every agent a every AI agent, sits on on these five layers. You either you have an application, which is the product surface, right? What we interact with as users. We have data. And that has lots of components. You have memory, you have knowledge, you have retrieval, encoding, search. You have the model itself, the reasoning large language model that is behind everything. Uh infrastructure, which is the orchestration. What model do we serve

[07:01] depending on the reasoning effort that we need and things like that. And 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, they are uh increasing increasingly commoditized. What do I mean by that? They are trying to take away the complexity from these layers out of out of our

[07:31] domain, right? So, 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 going in because the agent harness excels and you know, lives very closely with uh with the data layer. So, let’s focus on the on the data layer. The data layer is where an agent harness appears. And it has, you know, many components. The first component is the gateway and

[08:02] MCP. It’s interesting because that’s the one that connects an agent harness to data and tools. So, 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 data, right? So, you’ll you you then have like the memory layer, the semantic layer, retrieval layer, context layer, and tools and

[08:33] skills that are built on top of the gateway and MCP layer. Let’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. For instance, Outlook. Right? So, 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. So, gateway and MCP is like the layer that connects a large language model to

[09:05] the outside world or de facto to our computer or wherever you’re working. And AI applications today, they take up four different um four different shapes, right? You have LLM chatbots, which are very passive. Uh they just respond when you ask a question. You 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

[09:36] you have the more active components of AI applications, which are what we kind of use every day. Like 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 I what I mean by that. But first, I want you to have a very clear definition of what an AI agent is. So, to me, an AI agent is essentially a model

[10:08] large language model plus a harness. The model itself will be the reasoning and everything else will be the harness. Um So, this definition is something like this. An autonomous entity whose cognitive functions are powered by a large language model for reasoning. They are augmented by a database or files for memory. They are extended through tools for actions and grounded in inputs that let

[10:39] it perceive uh its environment. So, an agent is a a model plus the harness. So, 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. It’s the part that we are that’s that’s heavily subsidized, the part that we rent. If uh if you’re like me, you’re subscribed to every imaginable subscription on Earth. And that’s the

[11:11] thing that we do not control. Right? We have no control over what we are offered. And then we have memory, tools, and perception that actually we get some customizab- Um So, the goal of harness engineering is to create reliable and predictable outputs over and over. Whereas a reasoning model is very non-deterministic. You might give it the same the same input and it

[11:42] might produce different outputs every time, right? So, I said that, you know, in AI applications the most typical ones nowadays cloud code, codex uh and any other type that you can think of is a combination of automation plus autonomy. Why? Well, because automation provides reliability to a system and autonomy gives flexibility. And this is a combination that is very

[12:12] convenient when we are developing ourselves. By the way, raise of hands, who is working as an AI engineer or as an AI developer? Oh my god, okay. Good. So, you must all have used one of these systems, right? So, all of them they have this commonality, which is they have autonomy and they have flexibility. Um Yeah, so the idea is that these systems, right? They are built

[12:44] on top of an a proprietary agent harness. And an agent harness is nothing more than everything that we spoken about an AI agent. All the things that you need to do around that to enable it to produce reliable and repeatable outcomes, right? So, the model itself non-deterministic. Same input, different outputs every time. But the harness, what we want to do with the harness is to turn this non-deterministic nature of a large

[13:14] language model and be able to produce reliable and repeatable results. So, 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. You just need a like a common interface like an OpenAI protocol or the Anthropic API specification, right? All these things make it so that the model part is swappable and the harness is what we’re going to focus on today.

[13:48] So, seven things that make up an agent harness. And as I said, we’re not going to touch on the model layer because we have no control over it. But let’s go a little bit more in detail into each of these, right? You need a storage layer on your agent harness that essentially determines where the data is going to live, where the memory physically lives. Uh and we’ll see about this dilemma that has been going on about the last 6

[14:20] months about files versus databases. And why I think a hybrid uh combination of both is actually the best part. Then you also have memory engineering components which are all the uh encoding, the search, and the retrieval components of it. And also the semantic layer which is kind of the 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

[14:51] companies or our knowledge. What we don’t say to the LLM. Kind of that’s the semantic layer. We’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 that you know, keep the window as salient as possible, the context window as salient as possible. You want to minimize the context window as much as possible so that that the task that you’re solving stays relevant.

[15:24] So, 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 an agent harness and each one of the individual components. So, the model layer, right? The frozen reasoning core. I say it’s frozen because typically the weights of a model don’t change. Uh and I say typically because uh we are actually I’m actually in the process with Cassius sitting right there. We’re going to

[15:55] record a new course with Andrew Ng on continual learning for AI agents. So, if you’re interested, just check that out in a couple couple weeks. But the thing is that 99.9% of 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, it’s very hard to change the weights of a model. So, there are other ways in which you can affect the reasoning without actually changing the weights of the

[16:26] model. But this is motivation for for the continual learning part that we will see in the workshop. Where 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 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.

[16:56] Files have convenient things, convenient characteristics, and also the databases. So, the files, right? They are very easy to like they are very they match the models’ 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 nature 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

[17:28] thinking about SQL, like SQL. And the things that you don’t actually need to ch- like choose one or the other. You can actually use both of them. Like files are attractive because the models speak them, and they kind of work very very easily with operating systems. They follow POSIX semantics, so they are compatible on Debian, Ubuntu, any other operating system that you might want. And

[17:58] they also have some disadvantages. For instance, they don’t have transactional consistency. So, this is one of the problems that I wanted to talk about. If you are a degenerate like me, and you are working, I don’t know, like eight, 16, 32 agents at a time, uh the problem with this is that files cannot be modified and inserted and modified at the same time. So, what is the solution nowadays to not having transactional consistency

[18:30] and working with files? Any suggestions? Work trees, exactly. So, agents, what they when they want to modify a file, but another agent is working on this thing, they just created a different work tree, right? They 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. So, this is the way that is a workaround against

[19:00] 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. Um you don’t have backups either. So, if your operating system gets corrupted or something, you will just lose everything. And these are things that the database fixed 35 40 years ago, and people have kind of forgotten about that. So, what I

[19:30] want to do is to give you kind of the best of each of the of the implementations, right? You can get the benefits of files and the benefits of databases in the same place. And we’ll see why. But these are some of the advantages, right? You have ACID consistency. So, atomic operations, consistent operations, isolated, and durable. You have high availability. You might replicate the database and let it be, you know, in three different places in

[20:01] the world with a replication factor. You also have vector search, which is very easy. In files, you just have to do like regular expression matching or a derivative of that. And you know, lots of other lots of other things. So, 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

[20:31] update a counter on this file. And let’s see who’s faster. I know the answer, of course, but you will you’ll get to know it later. But, 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 gives you, you know, lots of the advantages that we said. You will get files with ACID transac- transactional consistency. You

[21:01] will get vector search, relations, security, high availability, etc. Right? And 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, things like this, they can go into a more structured space like a database. And this is what we’ll do in the workshop.

[21:34] For the encoding the search and the retrieval, which was another of the components in the agent harness, we also have uh LangChain integration that I want to mention called LangChain OracleDB that makes it very easy to insert into vector stores, search in the vector store, and retrieve from the vector store. So, also we have another thing called in-database embeddings. Have you ever heard about in-database embeddings? Yes? Okay. So, in-database embeddings is very

[22:06] 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. And that’s very convenient for isolate like data retention and data security purposes. So, 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

[22:37] bi-encoder. So, a bi-encoder is essentially an embedding model. You will create enco- embeddings out of these documents. 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. You can also create an embedding out of that and then compare it to what you had previously on your vector store. And this is how you get the most relevant vectors in in an answer. Then you will run an

[23:07] across encoder, which is a re-ranker, and take a look at the question plus the result, and that’s how questions are answered kind of in in in rag applications, right? So, these things we are also going to to touch briefly on the workshop. And the thing is that, you know, imagine this rag application from the beginning. From the documents, you create you do lots of things, right? You do tokenization, then you create the embeddings. Um you have to do things

[23:40] like deduplicating the data, normalization, uh personal like redacting personally identifiable information, uh 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. You 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

[24:11] know. I will not name names, so I don’t get in trouble, but you know, you might need like different databases for each one of these, right? You you get what I mean? So, there is a very high nowadays, very high data synchronization logic overhead for AI engineers or even for agents, right? So, lots of maintenance required and and and lots of engineering effort on it. And this is something that we want to avoid. So, what I want you to do

[24:42] today is just to try us out as Oracle. Uh try our database. We have support for every type of data imaginable that you can think of. Um we are called the converged database. We are the only converged 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. And you’ll get like one database engine, uh one query interface, and uh

[25:14] one single development stack. Everything will be in the same database. So, also for data security purposes, you just have to you know, secure and save all your data in one place. So, a single attack vector is what you need to worry about. You don’t need to worry about updating five different database. You can just worry on securing one database. So, we can be the engine of your AI applications, not just a single step,

[25:45] which is what people think of when they’re working with databases, right? Um Yeah. So, 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. We want to reuse the data and refine it in the process. But we want to reuse the data so that the next time that an agent or

[26:18] us as engineers we are working on a problem that took us 3 hours, the next time that we observe this problem, the problem becomes easier either for AI agents or for us. And agent memory has lots of lots of components, right? We have short-term memory, we have long-term memory, and then we have shared memory, which is something that’s relatively new. Um and this shared memory is kind of what happens when a sub agent is communicating with it it’s communicating with its with its parent, for instance,

[26:49] or two agents are trying to collaborate on solving one specific problem uh together. And then what I want you to to see is that depending on the type of memory on 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, it’s very short-lived, and it’s very useful for things that are happening right now. For instance, the to-do list on a coding agent, right? It’s happening right now,

[27:20] but you actually don’t want to save that uh you know in long-term. But 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 Claude. Some people are using Claude here. Uh but in in Claude, 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. So, this is something that’s makes

[27:51] sense to to save in the long run, right? You also have things like procedural memory. Previous workflows that have worked very well for your system. For instance, you worked on this front end, and then you created a very beautiful design that you like. You 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, right? So, these are the things that we we will

[28:22] see on the workshop. And some people say, “Okay, why do I even need all of this?” Like people that are very that 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. So, it’s useful for some things, but not for all of them. And one of the problems that that happen

[28:53] with with working with a with a context is this thing called context rot or context degradation over time. And 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. So, at the beginning of a conversation, and this is a a a famous problem that that the context window has is at the beginning of the conversation, it will stay on track a lot because

[29:24] you are just you just started the conversation. So, let’s say that for instance, like in school, right? Or 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 I just started speaking. But if the conversation goes on for 8 hours, then you want to punch me, right? Because I haven’t shut up, and you haven’t learned almost anything at the end. And the the problem is that attention, like us humans, is very limited. So, the

[29:55] 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, you know, is one token is essentially a reference of one token for every other token in the context window. So, 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. So, you want to keep the context window as small as possible to avoid context

[30:27] rot. And memory engineering, the components of memory engineering, um 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. So, it is a discipline, right? And here we have Valentin, for instance, and we have people from Oracle,

[30:57] my colleagues all over the the room. So, if you see them, you can say hi to them. Valentin here, he’s working on the development or he worked on the development of this agent memory package. So, if you have any questions about this, you can ask him. Um 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. For instance,

[31:28] as an engineer, if you do not have a managed solution, you need to make a lot of decisions. You 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? Um 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? With OAMP and Oracle Agent Memory

[31:58] Package, you can actually just do all of these in one single line of code. And we want to make it easier so that we reduce the cognitive load of AI engineers and AI agents as well. And with this context card thing, you will get something like what you see on the left. And this is kind of an explanation of what each part does on it. But essentially, the the topics that you see, for

[32:29] instance, from any conversation, you can create a context card from the thread or from the conversation. The topics will orient the model. The 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, the preferences, and the memories that are associated to this conversation. Uh then you have the episodic memories that explicit explicitly track the

[33:01] unanswered question that is going on right now. And the recent messages give like local context to the model. So, 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 on on Python and it is all assembled by one single call. Yes. >> So, you’re not suggesting that this goes directly into the model. This is actually something that is used by the furnace

[33:32] >> Exactly. >> to harness what’s going into the model. >> Yes. Yes. >> And this is the component that you’re talking about that Oracle uses. It knows about the structure and it uses this structure to >> Exactly. Exactly. So, this structure This is an abstraction that we build on top of the model because the model we have no control over in most cases, right? Um 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. Yep.

[34:04] So, the memory and the semantic layer they kind of work together with I know we talked only about memory components. Uh I’m going to walk you uh quickly because I’m I don’t have a lot of time um to the semantic layer, to the semantic components of it, right? And the semantic layer is the the meaning of what’s going on behind it that you kind of assume that that happens, right? So, anyone from Germany? Okay, so I apologize for my pronunciation, but I’m going to try. So,

[34:36] the Umwelt is like the ambient of a model, and this was coined by Jakob von Uexküll. Um 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. For us humans, for instance, we have our eyes, our senses, right? So, everything that we perceive and everything that we live, all our experiences, are seen

[35:07] through this lens, right? And 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. And this lens is essentially what you train it with and then what you also give context to. So, everything that you talk to the agent, right? When you talk to the agent, this agent will look it through the Umwelt.

[35:39] And the semantic layer is essentially the agent’s Umwelt. So, the Unsaid 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 you know, known between you and your colleague. You don’t need to specify everything that you work on every day, but if there was someone else, like a a child, that wanted to that [clears throat] wanted to start uh

[36:10] working with you you would have to specify everything very very in detail. These are all the Unsaids, and this is what the semantic layer captures. So, the Unsaid is the actual tribal knowledge that that an an enterprise has, right? Institutional knowledge as well, like how the data is modeled, how the queries are executed, what is the metadata. All these things are in the semantic layer. Um and quickly

[36:40] just for you to know that we’re also going to implement a very minimalistic agent loop. And an agent loop is like the driver of the model, right? It lets a model be kind of independent and autonomous. And it is what makes a model it it it turns a model into an agent, right? And this is like the simplest agent loop that you can find. It’s kind of this observing and reasoning and then acting

[37:11] part that happens all of the time, all of the time. And you know, it’s it has to be failure failure resistant so that we never exit the loop. This is the idea. That the agent you give autonomy to the agent. Well, you give autonomy to the model so that it becomes the agent. And then on the context engineering part, which is the last part of the seven layers of an agent harness, you also have lots of things that you can do. For instance, the toolbox pattern

[37:43] and the skillbox pattern, which we are This is on the workshop as well. And these are ways in which you can store the available tools and the available skills of a model so that they are retrieved optimally. And 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. Every iteration of an agent loop, you will see if this is actually the right

[38:13] place and then if it’s not, you can just take them out temporarily. So, uh Oh, sorry. I thought I I saw a question. So, we will see all of these 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 on the agent loop. And then, continual 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 the

[38:44] model, right? So, a frozen model, as we saw, it doesn’t get better, right? But, there are ways in which we can make an agent improve in the weights, which is the part that we are going to work on. Uh, in the representation part, so on the embedding and the re-ranking part, and also in the context window. And these are the three types of continual learning techniques. We are going to focus on the workshop on the context and

[39:14] the token space because it’s one of the easiest ones and all one of the least expensive ones, as well. I assume no one is a millionaire or not many of us are millionaires. So, this is also the most achievable and the most realistic way to change the model behavior over time. So, without further ado, I just want to introduce you to this part, which is skill promotion and workflow workflow

[39:45] promotion. So, those skills or those workflows that you’ve done for 3 4 hours, right? You’ve been working for the whole day on a workflow. You were able to successfully do your job, um, and then these things can actually be retrieved. They can be stored into the memory components that we’ll see. And then, we will see about skill promotion. So, if we promote a skill, for instance, we can promote it through a distillation process and

[40:16] create a better skill.md than the original. So, we will retire the old version and update from the new version. And 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, our preferred like our preferences like for instance, let’s use this specific library because I really like the look and feel of it. Let’s use this specific

[40:48] database engine because it has less bugs or I found it easier to work with. All these things can be promoted into reusable and improvable skills over time. So, this is what the whole harness would look like at the end of the of the workflow. Sorry, at the end of the workshop. And hopefully what you leave this you’ll leave today with a better understanding of all the specific components that make up an agent

[41:18] harness. So, let me go to here before I forget. If 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 staff. If you’re a Discord user, just feel free to to join this Discord server. I’ll put the link later as well. But, without further ado, let’s begin with

[41:50] the actual workshop and I will tell you how. So, let me show you first what we are going to build, right? This is an upbook. Oh, sorry. Uh you don’t see this. Yeah. Yes. Uh the the the first Yes, the workshop instructions, right? So, for those of you who weren’t here,

[42:20] you can just go into this website, register with your GitHub user, and then you will get an invitation like this to a GitHub repo. And from here, we will create a GitHub code space. Uh so, please make sure to do that right now. And all my colleagues are are around the room room to answer any questions that you might have during the creation of the code space, etc. Yes. Yeah.

[42:55] The internet? Are you having issues with the with the internet? Okay, let’s see. So, do you guys have my the same Wi-Fi? Um ai.engineer Wi-Fi? Okay. So, can someone assist people with the Wi-Fi if possible? Yeah. Please fix the system, whoever. Do it. I can’t I can’t.

[43:28] Yeah. Yeah. Uh my colleagues will will take a look at that if Right. Yeah. Yeah, it it always happens, you know? Yeah.

[44:00] All right. Say again, sir? Yes, they will go into the air I >> believe they will they will go into the AI engineer. So, if you go into the session uh I’ll make sure to to to go there. If not if you either join the Discord or any other, you know, you can just message me as well on LinkedIn. I’ll gladly give you the the slides if you want. All right.

[44:30] Um video team Can you turn me on? Uh sorry, switch me on. Please. Uh Oh, perfect. Thank you. So, what I’d like 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. And with the app book, you can actually test every of the individual components of an agent harness

[45:02] uh individually, right? So, just for me to show you that this is possible. And you will get this automatically deployed in GitHub code spaces as well. So, you will have um this uh already deployed. And you’ll say, “Well, how am I actually making requests?” We are going to be making requests to uh Oracle uh oh Okay, not fun. Demo time. Um the idea is that

[45:32] Yeah, okay. I I know what’s happening. So, I lost connection to my to my code space because of inactivity. Let me restart. Uh this app book 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 OCI the generative AI service. We have partnerships with Google, with Meta and with OpenAI and with xAI for the

[46:04] time being and we can actually provide inference to their models through our managed uh service. So, just think of us as the enterprise open router, if you’d like. So, let me just go so you get started uh you can get started. This is the repo, right? So, the agent harness workshop. If you’re here, um thank you for starring that, by the way. Um if you’re here, you just have to click on open in GitHub code spaces.

[46:36] And it will take you here. And you can select as many cores as you like. Uh 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 create 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 a new a new code space instance. And once it

[47:06] finishes, which it hasn’t yet, I will show you what we can do with the app book and the notebook. But the idea is to use the remainder of the time the 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. Um you can go here. And inside the notebook, after you deploy the code space,

[47:37] you will get a a student notebook here. And this is one part of the of the workshop, right? And here we’re going to implement the whole agent harness substrate from scratch. So, 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? And we’re going to be here to to assist you. You will have to do some to-dos. So, let me show you. There are a couple of things to do for

[48:08] you. So, for instance, the first thing that you need to do, you need to create a question, right? The simplest thing of everything. You just have to communicate with a model with no agent harness implemented, right? So, the first thing you’ll need is to ask any question that you like. This will go through the OpenAI completions API, and it will return you a response. This is the simplest of all. And then, we will start adding search, retrieval, encoding,

[48:41] and all the other components that we that we have seen. There are a total of 19 things that you need to do. If you finish first, raise your hand, and I will give you a hug, because I don’t have anything else. And yep. So, anyone already deployed that the code space? Okay, one person. Okay, good job. So, any Yeah, if you have any questions or any problems, uh let me know. But, this

[49:12] is what it looks like when you have it deployed, okay? So, let me go through this quickly. So, you will get an app, right? Um and the app will already have everything that you need. If you want to deploy this app yourself, you might change this total recall port here. Let me show you how I did it again. I go into ports.

[49:43] I clicked on the visibility of the port, and I changed this to public. And then, this is now using a public gateway so that if I open the browser, I can actually get access to my individual total recall instance. So, for instance, if I ask a question like show the total revenue by product category. And of course, this is mission control, so this is this has all of the components that we’ve spoken about

[50:15] implemented already. You will get also a context window visualization of the things that are going on on the background. For instance, these are the tools that were selected by the agent harness to be loaded into the context to answer this question. This is the schema that’s happening, and then we can also take a look at the individual agent traces that are going on. For instance, which skills which skills are being loaded, what sources of data are we taking and what are the tool calls being used

[50:46] like for instance running SQL commands etc. to answer your question. So, the question is still being built. It’s taking 16 steps. And you know, it’s going to for instance here, it detected an error, right? But because our agent harness is uh fault tolerant, it will keep trying because it’s it has an agent loop implemented etc. 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

[51:19] context window, see how many tokens were using. And if you’re particularly interested in some of these parts for instance, the Oracle agent memory package for instance, you can interact also with only the the context card, how to how the context card is being created etc. etc. So, you will all get this deployed in your code base. Yeah. >> So, you showed that the harness is choosing most

[51:50] >> Yeah. So, his question for those of you who didn’t listen where what happens if you have thousands of tools in an organization, right? Well, we introduce this concept called the toolbox pattern in this course with Andrew Young. And the thing is that you can optimize so that the retrieval of these tools is

[52:21] negligible. So, you will use hierarchical navigable small world indexes that use a graph a graph structure and then each node in the graph is a vector index or a vector store. And then you can actually like HNSW indexes, they can be created created for these types of problems only in the data is not not in files. So, great question. It doesn’t have to worry you until you reach

[52:53] millions and millions of users. And tool calls like different specific tool calls, you might not get 5 million. It’s more like reading a file, writing a file, grabbing and all these kinds of tool calls that that that we do every day, they typically don’t excee- like exceed 100 or 1,000. Um but by being on a vector store, you abstract the complexity the complexity and the amount of it. You can just make a query to 1,000

[53:25] just as simply as you would 10,000 because of the storage component that we we choose it, which is an HNSW index. >> So, let’s assume that maybe two different organizations within the organization, business units. They have access to something let’s say like >> Yeah, some of them they have access to confidential data for instance. Some of them don’t.

[54:01] Yes. Great question. So his question was what happens if the tool descriptions that two different companies have are very similar, right? And one of the things we we can do on the toolbox pattern is actually generate with LLM enhanced toolbox descriptions for this for specific tools to increase the separability of the of the tools. So if you think that the current descriptions of a tool or of a skill as well are not

[54:33] enough, you can actually enhance them with LLM retrieval like you would uh instead of running for instance named entity recognition, which is very uh caveman style, you can also do something more sophisticated, which is enhancing the the kind of like docstring uh enhanced representations of a tool so that you increase the separability when you’re doing vector search. Does that answer the question?

[55:08] The agent loop? Is that Oh, yes. Yes. That’s Yeah.

[55:38] In your harness, how do you Yes. So, there there is a there is a limit, of course, because we don’t have infinite money. So, we can’t just keep trying and trying over and over if the generations are just hallucinations, right? There is a cutoff point that I set depending on the frontier LLM that I’m using. For instance, for 4.1 fast reasoning, which is the one that we’re using here,

[56:10] I found that a value of 8 to 12, like maximum number of tool calls before giving up, is correct. 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. So, sometimes it will have a faster retrieval. Sometimes, you will need to be a little bit more patient. But, what I like to define is a

[56:41] variable like a hysteresis variable that holds the amount of patience that the harness will get with the model. Then, you can do some other things. Like, for instance, if the model is garbage, you can just use or use it 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

[57:11] interesting. Yes. Yes. I think that’s Like, my personal opinion is that the future is mixture of small experts for for each type of problem. Some companies that they have developed like 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 model to that like

[57:44] the correct query to that model, then you will have a very token efficient type of agent harness. So you you you can actually do model routing inside the agent harness. Some 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 amount of money that you were going to spend. Right? Uh so let’s let me show you the the student

[58:15] notebook, right? So once you are inside the student notebook for 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. So you might select Python 3.12 here and then you can just start reading. If 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

[58:46] to solve this specific problem. For instance, the first to-do, which is just talking to the reasoning core, to the model layer without doing anything else, will just explain what you need to implement on that cell so that it works and you can proceed to the next one. And also have the solution. But if you if you’re not lazy, you will try. And I hope that you that you try. And we will be here answering questions around the room. I’m going to turn off my

[59:19] microphone, just come down with my colleagues, and then let’s chat about it for the remainder of the of the session. And 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. We’ll be there every day uh all the time. And you know, it makes it makes us feel good like we are wanted and we have friends. So, if you want to come up to us, just chat with us a little bit. It It

[59:50] will be nice. Internet, how’s the internet? I feel like Caesar.

[1:00:20] All right, so I’m going to leave this here. I’m going to keep this here and I’m going to come down. >> [music]