memory

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentMemory

type AgentMemory struct {
	// ID is a unique identifier for this memory record
	ID types.AgentMemoryID

	// AgentID identifies which agent this memory belongs to (e.g., "bigquery")
	AgentID string

	// TaskQuery is the original natural language query that triggered this execution
	TaskQuery string

	// QueryEmbedding is the vector embedding of TaskQuery for semantic search
	// Generated automatically by Memory Service when saving
	// Must use firestore.Vector32 type for Firestore vector search to work
	QueryEmbedding firestore.Vector32

	// Timestamp records when this task was executed
	Timestamp time.Time

	// Duration records how long the task took to complete
	Duration time.Duration

	// Successes is a list of successful patterns observed (K: Keep in KPT format)
	// Contains domain knowledge about what worked: field semantics, data formats, query patterns
	// Example: ["Login failures identified by severity='ERROR' AND action='login'. User ID is user.email (STRING) not user.id (INT64)"]
	Successes []string

	// Problems is a list of issues encountered during execution (P: Problem in KPT format)
	// Contains domain knowledge mistakes: wrong field assumptions, unexpected data formats
	// Example: ["Expected 'timestamp' field but actual field is 'event_time' (TIMESTAMP type). user_id is INT64 not STRING email"]
	Problems []string

	// Improvements is a list of suggestions for future executions (T: Try in KPT format)
	// Contains specific domain knowledge to apply: which fields to use, expected formats, search patterns
	// Example: ["For user searches: use user.email (STRING) not user_id (INT64). For errors: check error_code field values"]
	Improvements []string
}

AgentMemory represents a memory record for Sub-Agent execution history This model follows the KPT (Keep/Problem/Try) format for storing execution experiences

func (*AgentMemory) Validate

func (m *AgentMemory) Validate() error

Validate checks if the AgentMemory is valid

type ExecutionMemory

type ExecutionMemory struct {
	ID       types.MemoryID    `json:"id"`
	SchemaID types.AlertSchema `json:"schema_id"`
	Summary  string            `json:"summary"`
	Keep     string            `json:"keep"`
	Change   string            `json:"change"`
	Notes    string            `json:"notes"`

	// Embedding is the vector embedding of Summary for semantic search
	// Generated automatically by Memory Service when saving
	// Must use firestore.Vector32 type for Firestore vector search to work
	Embedding firestore.Vector32 `json:"embedding,omitempty"`

	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Version   int       `json:"version"`
}

ExecutionMemory represents learning from task execution

func NewExecutionMemory

func NewExecutionMemory(schemaID types.AlertSchema) *ExecutionMemory

NewExecutionMemory creates a new ExecutionMemory with a unique ID

func (*ExecutionMemory) IsEmpty

func (m *ExecutionMemory) IsEmpty() bool

IsEmpty returns true if the memory has no content

func (*ExecutionMemory) String

func (m *ExecutionMemory) String() string

String returns a Markdown-formatted representation of the memory

func (*ExecutionMemory) Validate

func (m *ExecutionMemory) Validate() error

Validate validates the ExecutionMemory

type TicketMemory

type TicketMemory struct {
	ID        types.MemoryID    `json:"id"`
	SchemaID  types.AlertSchema `json:"schema_id"`
	Insights  string            `json:"insights"`
	CreatedAt time.Time         `json:"created_at"`
	UpdatedAt time.Time         `json:"updated_at"`
	Version   int               `json:"version"`
}

TicketMemory represents organizational knowledge from ticket resolution

func NewTicketMemory

func NewTicketMemory(schemaID types.AlertSchema) *TicketMemory

NewTicketMemory creates a new TicketMemory with a unique ID

func (*TicketMemory) IsEmpty

func (m *TicketMemory) IsEmpty() bool

IsEmpty returns true if the memory has no content

func (*TicketMemory) String

func (m *TicketMemory) String() string

String returns a Markdown-formatted representation of the memory

func (*TicketMemory) Validate

func (m *TicketMemory) Validate() error

Validate validates the TicketMemory

Jump to

Keyboard shortcuts

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