Documentation
¶
Index ¶
- func BuildWhereClause(clauses ...Clause) string
- func ParseMessages(messages []Event) ([]*protocol.Message, error)
- func ParseTasks(tasks []Task) ([]*protocol.Task, error)
- type Agent
- type Clause
- type Client
- type Config
- type CrewAIAgentMemory
- type CrewAIFlowState
- type DatabaseType
- type Event
- type Feedback
- type FeedbackIssueType
- type LangGraphCheckpoint
- type LangGraphCheckpointTuple
- type LangGraphCheckpointWrite
- type Manager
- type Model
- type PostgresConfig
- type PushNotification
- type QueryOptions
- type Session
- type SqliteConfig
- type Task
- type Tool
- type ToolServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildWhereClause ¶
BuildWhereClause is deprecated, use individual Where clauses instead
Types ¶
type Agent ¶
type Agent struct {
ID string `gorm:"primaryKey" json:"id"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`
Type string `gorm:"not null" json:"type"`
// Config is optional and may be nil for some agent types.
// For agent types that require configuration, this field should be populated.
// For agent types that do not require configuration, this field should be nil.
Config *adk.AgentConfig `gorm:"type:json" json:"config"`
}
Agent represents an agent configuration
type Client ¶
type Client interface {
// Store methods
StoreFeedback(feedback *Feedback) error
StoreSession(session *Session) error
StoreAgent(agent *Agent) error
StoreTask(task *protocol.Task) error
StorePushNotification(config *protocol.TaskPushNotificationConfig) error
StoreToolServer(toolServer *ToolServer) (*ToolServer, error)
StoreEvents(messages ...*Event) error
// Delete methods
DeleteSession(sessionName string, userID string) error
DeleteAgent(agentID string) error
DeleteToolServer(serverName string, groupKind string) error
DeleteTask(taskID string) error
DeletePushNotification(taskID string) error
DeleteToolsForServer(serverName string, groupKind string) error
// Get methods
GetSession(name string, userID string) (*Session, error)
GetAgent(name string) (*Agent, error)
GetTask(id string) (*protocol.Task, error)
GetTool(name string) (*Tool, error)
GetToolServer(name string) (*ToolServer, error)
GetPushNotification(taskID string, configID string) (*protocol.TaskPushNotificationConfig, error)
// List methods
ListTools() ([]Tool, error)
ListFeedback(userID string) ([]Feedback, error)
ListTasksForSession(sessionID string) ([]*protocol.Task, error)
ListSessions(userID string) ([]Session, error)
ListSessionsForAgent(agentID string, userID string) ([]Session, error)
ListAgents() ([]Agent, error)
ListToolServers() ([]ToolServer, error)
ListToolsForServer(serverName string, groupKind string) ([]Tool, error)
ListEventsForSession(sessionID, userID string, options QueryOptions) ([]*Event, error)
ListPushNotifications(taskID string) ([]*protocol.TaskPushNotificationConfig, error)
// Helper methods
RefreshToolsForServer(serverName string, groupKind string, tools ...*v1alpha2.MCPTool) error
// LangGraph Checkpoint methods
StoreCheckpoint(checkpoint *LangGraphCheckpoint) error
StoreCheckpointWrites(writes []*LangGraphCheckpointWrite) error
ListCheckpoints(userID, threadID, checkpointNS string, checkpointID *string, limit int) ([]*LangGraphCheckpointTuple, error)
DeleteCheckpoint(userID, threadID string) error
// CrewAI methods
StoreCrewAIMemory(memory *CrewAIAgentMemory) error
SearchCrewAIMemoryByTask(userID, threadID, taskDescription string, limit int) ([]*CrewAIAgentMemory, error)
ResetCrewAIMemory(userID, threadID string) error
StoreCrewAIFlowState(state *CrewAIFlowState) error
GetCrewAIFlowState(userID, threadID string) (*CrewAIFlowState, error)
}
type Config ¶
type Config struct {
DatabaseType DatabaseType
SqliteConfig *SqliteConfig
PostgresConfig *PostgresConfig
}
type CrewAIAgentMemory ¶
type CrewAIAgentMemory struct {
UserID string `gorm:"primaryKey;not null" json:"user_id"`
ThreadID string `gorm:"primaryKey;not null" json:"thread_id"`
CreatedAt time.Time `gorm:"autoCreateTime;index:idx_crewai_memory_list" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`
// MemoryData contains JSON serialized memory data including task_description, score, metadata, datetime
MemoryData string `gorm:"type:text;not null" json:"memory_data"`
}
CrewAIAgentMemory represents long-term memory for CrewAI agents
func (CrewAIAgentMemory) TableName ¶
func (CrewAIAgentMemory) TableName() string
type CrewAIFlowState ¶
type CrewAIFlowState struct {
UserID string `gorm:"primaryKey;not null" json:"user_id"`
ThreadID string `gorm:"primaryKey;not null" json:"thread_id"`
MethodName string `gorm:"primaryKey;not null" json:"method_name"`
CreatedAt time.Time `gorm:"autoCreateTime;index:idx_crewai_flow_state_list" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`
// StateData contains JSON serialized flow state data
StateData string `gorm:"type:text;not null" json:"state_data"`
}
CrewAIFlowState represents flow state for CrewAI flows
func (CrewAIFlowState) TableName ¶
func (CrewAIFlowState) TableName() string
type DatabaseType ¶
type DatabaseType string
const ( DatabaseTypeSqlite DatabaseType = "sqlite" DatabaseTypePostgres DatabaseType = "postgres" )
type Event ¶
type Event struct {
ID string `gorm:"primaryKey;not null" json:"id"`
SessionID string `gorm:"index" json:"session_id"`
UserID string `gorm:"primaryKey;not null" json:"user_id"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`
Data string `gorm:"type:text;not null" json:"data"` // JSON serialized protocol.Message
}
type Feedback ¶
type Feedback struct {
gorm.Model
UserID string `gorm:"primaryKey;not null" json:"user_id"`
MessageID uint `gorm:"index;constraint:OnDelete:CASCADE" json:"message_id"`
IsPositive bool `gorm:"default:false" json:"is_positive"`
FeedbackText string `gorm:"not null" json:"feedback_text"`
IssueType *FeedbackIssueType `json:"issue_type,omitempty"`
}
Feedback represents user feedback on agent responses
type FeedbackIssueType ¶
type FeedbackIssueType string
FeedbackIssueType represents the category of feedback issue
const ( FeedbackIssueTypeInstructions FeedbackIssueType = "instructions" // Did not follow instructions FeedbackIssueTypeFactual FeedbackIssueType = "factual" // Not factually correct FeedbackIssueTypeIncomplete FeedbackIssueType = "incomplete" // Incomplete response FeedbackIssueTypeTool FeedbackIssueType = "tool" // Should have run the tool )
type LangGraphCheckpoint ¶
type LangGraphCheckpoint struct {
UserID string `gorm:"primaryKey;not null" json:"user_id"`
ThreadID string `gorm:"primaryKey;not null" json:"thread_id"`
CheckpointNS string `gorm:"primaryKey;not null;default:''" json:"checkpoint_ns"`
CheckpointID string `gorm:"primaryKey;not null" json:"checkpoint_id"`
ParentCheckpointID *string `gorm:"index" json:"parent_checkpoint_id,omitempty"`
CreatedAt time.Time `gorm:"autoCreateTime;index:idx_lgcp_list" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`
Metadata string `gorm:"type:text;not null" json:"metadata"` // JSON serialized metadata
Checkpoint string `gorm:"type:text;not null" json:"checkpoint"` // JSON serialized checkpoint
CheckpointType string `gorm:"not null" json:"checkpoint_type"`
Version int `gorm:"default:1" json:"version"`
}
LangGraphCheckpoint represents a LangGraph checkpoint
func (LangGraphCheckpoint) TableName ¶
func (LangGraphCheckpoint) TableName() string
type LangGraphCheckpointTuple ¶
type LangGraphCheckpointTuple struct {
Checkpoint *LangGraphCheckpoint
Writes []*LangGraphCheckpointWrite
}
type LangGraphCheckpointWrite ¶
type LangGraphCheckpointWrite struct {
UserID string `gorm:"primaryKey;not null" json:"user_id"`
ThreadID string `gorm:"primaryKey;not null" json:"thread_id"`
CheckpointNS string `gorm:"primaryKey;not null;default:''" json:"checkpoint_ns"`
CheckpointID string `gorm:"primaryKey;not null" json:"checkpoint_id"`
WriteIdx int `gorm:"primaryKey;not null" json:"write_idx"`
Value string `gorm:"type:text;not null" json:"value"` // JSON serialized value
ValueType string `gorm:"not null" json:"value_type"`
Channel string `gorm:"not null" json:"channel"`
TaskID string `gorm:"not null" json:"task_id"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`
}
LangGraphCheckpointWrite represents a write operation for a checkpoint
func (LangGraphCheckpointWrite) TableName ¶
func (LangGraphCheckpointWrite) TableName() string
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles database connection and initialization
func NewManager ¶
NewManager creates a new database manager
func (*Manager) Initialize ¶
Initialize sets up the database tables
type PostgresConfig ¶
type PostgresConfig struct {
URL string
}
type PushNotification ¶
type PushNotification struct {
ID string `gorm:"primaryKey;not null" json:"id"`
TaskID string `gorm:"not null;index" json:"task_id"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`
Data string `gorm:"type:text;not null" json:"data"` // JSON serialized push notification config
}
func (PushNotification) TableName ¶
func (PushNotification) TableName() string
type QueryOptions ¶
type Session ¶
type Session struct {
ID string `gorm:"primaryKey;not null" json:"id"`
Name *string `gorm:"index" json:"name,omitempty"`
UserID string `gorm:"primaryKey" json:"user_id"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`
AgentID *string `gorm:"index" json:"agent_id"`
}
type SqliteConfig ¶
type SqliteConfig struct {
DatabasePath string
}
type Task ¶
type Task struct {
ID string `gorm:"primaryKey;not null" json:"id"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`
Data string `gorm:"type:text;not null" json:"data"` // JSON serialized task data
SessionID string `gorm:"index" json:"session_id"`
}
type Tool ¶
type Tool struct {
ID string `gorm:"primaryKey;not null" json:"id"`
ServerName string `gorm:"primaryKey;not null" json:"server_name"`
GroupKind string `gorm:"primaryKey;not null" json:"group_kind"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`
Description string `json:"description"`
}
Tool represents a single tool that can be used by an agent
type ToolServer ¶
type ToolServer struct {
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`
Name string `gorm:"primaryKey;not null" json:"name"`
GroupKind string `gorm:"primaryKey;not null" json:"group_kind"`
Description string `json:"description"`
LastConnected *time.Time `json:"last_connected,omitempty"`
}
ToolServer represents a tool server that provides tools
func (ToolServer) TableName ¶
func (ToolServer) TableName() string