Repository navigation
docs: an agent-memory how-to page, with every block run by a test - #498
Merged
Merged
Conversation
Item 4 of #306 asks for one page on agent-memory use. The page builds a small memory in one database: messages as documents, facts as vertices linked to what they mention, and an embedding on each fact. It covers the six tasks that the docs did not show (store with links, upsert by key, latest rows as dicts, filtered nearest neighbours, delete an entity with its facts, remove duplicates), what a search sees right after a write, and how the vector index behaves as it grows. The statements are SQL and openCypher through db.command and db.query. The sizes and thresholds are read from the 26.12.1 engine sources, and the page says that it gives no size from which the graph beats an exact scan, because none was measured. tests/test_docs_agent_memory_page.py runs every block on both packages and compares the printed text, reports every block that differs, and calls the page's functions on more data. Refs #306
The tests that reopen the page's database failed in CI on both packages: they ran the page after os.chdir and its path is relative. On the native package the run-again test counted the 5 facts of an earlier test, and on both packages the reopened database had no type Memory. The tests now replace the page's path with an absolute one, the run-again test checks that a row survives, and the page says to use an absolute path after os.chdir.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds the how-to page "Agent memory" (
docs/modules/ROOT/pages/how-to/agent-memory.adoc). It builds a small agent memory in one database, with messages as documents, facts linked in a graph, and an embedding on each fact:The statements are SQL and openCypher through
db.commandanddb.query. The page gives no collection size from which the graph index beats an exact scan, because I have not measured one. It shows how to compare the two instead. The sizes and thresholds it does state come from the 26.12.1 engine sources.While testing I found that on both packages a relative database path does not open the same directory after
os.chdir. The page says to use an absolute path in that case, and the tests do so.Related issues
Refs #306 (the docs page, item 4). The issue stays open for item 3, which needs a measurement first.
Docs
The new page, its nav entry, a link from "Vectors", and the list of how-to pages in
README.md.Checklist
tests/test_docs_agent_memory_page.pyruns every block of the page on both packages, compares the printed output, and calls the page's functions on more datauvx pre-commit run --files <changed files>passes (ShellCheck and hadolint skipped, no shell or Docker file changed)