state

package
v0.0.0-...-34db83d Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunCompaction

func RunCompaction(ctx context.Context, client KBCompactionClient, period string, summarize bool, apiURL, apiKey, model string) error

RunCompaction runs one compaction pass: list entries, group by period, for each group fetch content, optionally summarize, store result, delete originals.

Types

type ActionsConfig

type ActionsConfig struct {
	Name   string `json:"name"` // e.g. search
	Config string `json:"config"`
}

type AgentConfig

type AgentConfig struct {
	Connector        []ConnectorConfig      `json:"connectors" form:"connectors" `
	Actions          []ActionsConfig        `json:"actions" form:"actions"`
	DynamicPrompts   []DynamicPromptsConfig `json:"dynamic_prompts" form:"dynamic_prompts"`
	MCPServers       []agent.MCPServer      `json:"mcp_servers" form:"mcp_servers"`
	MCPSTDIOServers  []agent.MCPSTDIOServer `json:"mcp_stdio_servers" form:"mcp_stdio_servers"`
	MCPPrepareScript string                 `json:"mcp_prepare_script" form:"mcp_prepare_script"`
	Filters          []FiltersConfig        `json:"filters" form:"filters"`

	Description string `json:"description" form:"description"`

	Model                 string `json:"model" form:"model"`
	MultimodalModel       string `json:"multimodal_model" form:"multimodal_model"`
	TranscriptionModel    string `json:"transcription_model" form:"transcription_model"`
	TranscriptionLanguage string `json:"transcription_language" form:"transcription_language"`
	TTSModel              string `json:"tts_model" form:"tts_model"`
	APIURL                string `json:"api_url" form:"api_url"`
	APIKey                string `json:"api_key" form:"api_key"`
	LocalRAGURL           string `json:"local_rag_url" form:"local_rag_url"`
	LocalRAGAPIKey        string `json:"local_rag_api_key" form:"local_rag_api_key"`
	LastMessageDuration   string `json:"last_message_duration" form:"last_message_duration"`

	Name                       string `json:"name" form:"name"`
	HUD                        bool   `json:"hud" form:"hud"`
	StandaloneJob              bool   `json:"standalone_job" form:"standalone_job"`
	RandomIdentity             bool   `json:"random_identity" form:"random_identity"`
	InitiateConversations      bool   `json:"initiate_conversations" form:"initiate_conversations"`
	CanPlan                    bool   `json:"enable_planning" form:"enable_planning"`
	PlanReviewerModel          string `json:"plan_reviewer_model" form:"plan_reviewer_model"`
	DisableSinkState           bool   `json:"disable_sink_state" form:"disable_sink_state"`
	IdentityGuidance           string `json:"identity_guidance" form:"identity_guidance"`
	PeriodicRuns               string `json:"periodic_runs" form:"periodic_runs"`
	SchedulerPollInterval      string `json:"scheduler_poll_interval" form:"scheduler_poll_interval"`
	SchedulerTaskTemplate      string `json:"scheduler_task_template" form:"scheduler_task_template"`
	PermanentGoal              string `json:"permanent_goal" form:"permanent_goal"`
	EnableKnowledgeBase        bool   `json:"enable_kb" form:"enable_kb"`
	EnableKBCompaction         bool   `json:"enable_kb_compaction" form:"enable_kb_compaction"`
	KBCompactionInterval       string `json:"kb_compaction_interval" form:"kb_compaction_interval"`
	KBCompactionSummarize      bool   `json:"kb_compaction_summarize" form:"kb_compaction_summarize"`
	KBAutoSearch               bool   `json:"kb_auto_search" form:"kb_auto_search"`
	KBAsTools                  bool   `json:"kb_as_tools" form:"kb_as_tools"`
	EnableReasoning            bool   `json:"enable_reasoning" form:"enable_reasoning"`
	EnableForceReasoningTool   bool   `json:"enable_reasoning_tool" form:"enable_reasoning_tool"`
	EnableGuidedTools          bool   `json:"enable_guided_tools" form:"enable_guided_tools"`
	EnableSkills               bool   `json:"enable_skills" form:"enable_skills"`
	KnowledgeBaseResults       int    `json:"kb_results" form:"kb_results"`
	CanStopItself              bool   `json:"can_stop_itself" form:"can_stop_itself"`
	SystemPrompt               string `json:"system_prompt" form:"system_prompt"`
	SkillsPrompt               string `json:"skills_prompt" form:"skills_prompt"`
	InnerMonologueTemplate     string `json:"inner_monologue_template" form:"inner_monologue_template"`
	LongTermMemory             bool   `json:"long_term_memory" form:"long_term_memory"`
	SummaryLongTermMemory      bool   `json:"summary_long_term_memory" form:"summary_long_term_memory"`
	ConversationStorageMode    string `json:"conversation_storage_mode" form:"conversation_storage_mode"`
	ParallelJobs               int    `json:"parallel_jobs" form:"parallel_jobs"`
	CancelPreviousOnNewMessage *bool  `json:"cancel_previous_on_new_message" form:"cancel_previous_on_new_message"`
	StripThinkingTags          bool   `json:"strip_thinking_tags" form:"strip_thinking_tags"`
	EnableEvaluation           bool   `json:"enable_evaluation" form:"enable_evaluation"`
	MaxEvaluationLoops         int    `json:"max_evaluation_loops" form:"max_evaluation_loops"`
	MaxAttempts                int    `json:"max_attempts" form:"max_attempts"`
	LoopDetection              int    `json:"loop_detection" form:"loop_detection"`
	EnableAutoCompaction       bool   `json:"enable_auto_compaction" form:"enable_auto_compaction"`
	AutoCompactionThreshold    int    `json:"auto_compaction_threshold" form:"auto_compaction_threshold"`
}

func (*AgentConfig) MarshalJSON

func (a *AgentConfig) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for AgentConfig

func (*AgentConfig) UnmarshalJSON

func (a *AgentConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for AgentConfig

type AgentConfigMeta

type AgentConfigMeta struct {
	Filters        []config.FieldGroup
	Fields         []config.Field
	Connectors     []config.FieldGroup
	Actions        []config.FieldGroup
	DynamicPrompts []config.FieldGroup
	MCPServers     []config.Field
}

func NewAgentConfigMeta

func NewAgentConfigMeta(
	actionsConfig []config.FieldGroup,
	connectorsConfig []config.FieldGroup,
	dynamicPromptsConfig []config.FieldGroup,
	filtersConfig []config.FieldGroup,
) AgentConfigMeta

type AgentPool

type AgentPool struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewAgentPool

func NewAgentPool(
	defaultModel, defaultMultimodalModel, defaultTranscriptionModel, defaultTranscriptionLanguage, defaultTTSModel, apiURL, apiKey, directory string,
	availableActions func(*AgentConfig) func(ctx context.Context, pool *AgentPool) []types.Action,
	connectors func(*AgentConfig) []Connector,
	promptBlocks func(*AgentConfig) func(ctx context.Context, pool *AgentPool) []DynamicPrompt,
	filters func(*AgentConfig) types.JobFilters,
	timeout string,
	withLogs bool,
	skillsService SkillsProvider,
) (*AgentPool, error)

func (*AgentPool) AllAgents

func (a *AgentPool) AllAgents() []string

func (*AgentPool) CreateAgent

func (a *AgentPool) CreateAgent(name string, agentConfig *AgentConfig) error

CreateAgent adds a new agent to the pool and starts it. It also saves the state to the file.

func (*AgentPool) GetAgent

func (a *AgentPool) GetAgent(name string) *Agent

func (*AgentPool) GetConfig

func (a *AgentPool) GetConfig(name string) *AgentConfig

func (*AgentPool) GetManager

func (a *AgentPool) GetManager(name string) sse.Manager

func (*AgentPool) GetStatusHistory

func (a *AgentPool) GetStatusHistory(name string) *Status

func (*AgentPool) InternalAPI

func (a *AgentPool) InternalAPI() *AgentPoolInternalAPI

func (*AgentPool) List

func (a *AgentPool) List() []string

func (*AgentPool) RecreateAgent

func (a *AgentPool) RecreateAgent(name string, agentConfig *AgentConfig) error

func (*AgentPool) Remove

func (a *AgentPool) Remove(name string) error

func (*AgentPool) Save

func (a *AgentPool) Save() error

func (*AgentPool) SetRAGProvider

func (a *AgentPool) SetRAGProvider(fn RAGProvider)

SetRAGProvider sets the single RAG provider (HTTP or embedded). Must be called after pool creation.

func (*AgentPool) Start

func (a *AgentPool) Start(name string) error

func (*AgentPool) StartAll

func (a *AgentPool) StartAll() error

Starts all the agents in the pool

func (*AgentPool) Stop

func (a *AgentPool) Stop(name string)

func (*AgentPool) StopAll

func (a *AgentPool) StopAll()

type AgentPoolData

type AgentPoolData map[string]AgentConfig

type AgentPoolInternalAPI

type AgentPoolInternalAPI struct {
	*AgentPool
}

func (*AgentPoolInternalAPI) AllAgents

func (a *AgentPoolInternalAPI) AllAgents() []string

func (*AgentPoolInternalAPI) GetAgent

func (a *AgentPoolInternalAPI) GetAgent(name string) *Agent

func (*AgentPoolInternalAPI) GetConfig

func (a *AgentPoolInternalAPI) GetConfig(name string) *AgentConfig

type Connector

type Connector interface {
	AgentResultCallback() func(state types.ActionState)
	AgentReasoningCallback() func(state types.ActionCurrentState) bool
	Start(a *agent.Agent)
}

type ConnectorConfig

type ConnectorConfig struct {
	Type   string `json:"type"` // e.g. Slack
	Config string `json:"config"`
}

type DynamicPromptsConfig

type DynamicPromptsConfig struct {
	Type   string `json:"type"`
	Config string `json:"config"`
}

func (DynamicPromptsConfig) ToMap

func (d DynamicPromptsConfig) ToMap() map[string]string

type FiltersConfig

type FiltersConfig struct {
	Type   string `json:"type"`
	Config string `json:"config"`
}

type KBCompactionClient

type KBCompactionClient interface {
	Collection() string
	ListEntries() ([]string, error)
	GetEntryContent(entry string) (content string, chunkCount int, err error)
	Store(filePath string) error
	DeleteEntry(entry string) error
}

KBCompactionClient is the interface used by compaction. It can be implemented by the HTTP RAG client adapter or by the in-process collection adapter.

type RAGProvider

type RAGProvider func(collectionName, effectiveRAGURL, effectiveRAGKey string) (RAGDB, KBCompactionClient, bool)

RAGProvider returns a RAGDB and optional compaction client for a collection (e.g. agent name). effectiveRAGURL/Key are pool/agent defaults; implementation may use them (HTTP) or ignore them (embedded).

func NewHTTPRAGProvider

func NewHTTPRAGProvider(baseURL, baseKey string) RAGProvider

NewHTTPRAGProvider returns a RAGProvider that uses the LocalRAG HTTP API. When effective URL/key are empty, baseURL/baseKey are used.

type SkillsProvider

type SkillsProvider interface {
	GetSkillsPrompt(config *AgentConfig) (DynamicPrompt, error)
	GetMCPSession(ctx context.Context) (*mcp.ClientSession, error)
}

SkillsProvider supplies the skills dynamic prompt and MCP session when skills are enabled for an agent.

type Status

type Status struct {
	ActionResults []types.ActionState
}

func (*Status) Results

func (s *Status) Results() []types.ActionState

Jump to

Keyboard shortcuts

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