abstraction

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package memory provides abstract access to the agent's memory.

"Memory" in OpenBotStack is:

  • Short-term: Current conversation context
  • Long-term: Vector-stored knowledge (Milvus abstraction)
  • Entity: Structured facts about known entities

This package defines interfaces ONLY. The actual storage implementation lives in openbotstack-runtime or external infrastructure.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMemoryNotFound is returned when a memory ID does not exist.
	ErrMemoryNotFound = errors.New("memory: not found")

	// ErrStoreFailed is returned when storing a memory entry fails.
	ErrStoreFailed = errors.New("memory: store failed")

	// ErrRetrieveFailed is returned when retrieving memories fails.
	ErrRetrieveFailed = errors.New("memory: retrieve failed")

	// ErrSummarizeFailed is returned when memory summarization fails.
	ErrSummarizeFailed = errors.New("memory: summarize failed")
)

Functions

This section is empty.

Types

type MemoryEntry

type MemoryEntry struct {
	// ID is a unique identifier for this memory entry.
	ID string

	// Content is the raw text content.
	Content string

	// Embedding is the vector embedding (may be nil if not yet computed).
	Embedding []float32

	// Tags are categorical labels for structured retrieval.
	Tags []string

	// Metadata contains arbitrary key-value pairs.
	Metadata map[string]string

	// CreatedAt is when this entry was created.
	CreatedAt time.Time

	// TTL is the time-to-live; nil means no expiry.
	TTL *time.Duration
}

MemoryEntry represents a single unit of memory.

type MemoryManager

type MemoryManager interface {
	// StoreShortTerm saves conversation-scoped entries.
	// Entry expires after session ends.
	StoreShortTerm(ctx context.Context, entry MemoryEntry) error

	// StoreLongTerm saves entries to vector storage.
	// Entry is embedded and persisted for retrieval.
	StoreLongTerm(ctx context.Context, entry MemoryEntry) error

	// RetrieveSimilar performs semantic search for relevant memories.
	// Returns entries ordered by relevance score (descending).
	// limit <= 0 means use system default.
	RetrieveSimilar(ctx context.Context, query string, limit int) ([]MemoryEntry, error)

	// RetrieveByTag returns memories matching all specified tags.
	RetrieveByTag(ctx context.Context, tags []string, limit int) ([]MemoryEntry, error)

	// Forget removes a specific memory entry.
	// Returns ErrMemoryNotFound if ID doesn't exist.
	Forget(ctx context.Context, id string) error

	// Summarize triggers compaction of memories.
	// Used when context window pressure requires aggregation.
	Summarize(ctx context.Context, entries []MemoryEntry) (MemoryEntry, error)
}

MemoryManager provides abstract access to the agent's memory.

This interface is ONLY an abstraction. The actual storage implementation lives in openbotstack-runtime or external infra.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL