Why We Built Agent Memory on Postgres, Not Markdown — Transcript
Full transcript
- 0:04That's I'm Cogni. Um, I flew in here
- 0:07from Germany. I'm spending half of my
- 0:09time here now in San Francisco because
- 0:10this is the place to be at.
- 0:12I worked in big data, was a data
- 0:14analyst, data engineer, data product
- 0:15manager at Building Systems at scale for
- 0:18a couple of unicorns in Germany, and
- 0:20then I got bored because when you move
- 0:21data from A to B, it gets to you after
- 0:23like a few years. So I ended up studying
- 0:26clinical psychology, cognitive sciences,
- 0:28and around three years ago, I got an
- 0:31idea that I should maybe do something
- 0:33about the LangChain and embeddings
- 0:35because I was trying to use vector
- 0:37stores and to build a app
- 0:39for my use cases and personal goals and
- 0:42optimize my my daily habits.
- 0:45And I could not get anything to work.
- 0:47Uh, I could not get reliable outputs. I
- 0:49had to manage all these collections in
- 0:51vector stores. I had to retrieve all
- 0:53kinds of data. Update these was also,
- 0:57you know, updating them was very
- 0:58difficult. And I saw that I couldn't do
- 1:01anything at scale. I was used to dealing
- 1:02with huge amounts of loads of data to,
- 1:06you know,
- 1:07queries at the time. And then I went to
- 1:1050 megabytes and everything was great.
- 1:12So I decided to do something about it.
- 1:14Started from my bedroom on my own money.
- 1:16Now we are to people between Berlin and
- 1:18San Francisco and we have around 12
- 1:21million memories generated.
- 1:23Effectively, people tried solving this
- 1:25with MD files. MD files not don't work
- 1:29really that well at scale. So you
- 1:32cannot, you know, use a file instead of
- 1:34a database. That 's why we invented
- 1:36databases 30 40 years ago and the
- 1:39reasoning of why is
- 1:41you need concurrency, you need
- 1:43many processes to read and write and
- 1:45lock and index and retrieve at scale
- 1:49where there is a lot of data in one
- 1:50place. And you can only get as far with
- 1:54a bunch of files after it after which it
- 1:57will start working. I think Gary Tran's
- 1:59G Brain is a good of that where you end
- 2:01up with 16,000 MD files that you are
- 2:03parsing through and and you're going to
- 2:05end up in trouble.
- 2:06And it doesn't really solve this problem
- 2:08of you know scattered knowledge that the
- 2:10business is going to have all kinds of
- 2:12data in different places, that the
- 2:14agents repeat themselves, that the model
- 2:17itself doesn't know really your domain.
- 2:19What that means is that you know you
- 2:21might work in manufacturing, chemical
- 2:23industry, this that where you know
- 2:25knowledge of how the processes work and
- 2:27operate is really particular to your
- 2:28company and your domain.
- 2:30And that's something that we call an
- 2:31ontology, this representation of
- 2:35knowledge that needs to sit in between
- 2:37your agent and your system. And that's
- 2:38what we are building with Cogni.
- 2:40We've been doing this for three years.
- 2:42I deployed the first version on a
- 2:44WhatsApp chatbot with 20,000 users. It
- 2:47failed miserably. And then I realized
- 2:49that you know this is going to be a bit
- 2:50more difficult than I assumed. And as I
- 2:52was doing that I understood that we
- 2:53don't need an opinionated
- 2:55memory model
- 2:57where you say hey this is memory.
- 2:59I understood we need an engine that can
- 3:00construct memory as any type of a data
- 3:03pipeline will be constructed in the
- 3:04previous iteration of this cycle where I
- 3:07can
- 3:08create modules of memory
- 3:09transformations. I can build graph
- 3:11vector representations in pure Python
- 3:13without expecting from people and agents
- 3:15to learn how to use these complex setups
- 3:18in the back end.
- 3:19And that should be sitting in between
- 3:21your data and your agents and feed both
- 3:24from your agents sources but also from
- 3:26your
- 3:27cloud code, Codex and data bricks of the
- 3:30world you know PDFs, docs and everything
- 3:32else.
- 3:34We work hard on thinking how do we
- 3:36actually and where do we store the data.
- 3:38Falcor is one great option because you
- 3:40can do thousand of agents with thousands
- 3:42of databases as a key value store.
- 3:45The problem with it is then you still
- 3:46need another database. So we managed to
- 3:48dump everything into Postgres.
- 3:50And that means that for every agent you
- 3:52can have a small Postgres instance and
- 3:54you know if you use sandboxes you can
- 3:55have something similar for memory. We
- 3:57call it memory box. So you know
- 3:59trademark there here hopefully someone
- 4:01steals it in a few weeks on Twitter or
- 4:03something. But the point here is every
- 4:06type of an implementation that you do
- 4:08can be then isolated per agent, per
- 4:10team, per user, per org. And where is
- 4:14that doesn't fail is that even if you
- 4:16build this
- 4:17and although it's hard to maintain, we
- 4:19add the self-improvement loop so you can
- 4:21continuously change and update the
- 4:23schema that the agent is dealing with
- 4:25without actually having to do that
- 4:26manually.
- 4:27So how it works in the background,
- 4:29we effectively have this layer that is
- 4:32multimodal ingestion.
- 4:34We can pull in from any type of a data
- 4:35source. It's not real multimodal
- 4:37ingestion. I'm kind of faking it a bit.
- 4:39We turn everything to text in this
- 4:40layer. So someone from OpenAI was was
- 4:42calling me out on this the other day.
- 4:45But down the line it doesn't really
- 4:46matter. For us it works quite well. We
- 4:49do knowledge structuring. We extend
- 4:50PyDantic objects and create a PyDantic
- 4:53representation of the graph and then
- 4:55store that in any type of a graph and
- 4:56vector store. So Falcor supported.
- 4:58Others are supported too. You can pretty
- 5:00much use what you want. We have an
- 5:02access control and isolation layer. So
- 5:04the full ACL table where you define read
- 5:06write permissions per agent, per tenant.
- 5:09You can spin up as many tenants as you
- 5:10want. The
- 5:12deployment we know of is AstraZeneca in
- 5:14China with 300 tenants right now. We
- 5:16have around 12 million
- 5:17memory generated each month and around
- 5:1960 companies that we know of using us in
- 5:21production out of 500 production runs on
- 5:23telemetry.
- 5:25Anonymized, we don't know the details.
- 5:27But effectively the idea here is they
- 5:29are using it effectively because of this
- 5:31feature often enough and they can use
- 5:33the access control and isolation to make
- 5:35sure that nothing is polluting context
- 5:37for different agents in the organization
- 5:39and different user groups.
- 5:40We have retrieval strategies, everything
- 5:42from temporal code. You can pull in
- 5:45whole GitHub repos and understand them,
- 5:47but we can also ask complex questions
- 5:49that require multi-hop reasoning. And on
- 5:52top of that we have feedback loops. So
- 5:54you can provide feedback to the system.
- 5:56It is going automatically improve. You
- 5:57can run improvements on embeddings,
- 6:00improvements on the graphs. We weight
- 6:02and we scale certain subgraphs. All of
- 6:04that is kind of baked in into the system
- 6:05and you can switch on and off these
- 6:07transformation layers so you can really
- 6:09play around with it and use what you
- 6:11need or extend them yourself. Any type
- 6:13of additional feature can be done with a
- 6:15simple Python function that transforms
- 6:18data model that is that is passing
- 6:20through the pipe.
- 6:22How it works a bit more in detail, I
- 6:23would have shown you my personal brain,
- 6:25but since I can't connect for some
- 6:26reason,
- 6:27I'll leave it on theory here. We have
- 6:30effectively agents from Life Site.
- 6:32Agents feed their context here into the
- 6:36session memory. Session memory is fed by
- 6:40intercepting hooks on
- 6:44So, you know, if you do user prompt
- 6:45submit, we take the context from here,
- 6:47put it into session memory, apply
- 6:50distillation and get the information we
- 6:52need, facts and and whatever is
- 6:53relevant, and then we store that into
- 6:55the permanent memory. I don't like
- 6:57long-term, short-term procedural memory.
- 7:00I think I started the same way thinking
- 7:02about it.
- 7:03Then I understood that kind of grouping
- 7:05memories into these types of groups, you
- 7:07only then have N groups of memory,
- 7:09you know, like three, four, but we need
- 7:11thousands of groups of memories that
- 7:13represent any type of a possible use
- 7:15case that you can dynamically define.
- 7:17So, for us, there is only two concepts,
- 7:19session memory where agents store their
- 7:21data as a temporary data store, a cache
- 7:24of sorts, and a permanent memory which
- 7:25is a graph vector representation that
- 7:27can also live in object storage.
- 7:29This graph vector representation is
- 7:31feeding also from the data sources,
- 7:33Google Drive, any other connector. We
- 7:35have 100 plus and a current hackathon
- 7:37with I think more than 500 participants
- 7:40online but are
- 7:42coding new connectors as we speak.
- 7:45Our goal here with the data sources is
- 7:46not to really copy all of the data from
- 7:48the existing system into the memory,
- 7:50that would be slow, expensive, and
- 7:52inefficient, is just to get actually the
- 7:54base structure of that data so we can
- 7:57effectively let agents navigate back to
- 7:59the original system and get the context
- 8:01they need. So, this thinks of that think
- 8:04of this more as a mind map of the system
- 8:06than effectively a full data storage
- 8:08layer because that wouldn't work because
- 8:12most of the organizations and users
- 8:14would be copying things over all the
- 8:15time.
- 8:17How it works in practice organized
- 8:19memory is
- 8:21we can organize it to agent memory, user
- 8:23memory, team memory, organization memory
- 8:25so you can really define different
- 8:26groups and you can put people in all
- 8:28those groups and then you can promote
- 8:30memory from one to other.
- 8:31So what happens here is I can say it
- 8:33from to my agent hey you know promote
- 8:35the memory to my
- 8:37personal knowledge because it's relevant
- 8:38for me but then I can tell it like send
- 8:40this to my team Josh should pick up my
- 8:42tasks that I was working on yesterday
- 8:45and you know the stand up he complained
- 8:47how he doesn't know what I did so now he
- 8:48has all the agent contacts so no more
- 8:50excuses for Josh
- 8:52So we all heard this if we worked in a
- 8:54software engineering team you know there
- 8:56is always that that problem context but
- 8:58effectively we can also promote that to
- 9:00organizational memory where we have more
- 9:02of a general information that
- 9:04organizations store and often enough
- 9:06what we see stored here is contracts you
- 9:07know mission vision or those types of
- 9:09things that shouldn't be changed too
- 9:11often but can really provide useful
- 9:13context of how business operates.
- 9:16So we've benchmarked Cogni, we
- 9:18benchmarked it on beam on 10 million and
- 9:20100k
- 9:22chunks so we
- 9:23got 79% accuracy. Locomo is coming out
- 9:27this week. We didn't want to do that
- 9:29earlier because it was we felt a bit too
- 9:31easy if you score over 90% on a
- 9:33benchmark not a good benchmark
- 9:35and then what we also have with Cogni is
- 9:38the ability to
- 9:41process it in your own VPC with bringing
- 9:44your own cloud or you can self deploy
- 9:45it. We are fully open source so if you
- 9:47want to manage it yourself you can. We
- 9:49provide you with a couple of things like
- 9:51adapters and other things that make it
- 9:53easier and also we recently released a
- 9:56small model runtime.
- 9:58What's the small model runtime? You can
- 10:00run Cogni completely free with small
- 10:01models.
- 10:02Fastino Labs released Glider 2.5. They
- 10:04have a party tonight. I'm missing
- 10:06because I'm here so I wanted to meet
- 10:07those guys too but since I 'm using
- 10:09their models But down the line Fastino
- 10:12allows us to do entity extraction in
- 10:14open source version of Cogni for free.
- 10:16So you're not calling OpenAI and Tropic
- 10:20to get your
- 10:21let's say structure of the graph
- 10:24anymore,
- 10:25which reduces the cost considerably. So
- 10:27we saw that when we were measuring this
- 10:30agents would spend let's say 300k on
- 10:32certain on 100 gigs of data if they're
- 10:35trying to analyze it consistently. And
- 10:39if we use Cogni we would halve that
- 10:41price.
- 10:42But that's still you know 150k need to
- 10:44pay for 100 gigs of data and that's too
- 10:47expensive. But with small models we just
- 10:50pay for the CPU we use to process the
- 10:52data with the small models so that ends
- 10:54up being just the cost of the AWS or
- 10:57other providers CPUs you buy which are
- 11:01you know 80 bucks for 16 gigs of RAM if
- 11:03you want to get something running and
- 11:05that process is quite a lot of data. We
- 11:07usually run war and peace on on our
- 11:09nightly benchmarks because it's a lot of
- 11:11text and we've seen the speed
- 11:14jump so much higher on P50s and P95s
- 11:17than anything else we've had before. And
- 11:20if you ever tried to manage hosted or
- 11:22have your own GPUs hosted on base 10 and
- 11:24other places you'll see the issues with
- 11:27you know warmups and and costs and
- 11:29things exploding and you know it's quite
- 11:30difficult and for most of the businesses
- 11:33not really easy to manage in current
- 11:34scale at scale. So this for us is is a
- 11:38big deal and we also believe that you
- 11:39should not give your data to OpenAI and
- 11:41Tropic so they can fine-tune their
- 11:43models. That's just my political belief.
- 11:45You don't believe what you want but down
- 11:47the line we people to rate models in the
- 11:49future.
- 11:51Cogni runs on a few systems local Cogni
- 11:54managed cloud and edge. We have a
- 11:56product that runs on the phone. If you
- 11:58come to me at the later I can show you
- 12:00the version that I have running on my
- 12:02phone fully locally airplane mode can
- 12:04create memory search memory and this is
- 12:07something we work with the bigger set of
- 12:09that can
- 12:11check it.
- 12:12So that's uh that and then the
- 12:14improvement layer. We're publishing a
- 12:16couple of papers on this but down the
- 12:18line uh what we do is we we weigh the
- 12:20embedding space and then populate that
- 12:22back into the graph. We do some type of
- 12:24a soft delete on the graph
- 12:25representation because doing delete on
- 12:27memory is relatively dangerous since if
- 12:30you delete the data you cannot get it
- 12:32back. So what we
- 12:34is we reposition the embeddings and get
- 12:36them closer or further apart based on
- 12:38the type of interaction patterns we see
- 12:40from the users or the agents. That's our
- 12:43kind of soft re prioritization step that
- 12:45we do on the fly that happens at any
- 12:48type of query or ingestion. There is
- 12:51another couple of methods we use oh
- 12:54and uh what we also build is a meta
- 12:56representation layers of the graph so we
- 12:58try to understand habits, patterns,
- 13:00temporal and build this layer that sits
- 13:03on top of your facts that kind of
- 13:04reasons about the system. It's not just
- 13:06that you build a fact layer of some
- 13:09facts and entities but you effectively
- 13:11build also an understanding on top that
- 13:14you can then query and and and go
- 13:15through.
- 13:17Um being benchmark uh as I showed and
- 13:20then effectively ability to ingest from
- 13:22100 plus data sources we use uh a tool
- 13:24called DLT. DLT is a data loading tool
- 13:28uh startup. Many of you have heard of
- 13:31potential a lot uh but quite a nice tool
- 13:33and stop structures and standardizes any
- 13:36schema and any database ingestion to
- 13:39effectively mount type of performance
- 13:41structure so you can do every type of
- 13:42merge officer incremental load and it's
- 13:45quite quite nice to to use. Um so yeah
- 13:47we can run with any vector database
- 13:49model and any type of uh other setup and
- 13:53we have customers such as Bayer,
- 13:57University of Wyoming, a couple of other
- 13:58startups, a lot of NDAs I signed so I
- 14:01cannot talk about many of these wish I
- 14:03could uh but uh yeah. Uh and yeah this
- 14:06is the numbers they're a bit outdated
- 14:08but effectively you see around 12
- 14:10million memory generated by in open
- 14:13source around 200 k
- 14:15as thousand SDK downloads. And we are
- 14:18yet open source available. You have
- 14:20plugins for PlotCode, Codex, OpenClaw
- 14:23you can easily enable. Think we got
- 14:25listed in
- 14:27on Tropic Store the other day, so you
- 14:28should be able also to download that
- 14:30natively.
- 14:31But yeah, if you have any questions I'm
- 14:33here and I'm happy to answer after the
- 14:36during the break or whenever you need
- 14:38me.
- 14:39The major things we offer is Python
- 14:42runtime, auto ontology generation for
- 14:44businesses, Postgres and a small model
- 14:46runtime.
About this transcript
This page contains the full transcript of Why We Built Agent Memory on Postgres, Not Markdown by The Multimodal Society, generated from the public captions YouTube serves with the video. The transcript has 2,753 words across 418 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.