Memory
Memories: named notes any agent of their scope can attach.
company = noclick.Memory.from_name("company", create_if_missing=True)
company.save("refunds", "Within 30 days, to the original card.", description="Our refund rules")
support = noclick.Agent.from_name("support", create_if_missing=True, instructions="...",
memories=[company]) # it reads company
closer = noclick.Agent.from_name("closer", create_if_missing=True, instructions="...",
memories=[company.writable()]) # it reads and writes itEvery agent also has a memory of its own, agent.memory, which it always
reads and writes. A memory attached to it is read-only unless attached with
writable(); every turn starts with the names and descriptions of every
entry it can read, its own memory's first.
class MemoryNamed notes any agent of its scope can attach: the account's (every user's agents may read them)
or one user's. Its entries are what agent.memory holds: a name, a one-line description, Markdown
content and a version. A memory of the account keeps two layers, as an account agent's own memory
does: its own entries, and each user's, which only that user's conversations see.
- Like every live object, it also has hydrate(), refresh() and raw.
| id | string | |
| name | string | null | Its name, unique in its scope (null for an agent's own memory). |
| description | string | null | One line saying what it holds. |
| agentId | string | null | The agent whose own memory this is (null for a memory with a name). |
| attachedTo | MemoryAttachment[] | The agents that attach it besides, and whether each writes it. |
| entryCount | number | null | How many entries it holds, in all its layers. |
| userId | string | null | |
| createdAt | Date | null | |
| updatedAt | Date | null |
createstatic
static create(
name: string,
options?: CallOptions & { description?: string },
): Promise<Memory>Create an empty memory (1-64 letters, digits and . _ -), unique by name per user, or for the
account outside asUser (a taken name throws Conflict with existingId).
The new, empty memory.
fromNamestatic
static fromName(
name: string,
options?: CallOptions & { createIfMissing?: boolean; description?: string },
): MemoryA lazy reference to the memory called name. Acting for a user, that user's own memory is found
first, then the account's. With createIfMissing the current (or given) user's is created on first use.
A memory that loads (or is created) the first time it's used. Nothing is sent yet.
fromIdstatic
static fromId(memoryId: string, options?: CallOptions): MemoryA lazy reference to a memory by id, such as an agent's own (agent.memoryId).
A memory that loads the first time you read a field. Nothing is sent yet.
getstatic
static get(memoryId: string, options?: CallOptions): Promise<Memory>Load a memory by id now; an unknown id raises noclick.NotFound.
The memory, loaded: who attaches it and how many entries it holds.
liststatic
static list(options?: ReadOptions & { limit?: number }): Promise<Memory[]>The current user's named memories and the account's (or those userFilter covers); an agent's own is agent.memory.
Return at most this many.
Which users the read covers (user_id query), instead of acting as one (user).
undefined = the ambient user (asUser), null = the account itself.
The client to send with; defaults to the module client built from NOCLICK_API_KEY.
Every matching memory, newest first, fetched page by page.
listPagestatic
static listPage(options?: ReadOptions & PageOptions): Promise<Page<Memory>>One page of named memories; pass nextCursor back as cursor.
The next_cursor of the page before; omit it for the first page.
Return at most this many.
Which users the read covers (user_id query), instead of acting as one (user).
undefined = the ambient user (asUser), null = the account itself.
The client to send with; defaults to the module client built from NOCLICK_API_KEY.
A page whose data holds the memories and whose next_cursor is None on the last page.
writable
writable(): MemoryLinkThis memory, for an agent's memories, with writes: the agent may save to it and forget from it,
not only read it. Only a call acting for the memory's own scope can attach it so.
What memories= takes for a memory the agent writes.
update
update(changes: { name?: string; description?: string }): Promise<Memory>Rename it, or change its description; an agent's own memory takes no name.
This memory, as it is now.
delete
delete(): Promise<TrashItem>Delete it and every entry in it: it goes to the trash, restorable for 30 days. While an agent attaches
it (attachedTo) this throws Conflict; an agent's own memory goes only with its agent.
Its TrashItem: restore() puts it back.
entries
entries(options?: { user?: UserOption }): Promise<MemoryEntry[]>The entries of one layer (the account's outside asUser, else the user's), by name, without their content.
Who the call acts for. Defaults to the user set by noclick.as_user (none: the account itself).
Each entry's name, description, version and when it last changed, by name; content is None
here, so read an entry for its body.
search
search(
query: string,
options?: { limit?: number; user?: UserOption },
): Promise<MemoryEntry[]>Search it the way an agent does (a user's entries and the account's): entries whose name, description
or content holds any of the query's words, best first, with content (10 unless limit says otherwise).
Return at most this many.
Who the call acts for. Defaults to the user set by noclick.as_user (none: the account itself).
The best matches first (10 unless limit says otherwise, at most 100), with their content.
read
read(name: string, options?: { user?: UserOption }): Promise<MemoryEntry>One entry in full; a name with no entry throws NotFound.
Who the call acts for. Defaults to the user set by noclick.as_user (none: the account itself).
The entry with its content and the version to pass back when you change it.
save
save(
name: string,
content: string,
options?: { description?: string; version?: number; user?: UserOption },
): Promise<MemoryEntry>Write an entry, creating it if the name is new. description is the line every agent attaching the
memory sees each turn (required for a new entry, kept when omitted). With version the save only lands
if the entry is still at that version, else Conflict.
Who the call acts for. Defaults to the user set by noclick.as_user (none: the account itself).
The entry as saved, with its new version.
forget
forget(
name: string,
options?: { version?: number; user?: UserOption },
): Promise<void>Forget an entry; with version, only if it is still at that version (else Conflict).
Who the call acts for. Defaults to the user set by noclick.as_user (none: the account itself).
None once it's gone; a name with no entry raises noclick.NotFound.
MemoryLink
class MemoryLinkA memory attached with writes (memory.writable()): the agent may change it as well as read it.
| memory | Memory | AgentMemory | |
| writes | true |