Memory Agent Nodes
Query the long-term memory database (RAG) and unpack the returned memory documents.
3 nodes.
| Node | Registry path |
|---|---|
| Query Context DB | agents/memory/QueryContextDB |
| Referenced Characters | agents/memory/ReferencedCharacters |
| Unpack Memory Document | agents/memory/UnpackMemoryDocument |
Query Context DB
agents/memory/QueryContextDB
Queries the memory agent's context database with one or more queries and collects the matching documents, up to a total token budget.
Inputs
| Input | Type | Description |
|---|---|---|
state |
any |
The graph state |
queries |
list,str |
(optional) The queries to run (list, or a single query string) |
meta_filters |
dict |
Metadata filters to constrain the results (optional) |
max_tokens |
int |
The maximum total tokens of results to return (optional) |
fn_filter |
function |
Function that receives a result and returns whether to keep it (optional) |
fn_formatter |
function |
Function that receives a result and returns its formatted replacement (optional) |
viewer |
str,character |
Return only what this character knows (optional). With Character Perspectives on, results come from the character's own memories; otherwise entries the character does not know are left out. |
Outputs
| Output | Type | Description |
|---|---|---|
state |
any |
The state input, passed through |
results |
list |
The list of matching documents |
Properties
| Property | Type | Default | Description |
|---|---|---|---|
queries |
list |
[] |
The queries to use to query the context database |
meta_filters |
dict |
{} |
The meta filters to apply to the results |
max_tokens |
int |
1024 |
The maximum number of tokens to return |
limit |
int |
10 |
The number of N best results to consider per query |
iterate |
int |
3 |
The number of results to return per query |
Referenced Characters
agents/memory/ReferencedCharacters
Which characters a text refers to, by name, by a mapped alias or, with the decision model, by pronoun, title or nickname ("her brother", "the Captain"). The candidates default to the characters not in the scene.
Uses the memory agent's entity lookup setting "Use Decision Model" and the same editable decision policy; without a decision model, or when it is uncertain, names and aliases are matched in the text.
Inputs
| Input | Type | Description |
|---|---|---|
state |
any |
graph state (passthrough) |
text |
str |
the text to check |
candidates |
list |
character names to check (optional) |
Outputs
| Output | Type | Description |
|---|---|---|
state |
any |
graph state |
characters |
list |
the candidates the text refers to, in candidate order |
Unpack Memory Document
agents/memory/UnpackMemoryDocument
Unpacks a memory document into its individual fields.
Inputs
| Input | Type | Description |
|---|---|---|
document |
memory/document |
The memory document to unpack |
Outputs
| Output | Type | Description |
|---|---|---|
document |
memory/document |
The memory document, passed through |
meta |
dict |
The document's metadata dict |
id |
str |
The document's ID in the memory database |
raw |
dict |
The document's raw content |
as_text |
str |
The document rendered as text |
as_dict |
dict |
The document as a dict |
context_id |
context_id |
The document's context ID |