YouTube2Text

Why We Built Agent Memory on Postgres, Not Markdown — Transcript

by The Multimodal Society · 2,753 words · 418 segments · language en · Watch on YouTube

Full transcript

  1. 0:04That's I'm Cogni. Um, I flew in here
  2. 0:07from Germany. I'm spending half of my
  3. 0:09time here now in San Francisco because
  4. 0:10this is the place to be at.
  5. 0:12I worked in big data, was a data
  6. 0:14analyst, data engineer, data product
  7. 0:15manager at Building Systems at scale for
  8. 0:18a couple of unicorns in Germany, and
  9. 0:20then I got bored because when you move
  10. 0:21data from A to B, it gets to you after
  11. 0:23like a few years. So I ended up studying
  12. 0:26clinical psychology, cognitive sciences,
  13. 0:28and around three years ago, I got an
  14. 0:31idea that I should maybe do something
  15. 0:33about the LangChain and embeddings
  16. 0:35because I was trying to use vector
  17. 0:37stores and to build a app
  18. 0:39for my use cases and personal goals and
  19. 0:42optimize my my daily habits.
  20. 0:45And I could not get anything to work.
  21. 0:47Uh, I could not get reliable outputs. I
  22. 0:49had to manage all these collections in
  23. 0:51vector stores. I had to retrieve all
  24. 0:53kinds of data. Update these was also,
  25. 0:57you know, updating them was very
  26. 0:58difficult. And I saw that I couldn't do
  27. 1:01anything at scale. I was used to dealing
  28. 1:02with huge amounts of loads of data to,
  29. 1:06you know,
  30. 1:07queries at the time. And then I went to
  31. 1:1050 megabytes and everything was great.
  32. 1:12So I decided to do something about it.
  33. 1:14Started from my bedroom on my own money.
  34. 1:16Now we are to people between Berlin and
  35. 1:18San Francisco and we have around 12
  36. 1:21million memories generated.
  37. 1:23Effectively, people tried solving this
  38. 1:25with MD files. MD files not don't work
  39. 1:29really that well at scale. So you
  40. 1:32cannot, you know, use a file instead of
  41. 1:34a database. That 's why we invented
  42. 1:36databases 30 40 years ago and the
  43. 1:39reasoning of why is
  44. 1:41you need concurrency, you need
  45. 1:43many processes to read and write and
  46. 1:45lock and index and retrieve at scale
  47. 1:49where there is a lot of data in one
  48. 1:50place. And you can only get as far with
  49. 1:54a bunch of files after it after which it
  50. 1:57will start working. I think Gary Tran's
  51. 1:59G Brain is a good of that where you end
  52. 2:01up with 16,000 MD files that you are
  53. 2:03parsing through and and you're going to
  54. 2:05end up in trouble.
  55. 2:06And it doesn't really solve this problem
  56. 2:08of you know scattered knowledge that the
  57. 2:10business is going to have all kinds of
  58. 2:12data in different places, that the
  59. 2:14agents repeat themselves, that the model
  60. 2:17itself doesn't know really your domain.
  61. 2:19What that means is that you know you
  62. 2:21might work in manufacturing, chemical
  63. 2:23industry, this that where you know
  64. 2:25knowledge of how the processes work and
  65. 2:27operate is really particular to your
  66. 2:28company and your domain.
  67. 2:30And that's something that we call an
  68. 2:31ontology, this representation of
  69. 2:35knowledge that needs to sit in between
  70. 2:37your agent and your system. And that's
  71. 2:38what we are building with Cogni.
  72. 2:40We've been doing this for three years.
  73. 2:42I deployed the first version on a
  74. 2:44WhatsApp chatbot with 20,000 users. It
  75. 2:47failed miserably. And then I realized
  76. 2:49that you know this is going to be a bit
  77. 2:50more difficult than I assumed. And as I
  78. 2:52was doing that I understood that we
  79. 2:53don't need an opinionated
  80. 2:55memory model
  81. 2:57where you say hey this is memory.
  82. 2:59I understood we need an engine that can
  83. 3:00construct memory as any type of a data
  84. 3:03pipeline will be constructed in the
  85. 3:04previous iteration of this cycle where I
  86. 3:07can
  87. 3:08create modules of memory
  88. 3:09transformations. I can build graph
  89. 3:11vector representations in pure Python
  90. 3:13without expecting from people and agents
  91. 3:15to learn how to use these complex setups
  92. 3:18in the back end.
  93. 3:19And that should be sitting in between
  94. 3:21your data and your agents and feed both
  95. 3:24from your agents sources but also from
  96. 3:26your
  97. 3:27cloud code, Codex and data bricks of the
  98. 3:30world you know PDFs, docs and everything
  99. 3:32else.
  100. 3:34We work hard on thinking how do we
  101. 3:36actually and where do we store the data.
  102. 3:38Falcor is one great option because you
  103. 3:40can do thousand of agents with thousands
  104. 3:42of databases as a key value store.
  105. 3:45The problem with it is then you still
  106. 3:46need another database. So we managed to
  107. 3:48dump everything into Postgres.
  108. 3:50And that means that for every agent you
  109. 3:52can have a small Postgres instance and
  110. 3:54you know if you use sandboxes you can
  111. 3:55have something similar for memory. We
  112. 3:57call it memory box. So you know
  113. 3:59trademark there here hopefully someone
  114. 4:01steals it in a few weeks on Twitter or
  115. 4:03something. But the point here is every
  116. 4:06type of an implementation that you do
  117. 4:08can be then isolated per agent, per
  118. 4:10team, per user, per org. And where is
  119. 4:14that doesn't fail is that even if you
  120. 4:16build this
  121. 4:17and although it's hard to maintain, we
  122. 4:19add the self-improvement loop so you can
  123. 4:21continuously change and update the
  124. 4:23schema that the agent is dealing with
  125. 4:25without actually having to do that
  126. 4:26manually.
  127. 4:27So how it works in the background,
  128. 4:29we effectively have this layer that is
  129. 4:32multimodal ingestion.
  130. 4:34We can pull in from any type of a data
  131. 4:35source. It's not real multimodal
  132. 4:37ingestion. I'm kind of faking it a bit.
  133. 4:39We turn everything to text in this
  134. 4:40layer. So someone from OpenAI was was
  135. 4:42calling me out on this the other day.
  136. 4:45But down the line it doesn't really
  137. 4:46matter. For us it works quite well. We
  138. 4:49do knowledge structuring. We extend
  139. 4:50PyDantic objects and create a PyDantic
  140. 4:53representation of the graph and then
  141. 4:55store that in any type of a graph and
  142. 4:56vector store. So Falcor supported.
  143. 4:58Others are supported too. You can pretty
  144. 5:00much use what you want. We have an
  145. 5:02access control and isolation layer. So
  146. 5:04the full ACL table where you define read
  147. 5:06write permissions per agent, per tenant.
  148. 5:09You can spin up as many tenants as you
  149. 5:10want. The
  150. 5:12deployment we know of is AstraZeneca in
  151. 5:14China with 300 tenants right now. We
  152. 5:16have around 12 million
  153. 5:17memory generated each month and around
  154. 5:1960 companies that we know of using us in
  155. 5:21production out of 500 production runs on
  156. 5:23telemetry.
  157. 5:25Anonymized, we don't know the details.
  158. 5:27But effectively the idea here is they
  159. 5:29are using it effectively because of this
  160. 5:31feature often enough and they can use
  161. 5:33the access control and isolation to make
  162. 5:35sure that nothing is polluting context
  163. 5:37for different agents in the organization
  164. 5:39and different user groups.
  165. 5:40We have retrieval strategies, everything
  166. 5:42from temporal code. You can pull in
  167. 5:45whole GitHub repos and understand them,
  168. 5:47but we can also ask complex questions
  169. 5:49that require multi-hop reasoning. And on
  170. 5:52top of that we have feedback loops. So
  171. 5:54you can provide feedback to the system.
  172. 5:56It is going automatically improve. You
  173. 5:57can run improvements on embeddings,
  174. 6:00improvements on the graphs. We weight
  175. 6:02and we scale certain subgraphs. All of
  176. 6:04that is kind of baked in into the system
  177. 6:05and you can switch on and off these
  178. 6:07transformation layers so you can really
  179. 6:09play around with it and use what you
  180. 6:11need or extend them yourself. Any type
  181. 6:13of additional feature can be done with a
  182. 6:15simple Python function that transforms
  183. 6:18data model that is that is passing
  184. 6:20through the pipe.
  185. 6:22How it works a bit more in detail, I
  186. 6:23would have shown you my personal brain,
  187. 6:25but since I can't connect for some
  188. 6:26reason,
  189. 6:27I'll leave it on theory here. We have
  190. 6:30effectively agents from Life Site.
  191. 6:32Agents feed their context here into the
  192. 6:36session memory. Session memory is fed by
  193. 6:40intercepting hooks on
  194. 6:44So, you know, if you do user prompt
  195. 6:45submit, we take the context from here,
  196. 6:47put it into session memory, apply
  197. 6:50distillation and get the information we
  198. 6:52need, facts and and whatever is
  199. 6:53relevant, and then we store that into
  200. 6:55the permanent memory. I don't like
  201. 6:57long-term, short-term procedural memory.
  202. 7:00I think I started the same way thinking
  203. 7:02about it.
  204. 7:03Then I understood that kind of grouping
  205. 7:05memories into these types of groups, you
  206. 7:07only then have N groups of memory,
  207. 7:09you know, like three, four, but we need
  208. 7:11thousands of groups of memories that
  209. 7:13represent any type of a possible use
  210. 7:15case that you can dynamically define.
  211. 7:17So, for us, there is only two concepts,
  212. 7:19session memory where agents store their
  213. 7:21data as a temporary data store, a cache
  214. 7:24of sorts, and a permanent memory which
  215. 7:25is a graph vector representation that
  216. 7:27can also live in object storage.
  217. 7:29This graph vector representation is
  218. 7:31feeding also from the data sources,
  219. 7:33Google Drive, any other connector. We
  220. 7:35have 100 plus and a current hackathon
  221. 7:37with I think more than 500 participants
  222. 7:40online but are
  223. 7:42coding new connectors as we speak.
  224. 7:45Our goal here with the data sources is
  225. 7:46not to really copy all of the data from
  226. 7:48the existing system into the memory,
  227. 7:50that would be slow, expensive, and
  228. 7:52inefficient, is just to get actually the
  229. 7:54base structure of that data so we can
  230. 7:57effectively let agents navigate back to
  231. 7:59the original system and get the context
  232. 8:01they need. So, this thinks of that think
  233. 8:04of this more as a mind map of the system
  234. 8:06than effectively a full data storage
  235. 8:08layer because that wouldn't work because
  236. 8:12most of the organizations and users
  237. 8:14would be copying things over all the
  238. 8:15time.
  239. 8:17How it works in practice organized
  240. 8:19memory is
  241. 8:21we can organize it to agent memory, user
  242. 8:23memory, team memory, organization memory
  243. 8:25so you can really define different
  244. 8:26groups and you can put people in all
  245. 8:28those groups and then you can promote
  246. 8:30memory from one to other.
  247. 8:31So what happens here is I can say it
  248. 8:33from to my agent hey you know promote
  249. 8:35the memory to my
  250. 8:37personal knowledge because it's relevant
  251. 8:38for me but then I can tell it like send
  252. 8:40this to my team Josh should pick up my
  253. 8:42tasks that I was working on yesterday
  254. 8:45and you know the stand up he complained
  255. 8:47how he doesn't know what I did so now he
  256. 8:48has all the agent contacts so no more
  257. 8:50excuses for Josh
  258. 8:52So we all heard this if we worked in a
  259. 8:54software engineering team you know there
  260. 8:56is always that that problem context but
  261. 8:58effectively we can also promote that to
  262. 9:00organizational memory where we have more
  263. 9:02of a general information that
  264. 9:04organizations store and often enough
  265. 9:06what we see stored here is contracts you
  266. 9:07know mission vision or those types of
  267. 9:09things that shouldn't be changed too
  268. 9:11often but can really provide useful
  269. 9:13context of how business operates.
  270. 9:16So we've benchmarked Cogni, we
  271. 9:18benchmarked it on beam on 10 million and
  272. 9:20100k
  273. 9:22chunks so we
  274. 9:23got 79% accuracy. Locomo is coming out
  275. 9:27this week. We didn't want to do that
  276. 9:29earlier because it was we felt a bit too
  277. 9:31easy if you score over 90% on a
  278. 9:33benchmark not a good benchmark
  279. 9:35and then what we also have with Cogni is
  280. 9:38the ability to
  281. 9:41process it in your own VPC with bringing
  282. 9:44your own cloud or you can self deploy
  283. 9:45it. We are fully open source so if you
  284. 9:47want to manage it yourself you can. We
  285. 9:49provide you with a couple of things like
  286. 9:51adapters and other things that make it
  287. 9:53easier and also we recently released a
  288. 9:56small model runtime.
  289. 9:58What's the small model runtime? You can
  290. 10:00run Cogni completely free with small
  291. 10:01models.
  292. 10:02Fastino Labs released Glider 2.5. They
  293. 10:04have a party tonight. I'm missing
  294. 10:06because I'm here so I wanted to meet
  295. 10:07those guys too but since I 'm using
  296. 10:09their models But down the line Fastino
  297. 10:12allows us to do entity extraction in
  298. 10:14open source version of Cogni for free.
  299. 10:16So you're not calling OpenAI and Tropic
  300. 10:20to get your
  301. 10:21let's say structure of the graph
  302. 10:24anymore,
  303. 10:25which reduces the cost considerably. So
  304. 10:27we saw that when we were measuring this
  305. 10:30agents would spend let's say 300k on
  306. 10:32certain on 100 gigs of data if they're
  307. 10:35trying to analyze it consistently. And
  308. 10:39if we use Cogni we would halve that
  309. 10:41price.
  310. 10:42But that's still you know 150k need to
  311. 10:44pay for 100 gigs of data and that's too
  312. 10:47expensive. But with small models we just
  313. 10:50pay for the CPU we use to process the
  314. 10:52data with the small models so that ends
  315. 10:54up being just the cost of the AWS or
  316. 10:57other providers CPUs you buy which are
  317. 11:01you know 80 bucks for 16 gigs of RAM if
  318. 11:03you want to get something running and
  319. 11:05that process is quite a lot of data. We
  320. 11:07usually run war and peace on on our
  321. 11:09nightly benchmarks because it's a lot of
  322. 11:11text and we've seen the speed
  323. 11:14jump so much higher on P50s and P95s
  324. 11:17than anything else we've had before. And
  325. 11:20if you ever tried to manage hosted or
  326. 11:22have your own GPUs hosted on base 10 and
  327. 11:24other places you'll see the issues with
  328. 11:27you know warmups and and costs and
  329. 11:29things exploding and you know it's quite
  330. 11:30difficult and for most of the businesses
  331. 11:33not really easy to manage in current
  332. 11:34scale at scale. So this for us is is a
  333. 11:38big deal and we also believe that you
  334. 11:39should not give your data to OpenAI and
  335. 11:41Tropic so they can fine-tune their
  336. 11:43models. That's just my political belief.
  337. 11:45You don't believe what you want but down
  338. 11:47the line we people to rate models in the
  339. 11:49future.
  340. 11:51Cogni runs on a few systems local Cogni
  341. 11:54managed cloud and edge. We have a
  342. 11:56product that runs on the phone. If you
  343. 11:58come to me at the later I can show you
  344. 12:00the version that I have running on my
  345. 12:02phone fully locally airplane mode can
  346. 12:04create memory search memory and this is
  347. 12:07something we work with the bigger set of
  348. 12:09that can
  349. 12:11check it.
  350. 12:12So that's uh that and then the
  351. 12:14improvement layer. We're publishing a
  352. 12:16couple of papers on this but down the
  353. 12:18line uh what we do is we we weigh the
  354. 12:20embedding space and then populate that
  355. 12:22back into the graph. We do some type of
  356. 12:24a soft delete on the graph
  357. 12:25representation because doing delete on
  358. 12:27memory is relatively dangerous since if
  359. 12:30you delete the data you cannot get it
  360. 12:32back. So what we
  361. 12:34is we reposition the embeddings and get
  362. 12:36them closer or further apart based on
  363. 12:38the type of interaction patterns we see
  364. 12:40from the users or the agents. That's our
  365. 12:43kind of soft re prioritization step that
  366. 12:45we do on the fly that happens at any
  367. 12:48type of query or ingestion. There is
  368. 12:51another couple of methods we use oh
  369. 12:54and uh what we also build is a meta
  370. 12:56representation layers of the graph so we
  371. 12:58try to understand habits, patterns,
  372. 13:00temporal and build this layer that sits
  373. 13:03on top of your facts that kind of
  374. 13:04reasons about the system. It's not just
  375. 13:06that you build a fact layer of some
  376. 13:09facts and entities but you effectively
  377. 13:11build also an understanding on top that
  378. 13:14you can then query and and and go
  379. 13:15through.
  380. 13:17Um being benchmark uh as I showed and
  381. 13:20then effectively ability to ingest from
  382. 13:22100 plus data sources we use uh a tool
  383. 13:24called DLT. DLT is a data loading tool
  384. 13:28uh startup. Many of you have heard of
  385. 13:31potential a lot uh but quite a nice tool
  386. 13:33and stop structures and standardizes any
  387. 13:36schema and any database ingestion to
  388. 13:39effectively mount type of performance
  389. 13:41structure so you can do every type of
  390. 13:42merge officer incremental load and it's
  391. 13:45quite quite nice to to use. Um so yeah
  392. 13:47we can run with any vector database
  393. 13:49model and any type of uh other setup and
  394. 13:53we have customers such as Bayer,
  395. 13:57University of Wyoming, a couple of other
  396. 13:58startups, a lot of NDAs I signed so I
  397. 14:01cannot talk about many of these wish I
  398. 14:03could uh but uh yeah. Uh and yeah this
  399. 14:06is the numbers they're a bit outdated
  400. 14:08but effectively you see around 12
  401. 14:10million memory generated by in open
  402. 14:13source around 200 k
  403. 14:15as thousand SDK downloads. And we are
  404. 14:18yet open source available. You have
  405. 14:20plugins for PlotCode, Codex, OpenClaw
  406. 14:23you can easily enable. Think we got
  407. 14:25listed in
  408. 14:27on Tropic Store the other day, so you
  409. 14:28should be able also to download that
  410. 14:30natively.
  411. 14:31But yeah, if you have any questions I'm
  412. 14:33here and I'm happy to answer after the
  413. 14:36during the break or whenever you need
  414. 14:38me.
  415. 14:39The major things we offer is Python
  416. 14:42runtime, auto ontology generation for
  417. 14:44businesses, Postgres and a small model
  418. 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.