Documentation
¶
Overview ¶
Package runtime builds and manages Hector agents from configuration.
The runtime is the bridge between declarative config and live agents. It creates LLM providers, tools, and agents based on the configuration.
Index ¶
- func DefaultEmbedderFactory(cfg *config.EmbedderConfig) (embedder.Embedder, error)
- func DefaultLLMFactory(cfg *config.LLMConfig) (model.LLM, error)
- func DefaultToolsetFactory(name string, cfg *config.ToolConfig) (tool.Toolset, error)
- func DefaultWorkingMemoryFactory(opts WorkingMemoryFactoryOptions) (memory.WorkingMemoryStrategy, error)
- type EmbedderFactory
- type LLMFactory
- type Option
- func WithAgentTools(agentName string, agentTools []agent.Agent) Option
- func WithCheckpointManager(mgr *checkpoint.Manager) Option
- func WithDBPool(pool *config.DBPool) Option
- func WithDirectTools(agentName string, tools []tool.Tool) Option
- func WithEmbedderFactory(f EmbedderFactory) Option
- func WithIndexService(idx memory.IndexService) Option
- func WithLLMFactory(f LLMFactory) Option
- func WithObservability(obs *observability.Manager) Option
- func WithSessionService(s session.Service) Option
- func WithSubAgents(agentName string, subAgents []agent.Agent) Option
- func WithToolsetFactory(f ToolsetFactory) Option
- type Runtime
- func (r *Runtime) CheckpointManager() *checkpoint.Manager
- func (r *Runtime) Close() error
- func (r *Runtime) Config() *config.Config
- func (r *Runtime) DefaultAgent() (agent.Agent, bool)
- func (r *Runtime) DefaultRunnerConfig() (*runner.Config, error)
- func (r *Runtime) DocumentStores() map[string]*rag.DocumentStore
- func (r *Runtime) GetAgent(name string) (agent.Agent, bool)
- func (r *Runtime) GetDocumentStore(name string) (*rag.DocumentStore, bool)
- func (r *Runtime) GetLLM(name string) (model.LLM, bool)
- func (r *Runtime) IndexDocumentStores(ctx context.Context) error
- func (r *Runtime) IndexService() memory.IndexService
- func (r *Runtime) ListAgents() []string
- func (r *Runtime) Metrics() *observability.Metrics
- func (r *Runtime) NewAuthValidator() (auth.TokenValidator, error)
- func (r *Runtime) Observability() *observability.Manager
- func (r *Runtime) Reload(newCfg *config.Config) error
- func (r *Runtime) RunnerConfig(agentName string) (*runner.Config, error)
- func (r *Runtime) SessionService() session.Service
- func (r *Runtime) StartDocumentStoreWatching(ctx context.Context) error
- func (r *Runtime) Tracer() *observability.Tracer
- type ToolsetFactory
- type WorkingMemoryFactoryOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultEmbedderFactory ¶
func DefaultEmbedderFactory(cfg *config.EmbedderConfig) (embedder.Embedder, error)
DefaultEmbedderFactory creates Embedder instances based on provider type. Uses the builder package as its foundation to ensure a single code path for both configuration-based and programmatic API usage.
func DefaultLLMFactory ¶
DefaultLLMFactory creates LLM instances based on provider type. Uses the builder package as its foundation to ensure a single code path for both configuration-based and programmatic API usage.
func DefaultToolsetFactory ¶
DefaultToolsetFactory creates toolset instances based on tool type. Uses the builder package as its foundation for MCP toolsets to ensure a single code path for both configuration-based and programmatic API usage.
func DefaultWorkingMemoryFactory ¶
func DefaultWorkingMemoryFactory(opts WorkingMemoryFactoryOptions) (memory.WorkingMemoryStrategy, error)
DefaultWorkingMemoryFactory creates a working memory strategy from config. Uses the builder package as its foundation to ensure a single code path for both configuration-based and programmatic API usage. Returns nil if no context config is set or strategy is "none".
Types ¶
type EmbedderFactory ¶
type EmbedderFactory func(cfg *config.EmbedderConfig) (embedder.Embedder, error)
EmbedderFactory creates an Embedder from config.
type LLMFactory ¶
LLMFactory creates an LLM from config.
type Option ¶
type Option func(*Runtime)
Option configures the runtime.
func WithAgentTools ¶
WithAgentTools adds agents as tools for an agent (Pattern 2: delegation). The parent agent can call these as tools and receive structured results.
func WithCheckpointManager ¶
func WithCheckpointManager(mgr *checkpoint.Manager) Option
WithCheckpointManager sets a custom checkpoint manager.
func WithDBPool ¶
WithDBPool sets the shared database pool for SQL backends. Required when SQL persistence is configured without explicit services.
func WithDirectTools ¶
WithDirectTools adds tools directly for an agent.
func WithEmbedderFactory ¶
func WithEmbedderFactory(f EmbedderFactory) Option
WithEmbedderFactory sets a custom embedder factory.
func WithIndexService ¶
func WithIndexService(idx memory.IndexService) Option
WithIndexService sets a custom index service.
func WithLLMFactory ¶
func WithLLMFactory(f LLMFactory) Option
WithLLMFactory sets a custom LLM factory.
func WithObservability ¶
func WithObservability(obs *observability.Manager) Option
WithObservability sets a custom observability manager.
func WithSessionService ¶
WithSessionService sets a custom session service.
func WithSubAgents ¶
WithSubAgents adds sub-agents for an agent (Pattern 1: transfer). Transfer tools are automatically created for each sub-agent.
func WithToolsetFactory ¶
func WithToolsetFactory(f ToolsetFactory) Option
WithToolsetFactory sets a custom toolset factory.
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime manages the lifecycle of Hector agents built from config.
func (*Runtime) CheckpointManager ¶
func (r *Runtime) CheckpointManager() *checkpoint.Manager
CheckpointManager returns the checkpoint manager. Returns nil if checkpointing is not configured.
func (*Runtime) DefaultAgent ¶
DefaultAgent returns the first agent (primary/default agent).
func (*Runtime) DefaultRunnerConfig ¶
DefaultRunnerConfig creates a runner.Config for the default agent.
func (*Runtime) DocumentStores ¶
func (r *Runtime) DocumentStores() map[string]*rag.DocumentStore
DocumentStores returns all document stores.
func (*Runtime) GetDocumentStore ¶
func (r *Runtime) GetDocumentStore(name string) (*rag.DocumentStore, bool)
GetDocumentStore returns a document store by name.
func (*Runtime) IndexDocumentStores ¶
IndexDocumentStores indexes all document stores. This should be called after runtime initialization to populate the indexes. It can be called asynchronously to avoid blocking startup.
func (*Runtime) IndexService ¶
func (r *Runtime) IndexService() memory.IndexService
IndexService returns the index service.
func (*Runtime) ListAgents ¶
ListAgents returns all agent names.
func (*Runtime) Metrics ¶
func (r *Runtime) Metrics() *observability.Metrics
Metrics returns the metrics recorder. Returns nil if metrics are not enabled.
func (*Runtime) NewAuthValidator ¶
func (r *Runtime) NewAuthValidator() (auth.TokenValidator, error)
NewAuthValidator creates a JWT validator from the server auth config. Returns nil if authentication is not enabled.
func (*Runtime) Observability ¶
func (r *Runtime) Observability() *observability.Manager
Observability returns the observability manager. Returns nil if observability is not configured.
func (*Runtime) Reload ¶
Reload rebuilds the runtime with new config (hot-reload). Sessions and memory are preserved, only LLMs/agents/tools are rebuilt.
func (*Runtime) RunnerConfig ¶
RunnerConfig creates a runner.Config for the given agent.
func (*Runtime) SessionService ¶
SessionService returns the session service.
func (*Runtime) StartDocumentStoreWatching ¶
StartDocumentStoreWatching starts file watching for all document stores. This enables automatic re-indexing when documents change.
func (*Runtime) Tracer ¶
func (r *Runtime) Tracer() *observability.Tracer
Tracer returns the tracer for distributed tracing. Returns nil if tracing is not enabled.
type ToolsetFactory ¶
ToolsetFactory creates a Toolset from config.
type WorkingMemoryFactoryOptions ¶
type WorkingMemoryFactoryOptions struct {
// Config is the context configuration.
Config *config.ContextConfig
// ModelName is the LLM model name for token counting.
ModelName string
// SummarizerLLM is the LLM to use for summarization (summary_buffer only).
// If nil and strategy is summary_buffer, summarization is disabled.
SummarizerLLM model.LLM
}
WorkingMemoryFactoryOptions contains options for creating working memory strategies.