Agent Memory

Fornece memória de sessão de curto prazo e armazenamento SQLite de longo prazo para o AgentKit.

Agent Memory

AI-generated

Summary

Provide a combined short-term session message buffer and long-term key-value storage backed by a SQLite database for AgentKit workflows.

Inputs

  • dbPath — Absolute path to the SQLite database file. The directory will be created automatically if it does not exist.
  • windowSize — Maximum number of messages retained per session in the short-term (in-memory) buffer.

Output shape

a single object containing methods to get and add messages in a session buffer, and to get, set, and search values in the persistent store.

The short-term session buffer holds up to 'windowSize' messages per session in memory, evicting oldest sessions when exceeding 1000. The long-term storage is a key-value store persisted in SQLite at the given path, with optional TTL support. The output object includes asynchronous close functionality to release the SQLite connection.

Examples

Example 1: Manage messages in a session and persist data.

Specify 'dbPath' to point to the SQLite database file and set 'windowSize' to the desired number of messages to keep per session. Use the returned memory interface to add or retrieve session messages and persist or fetch key-value pairs.

Links

Discussion