Documentation
¶
Index ¶
- Variables
- type APIError
- type AddMemoryRequest
- type Agent
- type AgentStats
- type Client
- func (c *Client) AddMemories(ctx context.Context, memories []*AddMemoryRequest) ([]Memory, error)
- func (c *Client) AddMemory(ctx context.Context, req *AddMemoryRequest) (*Memory, error)
- func (c *Client) CloseSession(ctx context.Context, id string) (*Session, error)
- func (c *Client) CreateSession(ctx context.Context, req *CreateSessionRequest) (*Session, error)
- func (c *Client) Decide(ctx context.Context, agentID, decision, reasoning string) (*Memory, error)
- func (c *Client) GetAgent(ctx context.Context, id string) (*Agent, error)
- func (c *Client) GetAgentStats(ctx context.Context, id string) (*AgentStats, error)
- func (c *Client) GetSession(ctx context.Context, id string) (*Session, error)
- func (c *Client) GetSessionContext(ctx context.Context, id string, opts *ContextOptions) (*SessionContext, error)
- func (c *Client) ListMemories(ctx context.Context, opts *ListOptions) (*MemoryList, error)
- func (c *Client) Recall(ctx context.Context, agentID string, since string) (*MemoryList, error)
- func (c *Client) RegisterAgent(ctx context.Context, req *RegisterAgentRequest) (*Agent, error)
- func (c *Client) Remember(ctx context.Context, agentID, content string) (*Memory, error)
- func (c *Client) SearchMemories(ctx context.Context, query *SearchQuery) (*SearchResult, error)
- type ContextOptions
- type CreateSessionRequest
- type ListOptions
- type Memory
- type MemoryList
- type RegisterAgentRequest
- type SearchQuery
- type SearchResult
- type Session
- type SessionContext
Constants ¶
This section is empty.
Variables ¶
var ErrNoArcInstance = errors.New("no arc instance configured for org")
ErrNoArcInstance is returned (wrapped) when the caller's organization has no Arc instance configured. Memtrace deployments are multi-tenant; an administrator must run `memtrace org add-arc <org_id>` before that organization can read or write memories. Use errors.Is to test.
if errors.Is(err, sdk.ErrNoArcInstance) {
// surface a clearer message to the user
}
Functions ¶
This section is empty.
Types ¶
type APIError ¶
APIError is the typed error returned by every Client method on a non-2xx response. It exposes the HTTP status code and the server's `error` message so callers can branch on either. APIError wraps ErrNoArcInstance when the server reports a missing Arc instance, so errors.Is(err, ErrNoArcInstance) works without the caller needing to know about APIError.
type AddMemoryRequest ¶
type AddMemoryRequest struct {
AgentID string `json:"agent_id"`
SessionID string `json:"session_id,omitempty"`
MemoryType string `json:"memory_type"`
EventType string `json:"event_type"`
Content string `json:"content"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
Tags []string `json:"tags,omitempty"`
DedupKey string `json:"dedup_key,omitempty"`
Importance float64 `json:"importance,omitempty"`
ParentID string `json:"parent_id,omitempty"`
}
AddMemoryRequest is the request body for adding a memory
type Agent ¶
type Agent struct {
ID string `json:"id"`
OrgID string `json:"org_id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Config map[string]interface{} `json:"config,omitempty"`
CreatedAt time.Time `json:"created_at"`
LastActiveAt *time.Time `json:"last_active_at,omitempty"`
}
Agent represents a registered agent
type AgentStats ¶
type AgentStats struct {
AgentID string `json:"agent_id"`
MemoryCount int `json:"memory_count"`
Memories24h int `json:"memories_24h"`
Errors24h int `json:"errors_24h"`
SessionCount int `json:"session_count"`
ActiveSessions int `json:"active_sessions"`
LastActiveAt *time.Time `json:"last_active_at,omitempty"`
MemoryTypes map[string]int `json:"memory_types"`
}
AgentStats represents memory statistics for an agent
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the memtrace Go SDK client
func (*Client) AddMemories ¶
AddMemories stores multiple memories in a batch
func (*Client) CloseSession ¶
CloseSession closes a session
func (*Client) CreateSession ¶
CreateSession starts a new session
func (*Client) GetAgentStats ¶
GetAgentStats returns memory stats for an agent
func (*Client) GetSession ¶
GetSession returns a session by ID
func (*Client) GetSessionContext ¶
func (c *Client) GetSessionContext(ctx context.Context, id string, opts *ContextOptions) (*SessionContext, error)
GetSessionContext returns LLM-formatted session context
func (*Client) ListMemories ¶
func (c *Client) ListMemories(ctx context.Context, opts *ListOptions) (*MemoryList, error)
ListMemories lists memories with filters
func (*Client) RegisterAgent ¶
RegisterAgent registers a new agent
func (*Client) SearchMemories ¶
func (c *Client) SearchMemories(ctx context.Context, query *SearchQuery) (*SearchResult, error)
SearchMemories searches memories with structured filters
type ContextOptions ¶
type ContextOptions struct {
MaxTokens int `json:"max_tokens,omitempty"`
IncludeTypes []string `json:"include_types,omitempty"`
Since string `json:"since,omitempty"`
}
ContextOptions controls how session context is formatted
type CreateSessionRequest ¶
type CreateSessionRequest struct {
AgentID string `json:"agent_id"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
CreateSessionRequest is the request body for creating a session
type ListOptions ¶
type ListOptions struct {
AgentID string `json:"agent_id,omitempty"`
SessionID string `json:"session_id,omitempty"`
MemoryType string `json:"memory_type,omitempty"`
EventType string `json:"event_type,omitempty"`
Tags string `json:"tags,omitempty"`
Since string `json:"since,omitempty"`
Until string `json:"until,omitempty"`
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
Order string `json:"order,omitempty"`
}
ListOptions defines filters for listing memories
type Memory ¶
type Memory struct {
Time time.Time `json:"time"`
OrgID string `json:"org_id"`
AgentID string `json:"agent_id"`
SessionID string `json:"session_id,omitempty"`
MemoryType string `json:"memory_type"`
EventType string `json:"event_type"`
Content string `json:"content"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
Tags []string `json:"tags,omitempty"`
DedupKey string `json:"dedup_key,omitempty"`
Importance float64 `json:"importance,omitempty"`
ParentID string `json:"parent_id,omitempty"`
}
Memory represents a stored memory event
type MemoryList ¶
type MemoryList struct {
Memories []Memory `json:"memories"`
Count int `json:"count"`
HasMore bool `json:"has_more"`
}
MemoryList is the response for listing memories
type RegisterAgentRequest ¶
type RegisterAgentRequest struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Config map[string]interface{} `json:"config,omitempty"`
}
RegisterAgentRequest is the request body for registering an agent
type SearchQuery ¶
type SearchQuery struct {
AgentID string `json:"agent_id,omitempty"`
SessionID string `json:"session_id,omitempty"`
MemoryTypes []string `json:"memory_types,omitempty"`
EventTypes []string `json:"event_types,omitempty"`
Tags []string `json:"tags,omitempty"`
ContentContains string `json:"content_contains,omitempty"`
Since string `json:"since,omitempty"`
Until string `json:"until,omitempty"`
MinImportance float64 `json:"min_importance,omitempty"`
Limit int `json:"limit,omitempty"`
Order string `json:"order,omitempty"`
}
SearchQuery is the request body for searching memories
type SearchResult ¶
type SearchResult struct {
Results []Memory `json:"results"`
Count int `json:"count"`
QueryTimeMS int64 `json:"query_time_ms"`
}
SearchResult is the response for searching memories
type Session ¶
type Session struct {
ID string `json:"id"`
OrgID string `json:"org_id"`
AgentID string `json:"agent_id"`
Status string `json:"status"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ClosedAt *time.Time `json:"closed_at,omitempty"`
}
Session represents a bounded context for agent work
type SessionContext ¶
type SessionContext struct {
SessionID string `json:"session_id"`
Context string `json:"context"`
MemoryCount int `json:"memory_count"`
}
SessionContext is the LLM-ready context for a session