Documentation
¶
Overview ¶
Package config provides configuration loading and management for Hector v2.
Hector is config-first: agents, tools, and LLMs are defined in YAML and the runtime builds them automatically.
Example config:
version: "2"
name: my-assistant
llms:
default:
provider: anthropic
model: claude-sonnet-4-20250514
api_key: ${ANTHROPIC_API_KEY}
tools:
weather:
type: mcp
url: ${MCP_URL}
agents:
assistant:
llm: default
tools: [weather]
instruction: You are a helpful assistant.
server:
port: 8080
Index ¶
- Constants
- func BoolPtr(b bool) *bool
- func BoolValue(b *bool, defaultValue bool) bool
- func GenerateEnvExample(envVars []EnvVarInfo) []byte
- func GetDefaultToolConfigs() map[string]*ToolConfig
- func IntPtr(i int) *int
- func IntValue(i *int, defaultValue int) int
- func LoadConfig(ctx context.Context, opts provider.ProviderConfig, loaderOpts ...LoaderOption) (*Config, *Loader, error)
- func LoadConfigFile(ctx context.Context, path string, opts ...LoaderOption) (*Config, *Loader, error)
- func LoadDotEnv(paths ...string) error
- func LoadDotEnvForConfig(configPath string) error
- func MustLoadDotEnv(paths ...string)
- func ReloadDotEnv(paths ...string) (map[string]string, error)
- func ReloadDotEnvForConfig(configPath string) (map[string]string, error)
- func StudioConfigTemplate() string
- type APISourceConfig
- type AgentConfig
- type AuthConfig
- type AuthorizationGuardrailConfig
- type CLIOptions
- type CORSConfig
- type CheckpointConfig
- func (c *CheckpointConfig) IsEnabled() bool
- func (c *CheckpointConfig) SetDefaults()
- func (c *CheckpointConfig) ShouldAutoResume() bool
- func (c *CheckpointConfig) ShouldCheckpointAfterTools() bool
- func (c *CheckpointConfig) ShouldCheckpointBeforeLLM() bool
- func (c *CheckpointConfig) Validate() error
- type CheckpointRecoveryConfig
- type ChunkingConfig
- type Config
- func (c *Config) GetAgent(name string) (*AgentConfig, bool)
- func (c *Config) GetDatabaseConfig() (*DatabaseConfig, error)
- func (c *Config) GetGuardrails(name string) (*GuardrailsConfig, bool)
- func (c *Config) GetLLM(name string) (*LLMConfig, bool)
- func (c *Config) GetTool(name string) (*ToolConfig, bool)
- func (c *Config) ListAgents() []string
- func (c *Config) SetDefaults()
- func (c *Config) Validate() error
- type ContentGuardrailConfig
- type ContextConfig
- type CredentialsConfig
- type DBPool
- type DatabaseConfig
- type DefaultsConfig
- type DocumentSearchConfig
- type DocumentSourceConfig
- type DocumentStoreConfig
- type Duration
- type EmbedderConfig
- type EnvVarInfo
- type GeneratorResult
- type GuardrailsConfig
- type IndexingConfig
- type InjectionGuardrailConfig
- type InputGuardrailsConfig
- type LLMConfig
- type LLMProvider
- type LengthGuardrailConfig
- type Loader
- type LoaderOption
- type LoggerConfig
- type MCPParserConfig
- type MemoryConfig
- type NotificationConfig
- type NotificationEvent
- type NotificationPayloadConfig
- type NotificationRetryConfig
- type NotificationType
- type OutputGuardrailsConfig
- type PIIGuardrailConfig
- type PatternGuardrailConfig
- type PromptConfig
- type RateLimitConfig
- type RateLimitRule
- type ReasoningConfig
- type RetryConfig
- type SQLSourceConfig
- type SQLTableConfig
- type SanitizerGuardrailConfig
- type ServerConfig
- type SkillConfig
- type SkillFrontmatter
- type StructuredOutputConfig
- type StudioConfig
- type TLSConfig
- type ThinkingConfig
- type ToolConfig
- type ToolGuardrailsConfig
- type ToolType
- type TransportType
- type TriggerConfig
- type TriggerType
- type VectorStoreConfig
- type WebhookFieldExtractor
- type WebhookInputConfig
- type WebhookResponseConfig
- type WebhookResponseMode
Constants ¶
const DefaultDSN = "sqlite://.hector/hector.db"
DefaultDSN is the default database connection string.
Variables ¶
This section is empty.
Functions ¶
func GenerateEnvExample ¶ added in v1.12.0
func GenerateEnvExample(envVars []EnvVarInfo) []byte
GenerateEnvExample creates a .env.example file content.
func GetDefaultToolConfigs ¶
func GetDefaultToolConfigs() map[string]*ToolConfig
GetDefaultToolConfigs returns default local tool configurations. These are the built-in tools that can be enabled with --tools flag. Tools marked with RequireApproval=true use HITL (Human-in-the-Loop) pattern and require user approval before execution.
func IntValue ¶ added in v1.14.0
IntValue returns the value of the int pointer, or the default if nil.
func LoadConfig ¶
func LoadConfig(ctx context.Context, opts provider.ProviderConfig, loaderOpts ...LoaderOption) (*Config, *Loader, error)
LoadConfig is a convenience function that creates a loader and loads config.
func LoadConfigFile ¶
func LoadConfigFile(ctx context.Context, path string, opts ...LoaderOption) (*Config, *Loader, error)
LoadConfigFile is a convenience function for loading from a file.
func LoadDotEnv ¶
LoadDotEnv loads environment variables from .env files.
Search order (first found wins):
- Explicit path if provided
- .env in current directory
- .env in config file's directory (if config path provided)
- .env in home directory (~/.env)
This function is idempotent and safe to call multiple times. Existing environment variables are NOT overwritten.
func LoadDotEnvForConfig ¶
LoadDotEnvForConfig loads .env from the config file's directory.
func MustLoadDotEnv ¶
func MustLoadDotEnv(paths ...string)
MustLoadDotEnv loads .env files and panics on error. Use this in init() or main() where errors should be fatal.
func ReloadDotEnv ¶ added in v1.12.0
ReloadDotEnv reloads environment variables from .env files. Unlike LoadDotEnv, this OVERWRITES existing environment variables. Returns the map of loaded environment variables.
func ReloadDotEnvForConfig ¶ added in v1.12.0
ReloadDotEnvForConfig reloads .env from the config file's directory. Returns the map of loaded environment variables.
func StudioConfigTemplate ¶
func StudioConfigTemplate() string
StudioConfigTemplate returns a secure, minimal config template for studio mode. Uses environment variable references instead of expanded values to avoid exposing secrets. Auto-detects which provider is available and generates appropriate template.
Types ¶
type APISourceConfig ¶
type APISourceConfig struct {
// URL is the API endpoint.
URL string `yaml:"url"`
// Headers are HTTP headers to include.
Headers map[string]string `yaml:"headers,omitempty"`
// IDField is the JSON path to document IDs.
IDField string `yaml:"id_field"`
// ContentField is the JSON path to document content.
ContentField string `yaml:"content_field"`
}
APISourceConfig configures an API-based document source.
func (*APISourceConfig) Validate ¶
func (c *APISourceConfig) Validate() error
Validate checks the configuration for errors.
type AgentConfig ¶
type AgentConfig struct {
// Name is the display name of the agent (human-readable).
// The actual unique identifier is the map key in the agents section.
Name string `` /* 157-byte string literal not displayed */
// Description describes what the agent does.
Description string `` /* 146-byte string literal not displayed */
// Visibility controls agent discovery and access.
// Values:
// - "public" (default): Visible in discovery, accessible via HTTP (if auth enabled, requires auth)
// - "internal": Visible in discovery ONLY if authenticated, accessible via HTTP (requires auth)
// - "private": Hidden from discovery, NOT accessible via HTTP (internal calls only)
Visibility string `` /* 187-byte string literal not displayed */
// LLM references a configured LLM by name.
LLM string `` /* 138-byte string literal not displayed */
// Tools lists tool names this agent can use.
Tools []string `yaml:"tools,omitempty" json:"tools,omitempty" jsonschema:"title=Tools,description=List of tool names this agent can use"`
// SubAgents lists agent names that can receive transferred control (Pattern 1).
// Transfer tools are automatically created for each sub-agent.
// The parent agent can call "transfer_to_<name>" to hand off control.
//
// Example:
// agents:
// coordinator:
// sub_agents: [researcher, writer]
// researcher:
// instruction: "You research topics..."
// writer:
// instruction: "You write content..."
SubAgents []string `` /* 147-byte string literal not displayed */
// AgentTools lists agent names to use as callable tools (Pattern 2).
// The parent agent maintains control and receives structured results.
// The tool name will be the agent name (e.g., "web_search").
//
// Example:
// agents:
// researcher:
// agent_tools: [web_search, data_analysis]
// web_search:
// instruction: "You search the web..."
// data_analysis:
// instruction: "You analyze data..."
AgentTools []string `` /* 137-byte string literal not displayed */
// Instruction is the system prompt for the agent.
// Supports template placeholders:
// {variable} - session state
// {app:variable} - app-scoped state
// {user:variable} - user-scoped state
// {temp:variable} - temp-scoped state
// {artifact.filename} - artifact content
// {variable?} - optional (empty if not found)
Instruction string `` /* 149-byte string literal not displayed */
// InstructionFile is a path to a file containing the system instruction.
// If provided, the content of this file is read and used as Instruction.
// Supports SKILL.md files which contain frontmatter + markdown body.
// The file path is relative to the config file location.
InstructionFile string `` /* 164-byte string literal not displayed */
// GlobalInstruction applies to all agents in the tree (root only).
// Supports the same template placeholders as Instruction.
GlobalInstruction string `` /* 167-byte string literal not displayed */
// Reasoning configures the chain-of-thought reasoning loop.
Reasoning *ReasoningConfig `` /* 149-byte string literal not displayed */
// Context configures working memory / context window management.
// Controls how conversation history is managed to fit within LLM limits.
Context *ContextConfig `` /* 145-byte string literal not displayed */
// Guardrails references a named guardrails configuration.
// Controls input validation, output filtering, and tool authorization.
Guardrails string `` /* 151-byte string literal not displayed */
// DisableSafetyProtocols disables automatic injection of safety protocols (Tool Reliability & CoT).
// Default: false (protocols enabled)
DisableSafetyProtocols bool `` /* 214-byte string literal not displayed */
// Prompt provides detailed prompt configuration.
Prompt *PromptConfig `` /* 129-byte string literal not displayed */
// Skills describes agent capabilities for A2A discovery.
Skills []SkillConfig `yaml:"skills,omitempty" json:"skills,omitempty" jsonschema:"title=Skills,description=Agent capabilities for A2A discovery"`
// InputModes are supported input MIME types.
InputModes []string `` /* 127-byte string literal not displayed */
// OutputModes are supported output MIME types.
OutputModes []string `` /* 131-byte string literal not displayed */
// Streaming enables token-by-token streaming from the LLM.
Streaming *bool `` /* 149-byte string literal not displayed */
// DocumentStores lists document store names this agent can search.
// Controls scoped access to RAG document stores.
// Values:
// - nil/omitted: Agent can search ALL document stores
// - []: Agent has NO document store access
// - [stores...]: Agent can only search listed stores
//
// When document stores are available:
// - A "search" tool is automatically added to the agent
// - If IncludeContext=true, relevant context is auto-injected
//
// Example:
// agents:
// researcher:
// document_stores: [codebase, docs] # Scoped to these stores
// admin:
// document_stores: [] # No RAG access
// default:
// # omitted = access all stores
DocumentStores *[]string `` /* 153-byte string literal not displayed */
// IncludeContext enables automatic context injection from RAG.
// When true, relevant document chunks are automatically included
// in the system prompt based on the user's message.
// Requires DocumentStores access.
// Default: false
IncludeContext *bool `` /* 159-byte string literal not displayed */
// IncludeContextLimit sets the maximum number of documents to include.
// Only used when IncludeContext=true.
// Default: 5
IncludeContextLimit *int `` /* 189-byte string literal not displayed */
// IncludeContextMaxLength sets the maximum content length per document (chars).
// Longer content is truncated.
// Only used when IncludeContext=true.
// Default: 500
IncludeContextMaxLength *int `` /* 211-byte string literal not displayed */
// StructuredOutput configures JSON schema response format.
// When set, the LLM will return responses matching the specified schema.
//
// Example:
// structured_output:
// schema:
// type: object
// properties:
// sentiment:
// type: string
// enum: ["positive", "negative", "neutral"]
// confidence:
// type: number
// required: ["sentiment", "confidence"]
StructuredOutput *StructuredOutputConfig `` /* 160-byte string literal not displayed */
// Type specifies the agent type.
// Values:
// - "llm" (default): LLM-powered agent
// - "sequential": Runs sub-agents in sequence
// - "parallel": Runs sub-agents in parallel
// - "loop": Runs sub-agents repeatedly
// - "remote": Remote A2A agent
// - "runner": Executes tools in sequence without LLM
Type string `` /* 184-byte string literal not displayed */
// MaxIterations is the maximum iterations for loop agents.
// Only used when Type="loop". If 0, loops until escalation.
MaxIterations uint `` /* 154-byte string literal not displayed */
// Trigger configures automatic agent invocation on a schedule.
// When configured, the agent will be invoked automatically based on the trigger.
Trigger *TriggerConfig `` /* 138-byte string literal not displayed */
// Notifications configures outbound notifications for agent events.
// Supports webhook notifications on task.completed, task.failed, task.started.
Notifications []*NotificationConfig `` /* 146-byte string literal not displayed */
// URL is the base URL of the remote A2A server.
// Used when Type="remote".
// Example: "http://localhost:9000"
URL string `yaml:"url,omitempty" json:"url,omitempty" jsonschema:"title=Remote URL,description=Base URL of remote A2A server"`
// AgentCardURL is the URL to fetch the agent card from.
// If not provided and URL is set, defaults to "{URL}/.well-known/agent-card.json".
AgentCardURL string `` /* 138-byte string literal not displayed */
// AgentCardFile is a local file path to the agent card JSON.
// Takes precedence over AgentCardURL.
AgentCardFile string `` /* 147-byte string literal not displayed */
// Headers are custom HTTP headers for remote agent requests.
// Useful for authentication.
// Example:
// headers:
// Authorization: "Bearer ${API_TOKEN}"
Headers map[string]string `` /* 128-byte string literal not displayed */
// Timeout is the request timeout for remote agents.
// Default: "30s"
Timeout string `yaml:"timeout,omitempty" json:"timeout,omitempty" jsonschema:"title=Timeout,description=Request timeout,default=30s"`
}
AgentConfig configures an agent.
func (*AgentConfig) GetDisplayName ¶
func (c *AgentConfig) GetDisplayName() string
GetDisplayName returns the name to display.
func (*AgentConfig) GetSystemPrompt ¶
func (c *AgentConfig) GetSystemPrompt() string
GetSystemPrompt returns the system prompt to use.
func (*AgentConfig) SetDefaults ¶
func (c *AgentConfig) SetDefaults(defaults *DefaultsConfig)
SetDefaults applies default values.
func (*AgentConfig) Validate ¶
func (c *AgentConfig) Validate() error
Validate checks the agent configuration.
type AuthConfig ¶
type AuthConfig struct {
// Enabled controls whether authentication is required.
// Default: false
Enabled bool `yaml:"enabled,omitempty"`
// JWKSURL is the URL to fetch JSON Web Key Set from.
// Required when Enabled is true.
// Example: "https://auth.example.com/.well-known/jwks.json"
JWKSURL string `yaml:"jwks_url,omitempty"`
// Issuer is the expected token issuer (iss claim).
// Required when Enabled is true.
// Example: "https://auth.example.com"
Issuer string `yaml:"issuer,omitempty"`
// Audience is the expected token audience (aud claim).
// Required when Enabled is true.
// Example: "hector-api"
Audience string `yaml:"audience,omitempty"`
// ClientID is the public Client ID for the frontend app.
// Optional, but required for hector-studio to know which app to use.
ClientID string `yaml:"client_id,omitempty"`
// Secret is a shared secret token for simple authentication.
// If set, requests must provide this token: Authorization: Bearer <secret>
Secret string `yaml:"secret,omitempty"`
// RefreshInterval is how often to refresh the JWKS.
// Default: 15m
RefreshInterval time.Duration `yaml:"refresh_interval,omitempty"`
// ExcludedPaths are paths that don't require authentication.
// Default: ["/health", "/.well-known/agent-card.json"]
ExcludedPaths []string `yaml:"excluded_paths,omitempty"`
// RequireAuth when true returns 401 for missing tokens.
// When false, unauthenticated requests proceed but without user context.
// Default: true (when Enabled is true)
RequireAuth *bool `yaml:"require_auth,omitempty"`
}
AuthConfig configures JWT-based authentication for the server.
Authentication is disabled by default. When enabled, all endpoints (except health checks and agent discovery) require a valid JWT token.
Example configuration:
server:
auth:
enabled: true
jwks_url: "https://auth.example.com/.well-known/jwks.json"
issuer: "https://auth.example.com"
audience: "hector-api"
The JWT token should be passed in the Authorization header:
Authorization: Bearer <token>
func (*AuthConfig) IsEnabled ¶
func (c *AuthConfig) IsEnabled() bool
IsEnabled returns true if authentication is configured and enabled.
func (*AuthConfig) IsRequireAuth ¶
func (c *AuthConfig) IsRequireAuth() bool
IsRequireAuth returns whether authentication is mandatory.
func (*AuthConfig) SetDefaults ¶
func (c *AuthConfig) SetDefaults()
SetDefaults applies default values to AuthConfig.
func (*AuthConfig) Validate ¶
func (c *AuthConfig) Validate() error
Validate checks the AuthConfig for errors.
type AuthorizationGuardrailConfig ¶
type AuthorizationGuardrailConfig struct {
Enabled bool `yaml:"enabled" json:"enabled" jsonschema:"title=Enabled,default=false"`
AllowedTools []string `` /* 149-byte string literal not displayed */
BlockedTools []string `` /* 149-byte string literal not displayed */
Action string `yaml:"action,omitempty" json:"action,omitempty" jsonschema:"title=Action,enum=allow,enum=block,enum=warn,default=block"`
Severity string `` /* 137-byte string literal not displayed */
}
AuthorizationGuardrailConfig configures tool authorization.
type CLIOptions ¶ added in v1.12.0
type CLIOptions struct {
// LLM options
Provider string
Model string
APIKey string
BaseURL string
Temperature *float64 // Pointer to distinguish "not set" from "set to 0"
MaxTokens *int
// Thinking options
Thinking *bool
ThinkingBudget int
// Streaming
Streaming *bool
// Agent options
Instruction string
Role string
// Tool options
MCPURL string
Tools string
ApproveTools string
NoApproveTools string
// Storage options
Storage string
StorageDB string
// Observability
Observe bool
// RAG options
DocsFolder string
RAGWatch *bool
MCPParserTool string
VectorType string
VectorHost string
VectorAPIKey string
EmbedderProvider string
EmbedderModel string
EmbedderURL string
IncludeContext *bool
// Server options
Host string
Port int
// Auth options
AuthJWKSURL string
AuthIssuer string
AuthAudience string
AuthRequired *bool
// Skill file (auto-detected)
SkillFile string
}
CLIOptions represents the command-line options provided by the user. Only fields that are explicitly set will be included in the generated config.
type CORSConfig ¶
type CORSConfig struct {
// AllowedOrigins is a list of allowed origins.
AllowedOrigins []string `yaml:"allowed_origins,omitempty"`
// AllowedMethods is a list of allowed HTTP methods.
AllowedMethods []string `yaml:"allowed_methods,omitempty"`
// AllowedHeaders is a list of allowed headers.
AllowedHeaders []string `yaml:"allowed_headers,omitempty"`
// AllowCredentials allows credentials.
AllowCredentials *bool `yaml:"allow_credentials,omitempty"`
}
CORSConfig configures CORS.
type CheckpointConfig ¶
type CheckpointConfig struct {
// Enabled enables checkpointing.
// Default: false
Enabled *bool `yaml:"enabled,omitempty"`
// Strategy determines when checkpoints are created.
// Values: "event" (default), "interval", "hybrid"
Strategy string `yaml:"strategy,omitempty"`
// Interval specifies checkpoint frequency (every N iterations).
// Only used when Strategy is "interval" or "hybrid".
// Default: 0 (disabled)
Interval int `yaml:"interval,omitempty"`
// AfterTools checkpoints after tool executions complete.
// Default: false
AfterTools *bool `yaml:"after_tools,omitempty"`
// BeforeLLM checkpoints before LLM API calls.
// Default: false
BeforeLLM *bool `yaml:"before_llm,omitempty"`
// Recovery configures checkpoint recovery behavior.
Recovery *CheckpointRecoveryConfig `yaml:"recovery,omitempty"`
}
CheckpointConfig configures execution state checkpointing and recovery.
Architecture (ported from legacy Hector):
Checkpoints capture the full state of an agent execution at strategic points. This enables: - Fault tolerance: Resume after crashes - HITL workflows: Pause for human approval, resume later - Long-running tasks: Survive server restarts - Cost optimization: Don't re-execute completed work
Example:
server:
checkpoint:
enabled: true
strategy: hybrid
interval: 5
after_tools: true
recovery:
auto_resume: true
timeout: 3600
func (*CheckpointConfig) IsEnabled ¶
func (c *CheckpointConfig) IsEnabled() bool
IsEnabled returns whether checkpointing is enabled.
func (*CheckpointConfig) SetDefaults ¶
func (c *CheckpointConfig) SetDefaults()
SetDefaults applies default values for CheckpointConfig.
func (*CheckpointConfig) ShouldAutoResume ¶
func (c *CheckpointConfig) ShouldAutoResume() bool
ShouldAutoResume returns whether to auto-resume on startup.
func (*CheckpointConfig) ShouldCheckpointAfterTools ¶
func (c *CheckpointConfig) ShouldCheckpointAfterTools() bool
ShouldCheckpointAfterTools returns whether to checkpoint after tool execution.
func (*CheckpointConfig) ShouldCheckpointBeforeLLM ¶
func (c *CheckpointConfig) ShouldCheckpointBeforeLLM() bool
ShouldCheckpointBeforeLLM returns whether to checkpoint before LLM calls.
func (*CheckpointConfig) Validate ¶
func (c *CheckpointConfig) Validate() error
Validate checks the CheckpointConfig.
type CheckpointRecoveryConfig ¶
type CheckpointRecoveryConfig struct {
// AutoResume enables automatic recovery on startup.
// Default: false
AutoResume *bool `yaml:"auto_resume,omitempty"`
// AutoResumeHITL enables automatic recovery for INPUT_REQUIRED tasks.
// When false, INPUT_REQUIRED tasks wait for explicit user action.
// Default: false
AutoResumeHITL *bool `yaml:"auto_resume_hitl,omitempty"`
// Timeout is the maximum age (in seconds) for a checkpoint to be recoverable.
// Checkpoints older than this are considered expired.
// Default: 3600 (1 hour)
Timeout int `yaml:"timeout,omitempty"`
}
CheckpointRecoveryConfig configures checkpoint recovery behavior.
func (*CheckpointRecoveryConfig) SetDefaults ¶
func (c *CheckpointRecoveryConfig) SetDefaults()
SetDefaults applies default values for CheckpointRecoveryConfig.
func (*CheckpointRecoveryConfig) Validate ¶
func (c *CheckpointRecoveryConfig) Validate() error
Validate checks the CheckpointRecoveryConfig.
type ChunkingConfig ¶
type ChunkingConfig struct {
// Strategy is the chunking strategy: "simple", "overlapping", "semantic".
Strategy string `yaml:"strategy,omitempty"`
// Size is the target chunk size in characters.
Size int `yaml:"size,omitempty"`
// Overlap is the overlap size (for overlapping strategy).
Overlap int `yaml:"overlap,omitempty"`
// MinSize is the minimum chunk size.
MinSize int `yaml:"min_size,omitempty"`
// MaxSize is the maximum chunk size.
MaxSize int `yaml:"max_size,omitempty"`
// PreserveWords avoids splitting mid-word.
PreserveWords *bool `yaml:"preserve_words,omitempty"`
}
ChunkingConfig configures document chunking.
func (*ChunkingConfig) SetDefaults ¶
func (c *ChunkingConfig) SetDefaults()
SetDefaults applies default values.
func (*ChunkingConfig) Validate ¶
func (c *ChunkingConfig) Validate() error
Validate checks the configuration for errors.
type Config ¶
type Config struct {
// Version of the config schema (e.g., "2").
Version string `` /* 134-byte string literal not displayed */
// Name of this configuration (for logging/display).
Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"title=Project Name,description=Name of this configuration"`
// Description of this configuration.
Description string `` /* 127-byte string literal not displayed */
// Database is the DSN connection string for the primary SQL database.
// All services (tasks, sessions, checkpoints, rate limiting) share this database.
// Format: sqlite://.hector/hector.db, postgres://user:pass@host:5432/db, mysql://...
Database string `` /* 159-byte string literal not displayed */
// VectorStores defines available vector database providers.
// These can be referenced by memory, RAG, and document stores.
VectorStores map[string]*VectorStoreConfig `` /* 146-byte string literal not displayed */
// LLMs defines available LLM providers.
LLMs map[string]*LLMConfig `yaml:"llms,omitempty" json:"llms,omitempty" jsonschema:"title=LLMs,description=LLM provider configurations"`
// Embedders defines available embedding providers for semantic search.
Embedders map[string]*EmbedderConfig `` /* 128-byte string literal not displayed */
// Tools defines available tools.
Tools map[string]*ToolConfig `yaml:"tools,omitempty" json:"tools,omitempty" jsonschema:"title=Tools,description=Tool configurations"`
// Agents defines available agents.
Agents map[string]*AgentConfig `yaml:"agents,omitempty" json:"agents,omitempty" jsonschema:"title=Agents,description=Agent configurations"`
// DocumentStores defines available document stores for RAG.
DocumentStores map[string]*DocumentStoreConfig `` /* 150-byte string literal not displayed */
// Server configures the A2A server infrastructure (network, security).
// Note: Server config CANNOT be modified via Studio API for security reasons.
Server ServerConfig `` /* 140-byte string literal not displayed */
// Memory configures cross-session memory/knowledge index.
Memory *MemoryConfig `yaml:"memory,omitempty" json:"memory,omitempty" jsonschema:"title=Memory,description=Memory index configuration"`
// Checkpoint configures execution state checkpointing and recovery.
Checkpoint *CheckpointConfig `` /* 135-byte string literal not displayed */
// Observability configures tracing and metrics.
// This section CAN be modified via Studio API.
Observability *observability.Config `` /* 140-byte string literal not displayed */
// Logger configures logging behavior.
Logger *LoggerConfig `yaml:"logger,omitempty" json:"logger,omitempty" jsonschema:"title=Logger Configuration,description=Logging behavior settings"`
// RateLimiting configures rate limiting.
RateLimiting *RateLimitConfig `` /* 134-byte string literal not displayed */
// Guardrails defines named guardrail configurations.
// Agents reference these by name via their "guardrails" field.
Guardrails map[string]*GuardrailsConfig `` /* 128-byte string literal not displayed */
// Defaults provides default values for agents.
Defaults *DefaultsConfig `yaml:"defaults,omitempty" json:"defaults,omitempty" jsonschema:"title=Defaults,description=Default values for agents"`
// contains filtered or unexported fields
}
Config is the root configuration structure.
func ParseConfigBytes ¶ added in v1.12.0
ParseConfigBytes parses YAML config bytes into a Config struct. Useful for ephemeral mode where config is generated in-memory.
func (*Config) GetAgent ¶
func (c *Config) GetAgent(name string) (*AgentConfig, bool)
GetAgent returns the agent config by name.
func (*Config) GetDatabaseConfig ¶ added in v1.17.1
func (c *Config) GetDatabaseConfig() (*DatabaseConfig, error)
GetDatabaseConfig returns the parsed DatabaseConfig from the DSN string. If the DSN is empty, returns a default SQLite config.
func (*Config) GetGuardrails ¶
func (c *Config) GetGuardrails(name string) (*GuardrailsConfig, bool)
GetGuardrails returns the guardrails config by name.
func (*Config) GetTool ¶
func (c *Config) GetTool(name string) (*ToolConfig, bool)
GetTool returns the tool config by name.
func (*Config) ListAgents ¶
ListAgents returns the names of all configured agents.
func (*Config) SetDefaults ¶
func (c *Config) SetDefaults()
SetDefaults applies default values to the config.
type ContentGuardrailConfig ¶
type ContentGuardrailConfig struct {
Enabled bool `yaml:"enabled" json:"enabled" jsonschema:"title=Enabled,default=false"`
BlockedKeywords []string `` /* 150-byte string literal not displayed */
BlockedPatterns []string `` /* 139-byte string literal not displayed */
Action string `yaml:"action,omitempty" json:"action,omitempty" jsonschema:"title=Action,enum=allow,enum=block,enum=warn,default=block"`
Severity string `` /* 137-byte string literal not displayed */
}
ContentGuardrailConfig configures content filtering.
type ContextConfig ¶
type ContextConfig struct {
// Strategy determines how context window is managed.
// Values:
// - "none": No filtering (include all history)
// - "buffer_window": Keep last N messages (simple, fast)
// - "token_window": Keep messages within token budget (accurate)
// - "summary_buffer": Summarize old messages when exceeding budget
// Default: "none" (for backwards compatibility)
Strategy string `` /* 206-byte string literal not displayed */
// WindowSize is the number of messages to keep for buffer_window strategy.
// Only used when Strategy="buffer_window".
// Default: 20
WindowSize int `` /* 175-byte string literal not displayed */
// Budget is the token budget for token_window and summary_buffer strategies.
// Only used when Strategy="token_window" or "summary_buffer".
// Default: 8000
Budget int `` /* 174-byte string literal not displayed */
// Threshold is the percentage of budget that triggers summarization.
// Only used when Strategy="summary_buffer".
// When current tokens > budget * threshold, summarization occurs.
// Default: 0.85 (85%)
Threshold float64 `` /* 176-byte string literal not displayed */
// Target is the percentage of budget to reduce to after summarization.
// Only used when Strategy="summary_buffer".
// Default: 0.7 (70%)
Target float64 `` /* 171-byte string literal not displayed */
// PreserveRecent is the minimum number of recent messages to always keep.
// Only used when Strategy="token_window".
// Default: 5
PreserveRecent int `` /* 181-byte string literal not displayed */
// SummarizerLLM references an LLM from the global llms config to use for summarization.
// Only used when Strategy="summary_buffer".
// If empty, uses the same LLM as the agent.
// Example: "gpt-4o-mini" (for cheaper summarization)
SummarizerLLM string `` /* 167-byte string literal not displayed */
}
ContextConfig configures working memory / context window management. This controls how conversation history is managed to fit within LLM context limits. Ported from legacy pkg/memory patterns for use in v2.
func (*ContextConfig) SetDefaults ¶
func (c *ContextConfig) SetDefaults()
SetDefaults applies default values to ContextConfig.
func (*ContextConfig) Validate ¶
func (c *ContextConfig) Validate() error
Validate checks the context configuration.
type CredentialsConfig ¶
type CredentialsConfig struct {
// Type is the credential type: "bearer", "api_key", or "basic"
Type string `yaml:"type,omitempty"`
// Token is the bearer token (for type: bearer)
Token string `yaml:"token,omitempty"`
// APIKey is the API key (for type: api_key)
APIKey string `yaml:"api_key,omitempty"`
// APIKeyHeader is the header name for API key (default: X-API-Key)
APIKeyHeader string `yaml:"api_key_header,omitempty"`
// Username for basic auth (for type: basic)
Username string `yaml:"username,omitempty"`
// Password for basic auth (for type: basic)
Password string `yaml:"password,omitempty"`
}
CredentialsConfig configures credentials for outbound requests. Used when calling remote agents or external services.
func (*CredentialsConfig) SetDefaults ¶
func (c *CredentialsConfig) SetDefaults()
SetDefaults applies default values to CredentialsConfig.
func (*CredentialsConfig) Validate ¶
func (c *CredentialsConfig) Validate() error
Validate checks the CredentialsConfig for errors.
type DBPool ¶
type DBPool struct {
// contains filtered or unexported fields
}
DBPool manages shared database connections. For SQLite, it ensures only one connection is used to prevent "database is locked" errors.
type DatabaseConfig ¶
type DatabaseConfig struct {
// RawDSN is the original DSN string provided by the user.
RawDSN string `yaml:"-" json:"-"`
// Parsed fields from DSN
Driver string
Host string
Port int
Database string
Username string
Password string
SSLMode string
MaxConns int
MaxIdle int
}
DatabaseConfig holds configuration for SQL database connections. Supports DSN format: postgres://user:pass@host:port/db, mysql://..., sqlite://path
func ParseDSN ¶ added in v1.17.1
func ParseDSN(dsn string) (*DatabaseConfig, error)
ParseDSN parses a database connection string and returns a DatabaseConfig. Supported formats:
- sqlite://.hector/hector.db
- sqlite://:memory:
- postgres://user:pass@host:5432/dbname?sslmode=disable
- mysql://user:pass@host:3306/dbname
func (*DatabaseConfig) DSN ¶
func (c *DatabaseConfig) DSN() string
DSN returns the data source name (connection string) for the database.
func (*DatabaseConfig) Dialect ¶
func (c *DatabaseConfig) Dialect() string
Dialect returns the SQL dialect name for query building.
func (*DatabaseConfig) DriverName ¶
func (c *DatabaseConfig) DriverName() string
DriverName returns the normalized driver name for sql.Open().
func (*DatabaseConfig) Validate ¶
func (c *DatabaseConfig) Validate() error
Validate checks the database configuration.
type DefaultsConfig ¶
type DefaultsConfig struct {
// LLM is the default LLM reference for agents.
LLM string `yaml:"llm,omitempty" json:"llm,omitempty" jsonschema:"title=Default LLM,description=Default LLM reference for agents"`
}
DefaultsConfig provides default values for agent configurations.
type DocumentSearchConfig ¶
type DocumentSearchConfig struct {
// TopK is the default number of results.
TopK int `yaml:"top_k,omitempty"`
// Threshold filters results below this score.
Threshold float32 `yaml:"threshold,omitempty"`
// EnableHyDE enables hypothetical document embeddings.
EnableHyDE bool `yaml:"enable_hyde,omitempty"`
// HyDELLM references an LLM for HyDE generation.
HyDELLM string `yaml:"hyde_llm,omitempty"`
// EnableRerank enables LLM-based reranking.
EnableRerank bool `yaml:"enable_rerank,omitempty"`
// RerankLLM references an LLM for reranking.
RerankLLM string `yaml:"rerank_llm,omitempty"`
// RerankMaxResults limits reranking candidates.
RerankMaxResults int `yaml:"rerank_max_results,omitempty"`
// EnableMultiQuery enables query expansion.
EnableMultiQuery bool `yaml:"enable_multi_query,omitempty"`
// MultiQueryLLM references an LLM for query expansion.
MultiQueryLLM string `yaml:"multi_query_llm,omitempty"`
// MultiQueryCount is the number of query variants.
MultiQueryCount int `yaml:"multi_query_count,omitempty"`
}
DocumentSearchConfig configures search behavior for a document store.
func (*DocumentSearchConfig) SetDefaults ¶
func (c *DocumentSearchConfig) SetDefaults()
SetDefaults applies default values.
func (*DocumentSearchConfig) Validate ¶
func (c *DocumentSearchConfig) Validate() error
Validate checks the configuration for errors.
type DocumentSourceConfig ¶
type DocumentSourceConfig struct {
// Type is the source type: "directory", "sql", "api", "collection".
Type string `yaml:"type"`
// Path is the directory path (for directory sources).
Path string `yaml:"path,omitempty"`
// Include patterns for files (for directory sources).
Include []string `yaml:"include,omitempty"`
// Exclude patterns for files (for directory sources).
Exclude []string `yaml:"exclude,omitempty"`
// MaxFileSize limits file size in bytes (for directory sources).
MaxFileSize int64 `yaml:"max_file_size,omitempty"`
// SQL configuration (for sql sources).
SQL *SQLSourceConfig `yaml:"sql,omitempty"`
// API configuration (for api sources).
API *APISourceConfig `yaml:"api,omitempty"`
// Collection name (for collection sources - references existing pre-populated collection).
Collection string `yaml:"collection,omitempty"`
}
DocumentSourceConfig configures a document source.
func (*DocumentSourceConfig) SetDefaults ¶
func (c *DocumentSourceConfig) SetDefaults()
SetDefaults applies default values.
func (*DocumentSourceConfig) Validate ¶
func (c *DocumentSourceConfig) Validate() error
Validate checks the configuration for errors.
type DocumentStoreConfig ¶
type DocumentStoreConfig struct {
// Source configures where documents come from.
Source *DocumentSourceConfig `yaml:"source"`
// Chunking configures how documents are split.
Chunking *ChunkingConfig `yaml:"chunking,omitempty"`
// VectorStore references a vector store from vector_stores.
VectorStore string `yaml:"vector_store,omitempty"`
// Embedder references an embedder from embedders.
Embedder string `yaml:"embedder,omitempty"`
// Collection overrides the collection name.
Collection string `yaml:"collection,omitempty"`
// Watch enables file watching for automatic re-indexing.
Watch bool `yaml:"watch,omitempty"`
// IncrementalIndexing only re-indexes changed documents.
IncrementalIndexing bool `yaml:"incremental_indexing,omitempty"`
// Search configures search behavior for this store.
Search *DocumentSearchConfig `yaml:"search,omitempty"`
// Indexing configures indexing behavior (concurrency, retry).
Indexing *IndexingConfig `yaml:"indexing,omitempty"`
// MCPParsers configures MCP-based document parsing (e.g., Docling).
// When configured, MCP tools are used to parse documents instead of native parsers.
MCPParsers *MCPParserConfig `yaml:"mcp_parsers,omitempty"`
}
DocumentStoreConfig configures a document store for RAG.
Example YAML:
document_stores:
codebase:
source:
type: directory
path: ./src
include: ["*.go", "*.ts"]
chunking:
strategy: semantic
size: 1000
vector_store: local
embedder: default
watch: true
indexing:
max_concurrent: 8
retry:
max_retries: 3
base_delay: 1s
func (*DocumentStoreConfig) SetDefaults ¶
func (c *DocumentStoreConfig) SetDefaults()
SetDefaults applies default values.
func (*DocumentStoreConfig) Validate ¶
func (c *DocumentStoreConfig) Validate() error
Validate checks the configuration for errors.
type Duration ¶
Duration is a time.Duration that supports YAML parsing.
Supports formats like: "1s", "5m", "2h", "100ms", "1h30m"
func (Duration) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler for Duration.
func (*Duration) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler for Duration.
type EmbedderConfig ¶
type EmbedderConfig struct {
// Provider specifies the embedding service.
// Values: "openai", "ollama", "cohere"
Provider string `yaml:"provider,omitempty"`
// Model is the embedding model name.
// OpenAI: "text-embedding-3-small", "text-embedding-3-large"
// Ollama: "nomic-embed-text", "all-minilm:l6-v2"
// Cohere: "embed-english-v3.0", "embed-multilingual-v3.0", "embed-v4.0"
Model string `yaml:"model,omitempty"`
// APIKey for the embedding provider (OpenAI and Cohere require this).
// Can use environment variable expansion: ${OPENAI_API_KEY}
APIKey string `yaml:"api_key,omitempty"`
// BaseURL for the API endpoint.
// OpenAI default: https://api.openai.com/v1
// Ollama default: http://localhost:11434
// Cohere default: https://api.cohere.com
BaseURL string `yaml:"base_url,omitempty"`
// Dimension of the embedding vectors (auto-detected if 0).
Dimension int `yaml:"dimension,omitempty"`
// Timeout in seconds for API requests (default: 30).
Timeout int `yaml:"timeout,omitempty"`
// BatchSize for batch embedding requests (default: 100 for OpenAI/Ollama, 96 for Cohere).
BatchSize int `yaml:"batch_size,omitempty"`
// EncodingFormat for OpenAI API (optional).
// Values: "float" (default), "base64"
// Note: Currently only "float" is supported in response parsing.
EncodingFormat string `yaml:"encoding_format,omitempty"`
// User for OpenAI API (optional).
// A unique identifier representing your end-user, which can help OpenAI monitor and detect abuse.
User string `yaml:"user,omitempty"`
// InputType for Cohere v3+ models (required).
// Values: "search_document", "search_query", "classification", "clustering"
// Default: "search_document"
InputType string `yaml:"input_type,omitempty"`
// OutputDimension for Cohere v4+ models (optional).
// Values: 256, 512, 1024, 1536
// If set, overrides model's default dimension.
OutputDimension int `yaml:"output_dimension,omitempty"`
// Truncate for Cohere API (optional).
// Values: "NONE", "START", "END" (default: "END")
Truncate string `yaml:"truncate,omitempty"`
}
EmbedderConfig configures an embedding provider for semantic search.
Embedders convert text to vector embeddings for similarity search. They are used by the memory IndexService for semantic retrieval.
Example:
embedders:
default:
provider: openai
model: text-embedding-3-small
api_key: ${OPENAI_API_KEY}
local:
provider: ollama
model: nomic-embed-text
base_url: http://localhost:11434
func (*EmbedderConfig) SetDefaults ¶
func (c *EmbedderConfig) SetDefaults()
SetDefaults applies default values.
func (*EmbedderConfig) Validate ¶
func (c *EmbedderConfig) Validate() error
Validate checks the embedder configuration.
type EnvVarInfo ¶ added in v1.12.0
type EnvVarInfo struct {
Name string
Required bool
Value string // Current value (for checking if set)
}
EnvVarInfo tracks environment variables that should be documented.
type GeneratorResult ¶ added in v1.12.0
type GeneratorResult struct {
ConfigYAML []byte
EnvVars []EnvVarInfo
ConfigPath string
SkillUsed bool
CreatedNew bool
}
GeneratorResult contains the output of config generation.
func EnsureConfigExists ¶ added in v1.12.0
func EnsureConfigExists(opts CLIOptions, configPath string) (*GeneratorResult, error)
EnsureConfigExists ensures a configuration file exists, creating one if needed. Returns the path to the config file and whether it was created.
func GenerateLeanConfig ¶ added in v1.12.0
func GenerateLeanConfig(opts CLIOptions, configPath string) (*GeneratorResult, error)
GenerateLeanConfig creates a minimal configuration from CLI options. Only explicitly provided values are included in the output.
type GuardrailsConfig ¶
type GuardrailsConfig struct {
// Enabled controls whether guardrails are active.
Enabled bool `yaml:"enabled" json:"enabled" jsonschema:"title=Enabled,description=Whether guardrails are active,default=true"`
// Input guardrail configurations.
Input *InputGuardrailsConfig `` /* 136-byte string literal not displayed */
// Output guardrail configurations.
Output *OutputGuardrailsConfig `` /* 136-byte string literal not displayed */
// Tool guardrail configurations.
Tool *ToolGuardrailsConfig `yaml:"tool,omitempty" json:"tool,omitempty" jsonschema:"title=Tool Guardrails,description=Tool authorization settings"`
}
GuardrailsConfig contains guardrails configuration. Guardrails provide safety controls for agent inputs, outputs, and tool calls.
func DefaultGuardrailsConfig ¶
func DefaultGuardrailsConfig() *GuardrailsConfig
DefaultGuardrailsConfig returns sensible default guardrails configuration.
func (*GuardrailsConfig) SetDefaults ¶
func (c *GuardrailsConfig) SetDefaults()
SetDefaults applies default values to the guardrails config.
func (*GuardrailsConfig) Validate ¶
func (c *GuardrailsConfig) Validate() error
Validate checks the guardrails configuration for errors.
type IndexingConfig ¶
type IndexingConfig struct {
// MaxConcurrent limits parallel document processing.
// Default: runtime.NumCPU() (typically 4-16 workers)
// Set to 1 for sequential indexing.
//
// Guidelines:
// - CPU-bound (local embedding): use NumCPU
// - IO-bound (API embedding): use 2x-4x NumCPU
// - Rate-limited APIs: use lower values (2-4)
MaxConcurrent int `yaml:"max_concurrent,omitempty"`
// Retry configures retry behavior for transient failures.
Retry *RetryConfig `yaml:"retry,omitempty"`
}
IndexingConfig configures document indexing behavior.
Example YAML:
indexing:
max_concurrent: 8 # Number of parallel workers
retry:
max_retries: 5 # Retry failed operations
base_delay: 2s # Initial delay between retries
max_delay: 60s # Maximum delay between retries
func (*IndexingConfig) SetDefaults ¶
func (c *IndexingConfig) SetDefaults()
SetDefaults applies default values.
func (*IndexingConfig) Validate ¶
func (c *IndexingConfig) Validate() error
Validate checks the configuration for errors.
type InjectionGuardrailConfig ¶
type InjectionGuardrailConfig struct {
Enabled bool `yaml:"enabled" json:"enabled" jsonschema:"title=Enabled,default=true"`
Patterns []string `` /* 134-byte string literal not displayed */
CaseSensitive bool `yaml:"case_sensitive,omitempty" json:"case_sensitive,omitempty" jsonschema:"title=Case Sensitive,default=false"`
Action string `yaml:"action,omitempty" json:"action,omitempty" jsonschema:"title=Action,enum=allow,enum=block,enum=warn,default=block"`
Severity string `` /* 137-byte string literal not displayed */
}
InjectionGuardrailConfig configures prompt injection detection.
type InputGuardrailsConfig ¶
type InputGuardrailsConfig struct {
// ChainMode for input guardrails: "fail_fast" or "collect_all".
ChainMode string `` /* 181-byte string literal not displayed */
// Length validation settings.
Length *LengthGuardrailConfig `yaml:"length,omitempty" json:"length,omitempty" jsonschema:"title=Length Validation,description=Input length constraints"`
// Injection detection settings.
Injection *InjectionGuardrailConfig `` /* 132-byte string literal not displayed */
// Sanitization settings.
Sanitizer *SanitizerGuardrailConfig `` /* 136-byte string literal not displayed */
// Pattern validation settings.
Pattern *PatternGuardrailConfig `yaml:"pattern,omitempty" json:"pattern,omitempty" jsonschema:"title=Pattern Validation,description=Regex-based validation"`
}
InputGuardrailsConfig contains input guardrail settings.
type LLMConfig ¶
type LLMConfig struct {
// Provider type (anthropic, openai, gemini, ollama).
Provider LLMProvider `` /* 173-byte string literal not displayed */
// Model name (e.g., "claude-sonnet-4-20250514", "gpt-4o").
Model string `yaml:"model,omitempty" json:"model,omitempty" jsonschema:"title=Model,description=Model identifier"`
// APIKey for authentication. Supports ${VAR} expansion.
APIKey string `` /* 132-byte string literal not displayed */
// BaseURL overrides the default API endpoint.
BaseURL string `yaml:"base_url,omitempty" json:"base_url,omitempty" jsonschema:"title=Base URL,description=Custom base URL for API endpoint"`
// Temperature for generation (0.0 - 1.0).
Temperature *float64 `` /* 153-byte string literal not displayed */
// MaxTokens limits response length.
MaxTokens int `` /* 147-byte string literal not displayed */
// MaxToolOutputLength limits the length of tool outputs to prevent context overflow.
// 0 means unlimited.
MaxToolOutputLength int `` /* 222-byte string literal not displayed */
// Thinking enables extended thinking (Claude).
Thinking *ThinkingConfig `` /* 146-byte string literal not displayed */
}
LLMConfig configures an LLM provider.
func (*LLMConfig) SetDefaults ¶
func (c *LLMConfig) SetDefaults()
SetDefaults applies default values.
type LLMProvider ¶
type LLMProvider string
LLMProvider identifies the LLM provider type.
const ( LLMProviderAnthropic LLMProvider = "anthropic" LLMProviderOpenAI LLMProvider = "openai" LLMProviderGemini LLMProvider = "gemini" LLMProviderOllama LLMProvider = "ollama" LLMProviderDeepSeek LLMProvider = "deepseek" LLMProviderGroq LLMProvider = "groq" LLMProviderMistral LLMProvider = "mistral" LLMProviderCohere LLMProvider = "cohere" )
type LengthGuardrailConfig ¶
type LengthGuardrailConfig struct {
Enabled bool `yaml:"enabled" json:"enabled" jsonschema:"title=Enabled,default=true"`
MinLength int `yaml:"min_length,omitempty" json:"min_length,omitempty" jsonschema:"title=Minimum Length,default=1"`
MaxLength int `yaml:"max_length,omitempty" json:"max_length,omitempty" jsonschema:"title=Maximum Length,default=100000"`
Action string `yaml:"action,omitempty" json:"action,omitempty" jsonschema:"title=Action,enum=allow,enum=block,enum=warn,default=block"`
Severity string `` /* 139-byte string literal not displayed */
}
LengthGuardrailConfig configures input length validation.
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader loads and watches configuration from a Provider.
func NewLoader ¶
func NewLoader(p provider.Provider, opts ...LoaderOption) *Loader
NewLoader creates a Loader with the given provider.
type LoaderOption ¶
type LoaderOption func(*Loader)
LoaderOption configures a Loader.
func WithOnChange ¶
func WithOnChange(fn func(*Config)) LoaderOption
WithOnChange sets a callback invoked when config changes.
func WithOverrides ¶ added in v1.12.0
func WithOverrides(fn func(*Config)) LoaderOption
WithOverrides adds a function that modifies the config after loading but before validation. Useful for ensuring CLI flags override config file values.
type LoggerConfig ¶
type LoggerConfig struct {
// Level specifies the log level (debug, info, warn, error).
// Default: info
Level string `yaml:"level,omitempty"`
// File specifies the log file path.
// If empty, logs go to stderr.
// Default: empty (stderr)
File string `yaml:"file,omitempty"`
// Format specifies the log format.
// Values: "simple" (level + message), "verbose" (time + level + message), or custom.
// Default: simple
Format string `yaml:"format,omitempty"`
}
LoggerConfig configures logging behavior.
Priority order (highest to lowest):
- CLI flags (--log-level, --log-file, --log-format)
- Environment variables (LOG_LEVEL, LOG_FILE, LOG_FORMAT)
- Config file (logger section)
- Defaults (info level, simple format, stderr)
Example:
logger: level: info file: hector.log format: simple
func (*LoggerConfig) SetDefaults ¶
func (c *LoggerConfig) SetDefaults()
SetDefaults applies default values to LoggerConfig.
func (*LoggerConfig) Validate ¶
func (c *LoggerConfig) Validate() error
Validate checks the logger configuration.
type MCPParserConfig ¶
type MCPParserConfig struct {
// ToolNames are the MCP tool names to try for parsing (in order).
// Example: ["parse_document", "docling_parse", "convert_document"]
ToolNames []string `yaml:"tool_names"`
// Extensions limits which file types use MCP parsing.
// Empty means all binary files.
// Example: [".pdf", ".docx", ".pptx", ".xlsx"]
Extensions []string `yaml:"extensions,omitempty"`
// Priority sets the extractor priority (higher = preferred).
// Default: 8 (higher than native parsers at 5)
Priority *int `yaml:"priority,omitempty"`
// PreferNative uses MCP only when native parsers fail.
// Default: false
PreferNative *bool `yaml:"prefer_native,omitempty"`
// PathPrefix remaps local paths for containerized MCP services.
// Example: "/docs" when mounting ./my-docs:/docs in Docker
PathPrefix string `yaml:"path_prefix,omitempty"`
}
MCPParserConfig configures MCP-based document parsing.
MCP (Model Context Protocol) tools like Docling can be used for advanced document parsing with better quality than native parsers.
Example YAML:
mcp_parsers: tool_names: ["convert_document_into_docling_document"] extensions: [".pdf", ".docx", ".pptx"] priority: 8 path_prefix: "/docs" # For containerized MCP services
func (*MCPParserConfig) SetDefaults ¶
func (c *MCPParserConfig) SetDefaults()
SetDefaults applies default values.
func (*MCPParserConfig) Validate ¶
func (c *MCPParserConfig) Validate() error
Validate checks the configuration for errors.
type MemoryConfig ¶
type MemoryConfig struct {
// Backend specifies the index backend.
// Values:
// - "keyword" (default): Simple word matching, no embedder needed
// - "vector": Semantic vector search using embeddings
Backend string `` /* 155-byte string literal not displayed */
// Embedder references an embedder from the top-level embedders config.
// Required when backend="vector".
Embedder string `` /* 150-byte string literal not displayed */
// VectorStore references a vector store from the top-level vector_stores config.
// Required when backend="vector".
VectorStore string `` /* 166-byte string literal not displayed */
// EnableAutoRecall enables automatic recall of relevant memories before each LLM call.
// Only used when backend="vector".
// Default: true (when vector backend is used)
EnableAutoRecall *bool `` /* 195-byte string literal not displayed */
// RecallLimit is the maximum number of memories to recall automatically.
// Only used when EnableAutoRecall is true.
// Default: 5
RecallLimit int `` /* 160-byte string literal not displayed */
}
MemoryConfig configures the memory index service.
Architecture (derived from legacy Hector):
┌─────────────────────────────────────────────────────────┐ │ session.Service (SQL) → SOURCE OF TRUTH │ │ All conversation data is persisted here │ ├─────────────────────────────────────────────────────────┤ │ IndexService → SEARCH INDEX (can be rebuilt) │ │ - keyword: Simple word matching (default) │ │ - vector: Semantic similarity using embeddings │ │ │ │ vector.Provider → VECTOR STORAGE (reusable) │ │ - Defined in top-level vector_stores section │ │ - Referenced by name │ └─────────────────────────────────────────────────────────┘
Example:
vector_stores:
myvector:
type: chromem
persist_path: .hector/vectors
embedders:
default:
provider: openai
model: text-embedding-3-small
api_key: ${OPENAI_API_KEY}
storage:
memory:
backend: vector
embedder: default
vector_store: myvector
func (*MemoryConfig) IsKeyword ¶
func (c *MemoryConfig) IsKeyword() bool
IsKeyword returns true if using keyword-based search index (default).
func (*MemoryConfig) IsVector ¶
func (c *MemoryConfig) IsVector() bool
IsVector returns true if using vector-based semantic search index.
func (*MemoryConfig) SetDefaults ¶
func (c *MemoryConfig) SetDefaults()
SetDefaults applies default values for MemoryConfig.
func (*MemoryConfig) Validate ¶
func (c *MemoryConfig) Validate() error
Validate checks the memory configuration.
type NotificationConfig ¶ added in v1.15.0
type NotificationConfig struct {
// ID is the unique identifier for this notification.
ID string `yaml:"id" json:"id" jsonschema:"title=Notification ID,description=Unique identifier for this notification"`
// Type of notification (webhook).
// Default: webhook
Type NotificationType `` /* 126-byte string literal not displayed */
// Enabled controls whether this notification is active.
Enabled *bool `` /* 136-byte string literal not displayed */
// Events that trigger this notification.
// Default: [task.completed]
Events []NotificationEvent `yaml:"events,omitempty" json:"events,omitempty" jsonschema:"title=Events,description=Events that trigger notification"`
// URL is the webhook endpoint to send notifications to.
URL string `yaml:"url" json:"url" jsonschema:"title=Webhook URL,description=URL to send notifications to"`
// Headers are additional HTTP headers to include.
Headers map[string]string `yaml:"headers,omitempty" json:"headers,omitempty" jsonschema:"title=Headers,description=Additional HTTP headers"`
// Payload configures the notification payload.
Payload *NotificationPayloadConfig `yaml:"payload,omitempty" json:"payload,omitempty" jsonschema:"title=Payload,description=Payload configuration"`
// Retry configures retry behavior for failed notifications.
Retry *NotificationRetryConfig `yaml:"retry,omitempty" json:"retry,omitempty" jsonschema:"title=Retry,description=Retry configuration"`
}
NotificationConfig configures an outbound notification.
func (*NotificationConfig) HasEvent ¶ added in v1.15.0
func (c *NotificationConfig) HasEvent(event NotificationEvent) bool
HasEvent checks if the notification is configured for a specific event.
func (*NotificationConfig) IsEnabled ¶ added in v1.15.0
func (c *NotificationConfig) IsEnabled() bool
IsEnabled returns whether the notification is enabled.
func (*NotificationConfig) SetDefaults ¶ added in v1.15.0
func (c *NotificationConfig) SetDefaults()
SetDefaults applies default values.
func (*NotificationConfig) Validate ¶ added in v1.15.0
func (c *NotificationConfig) Validate() error
Validate checks the notification configuration.
type NotificationEvent ¶ added in v1.15.0
type NotificationEvent string
NotificationEvent represents events that can trigger notifications.
const ( // NotificationEventTaskCompleted fires when an agent task completes successfully. NotificationEventTaskCompleted NotificationEvent = "task.completed" // NotificationEventTaskFailed fires when an agent task fails. NotificationEventTaskFailed NotificationEvent = "task.failed" // NotificationEventTaskStarted fires when an agent task starts. NotificationEventTaskStarted NotificationEvent = "task.started" )
type NotificationPayloadConfig ¶ added in v1.15.0
type NotificationPayloadConfig struct {
// Template is a Go text/template for generating the payload.
// Available data: .event, .agent_name, .task_id, .status, .result, .error, .timestamp
Template string `` /* 134-byte string literal not displayed */
}
NotificationPayloadConfig configures notification payload generation.
type NotificationRetryConfig ¶ added in v1.15.0
type NotificationRetryConfig struct {
// MaxAttempts is the maximum number of retry attempts.
// Default: 3
MaxAttempts int `` /* 136-byte string literal not displayed */
// InitialDelay is the initial delay before first retry.
// Default: 1s
InitialDelay time.Duration `` /* 137-byte string literal not displayed */
// MaxDelay is the maximum delay between retries.
// Default: 30s
MaxDelay time.Duration `` /* 126-byte string literal not displayed */
}
NotificationRetryConfig configures retry behavior.
func (*NotificationRetryConfig) SetDefaults ¶ added in v1.15.0
func (c *NotificationRetryConfig) SetDefaults()
SetDefaults applies default values for retry config.
type NotificationType ¶ added in v1.15.0
type NotificationType string
NotificationType identifies the notification delivery method.
const ( // NotificationTypeWebhook sends notifications via HTTP webhook. NotificationTypeWebhook NotificationType = "webhook" )
type OutputGuardrailsConfig ¶
type OutputGuardrailsConfig struct {
// ChainMode for output guardrails: "fail_fast" or "collect_all".
ChainMode string `` /* 135-byte string literal not displayed */
// PII detection/redaction settings.
PII *PIIGuardrailConfig `` /* 140-byte string literal not displayed */
// Content filtering settings.
Content *ContentGuardrailConfig `` /* 131-byte string literal not displayed */
}
OutputGuardrailsConfig contains output guardrail settings.
type PIIGuardrailConfig ¶
type PIIGuardrailConfig struct {
Enabled bool `yaml:"enabled" json:"enabled" jsonschema:"title=Enabled,default=true"`
DetectEmail bool `yaml:"detect_email,omitempty" json:"detect_email,omitempty" jsonschema:"title=Detect Email,default=true"`
DetectPhone bool `yaml:"detect_phone,omitempty" json:"detect_phone,omitempty" jsonschema:"title=Detect Phone,default=true"`
DetectSSN bool `yaml:"detect_ssn,omitempty" json:"detect_ssn,omitempty" jsonschema:"title=Detect SSN,default=true"`
DetectCreditCard bool `yaml:"detect_credit_card,omitempty" json:"detect_credit_card,omitempty" jsonschema:"title=Detect Credit Card,default=true"`
RedactMode string `` /* 133-byte string literal not displayed */
Action string `` /* 132-byte string literal not displayed */
Severity string `` /* 137-byte string literal not displayed */
}
PIIGuardrailConfig configures PII detection and redaction.
type PatternGuardrailConfig ¶
type PatternGuardrailConfig struct {
Enabled bool `yaml:"enabled" json:"enabled" jsonschema:"title=Enabled,default=false"`
AllowPatterns []string `` /* 140-byte string literal not displayed */
BlockPatterns []string `` /* 144-byte string literal not displayed */
Action string `yaml:"action,omitempty" json:"action,omitempty" jsonschema:"title=Action,enum=allow,enum=block,enum=warn,default=block"`
Severity string `` /* 139-byte string literal not displayed */
}
PatternGuardrailConfig configures pattern-based validation.
type PromptConfig ¶
type PromptConfig struct {
// SystemPrompt is the full system prompt (overrides Instruction).
SystemPrompt string `` /* 149-byte string literal not displayed */
// Role defines the agent's role.
Role string `yaml:"role,omitempty" json:"role,omitempty" jsonschema:"title=Role,description=Agent's role"`
// Guidance provides additional instructions.
Guidance string `yaml:"guidance,omitempty" json:"guidance,omitempty" jsonschema:"title=Guidance,description=Additional instructions"`
}
PromptConfig provides detailed prompt configuration.
type RateLimitConfig ¶
type RateLimitConfig struct {
// Enabled controls whether rate limiting is active.
Enabled *bool `yaml:"enabled,omitempty" json:"enabled,omitempty"`
// Scope is the rate limiting scope ("session" or "user").
Scope string `yaml:"scope,omitempty" json:"scope,omitempty"`
// Limits defines the rate limit rules.
Limits []RateLimitRule `yaml:"limits,omitempty" json:"limits,omitempty"`
}
RateLimitConfig defines rate limiting configuration. Rate limiting uses the primary database (cfg.Database) for persistence.
func (*RateLimitConfig) IsEnabled ¶
func (c *RateLimitConfig) IsEnabled() bool
IsEnabled returns true if rate limiting is enabled.
func (*RateLimitConfig) SetDefaults ¶
func (c *RateLimitConfig) SetDefaults()
SetDefaults sets default values for RateLimitConfig.
func (*RateLimitConfig) Validate ¶
func (c *RateLimitConfig) Validate() error
Validate validates the RateLimitConfig.
type RateLimitRule ¶
type RateLimitRule struct {
// Type is the limit type ("token" or "count").
Type string `yaml:"type" json:"type"`
// Window is the time window ("minute", "hour", "day", "week", "month").
Window string `yaml:"window" json:"window"`
// Limit is the maximum allowed in the window.
Limit int64 `yaml:"limit" json:"limit"`
}
RateLimitRule defines a single rate limit rule.
type ReasoningConfig ¶
type ReasoningConfig struct {
// MaxIterations is a SAFETY limit, not the primary termination condition.
// The loop terminates when semantic conditions are met (no tool calls, etc.)
// This is only a fallback to prevent runaway loops.
// Default: 100 (high enough to not interfere with normal operation)
MaxIterations int `` /* 174-byte string literal not displayed */
// EnableExitTool adds the exit_loop tool for explicit termination.
// When true, the agent can call exit_loop to signal task completion.
EnableExitTool *bool `` /* 173-byte string literal not displayed */
// EnableEscalateTool adds the escalate tool for parent delegation.
// When true, the agent can escalate to a higher-level agent.
EnableEscalateTool *bool `` /* 181-byte string literal not displayed */
// TerminationConditions lists which conditions terminate the loop.
// Built-in conditions:
// - "no_tool_calls" - model doesn't request tools (default)
// - "escalate" - agent escalates to parent
// - "transfer" - agent transfers to another agent
// - "skip_summarization" - explicit completion signal
// - "input_required" - HITL pause
// Custom conditions can be added programmatically.
// Default: all built-in conditions enabled
TerminationConditions []string `` /* 178-byte string literal not displayed */
// CompletionInstruction is appended to help the model know when to stop.
// If empty and EnableExitTool/EnableEscalateTool are set, a default
// completion instruction is generated.
CompletionInstruction string `` /* 186-byte string literal not displayed */
}
ReasoningConfig configures the chain-of-thought reasoning loop. This follows adk-go patterns for semantic loop termination rather than arbitrary iteration limits.
func (*ReasoningConfig) BuildCompletionInstruction ¶
func (c *ReasoningConfig) BuildCompletionInstruction() string
BuildCompletionInstruction generates instruction text based on config. Returns empty string if no control tools are enabled and no custom instruction.
func (*ReasoningConfig) SetDefaults ¶
func (c *ReasoningConfig) SetDefaults()
SetDefaults applies default values to ReasoningConfig.
type RetryConfig ¶
type RetryConfig struct {
// MaxRetries is the maximum number of retry attempts.
// Default: 3
MaxRetries int `yaml:"max_retries,omitempty"`
// BaseDelay is the initial delay between retries.
// Each subsequent retry doubles this value.
// Default: 1s
BaseDelay Duration `yaml:"base_delay,omitempty"`
// MaxDelay is the maximum delay between retries.
// Default: 30s
MaxDelay Duration `yaml:"max_delay,omitempty"`
// Jitter adds randomness to delays to prevent thundering herd.
// Value between 0.0 and 1.0.
// Default: 0.1 (±10% variation)
Jitter float64 `yaml:"jitter,omitempty"`
}
RetryConfig configures retry behavior for transient failures.
Uses exponential backoff with jitter (pattern from v2/httpclient).
Example YAML:
retry: max_retries: 3 # Number of retry attempts base_delay: 1s # Initial delay (doubles each retry) max_delay: 30s # Maximum delay between retries jitter: 0.1 # Randomness factor (0.0-1.0)
func (*RetryConfig) SetDefaults ¶
func (c *RetryConfig) SetDefaults()
SetDefaults applies default values.
func (*RetryConfig) Validate ¶
func (c *RetryConfig) Validate() error
Validate checks the configuration for errors.
type SQLSourceConfig ¶
type SQLSourceConfig struct {
// DSN is the database connection string.
// If empty, uses the primary database.
// Format: sqlite://path, postgres://user:pass@host:port/db, etc.
DSN string `yaml:"dsn,omitempty"`
// Tables defines which tables to index.
Tables []SQLTableConfig `yaml:"tables"`
}
SQLSourceConfig configures a SQL-based document source.
func (*SQLSourceConfig) SetDefaults ¶ added in v1.15.2
func (c *SQLSourceConfig) SetDefaults()
SetDefaults applies default values.
func (*SQLSourceConfig) Validate ¶
func (c *SQLSourceConfig) Validate() error
Validate checks the configuration for errors.
type SQLTableConfig ¶
type SQLTableConfig struct {
// Table is the table name.
Table string `yaml:"table"`
// Columns to concatenate for content.
Columns []string `yaml:"columns"`
// IDColumn is the primary key column.
IDColumn string `yaml:"id_column"`
// UpdatedColumn tracks document changes (e.g., updated_at).
UpdatedColumn string `yaml:"updated_column,omitempty"`
// WhereClause filters rows.
WhereClause string `yaml:"where_clause,omitempty"`
// MetadataColumns to include as metadata.
MetadataColumns []string `yaml:"metadata_columns,omitempty"`
}
SQLTableConfig defines which table and columns to index.
func (*SQLTableConfig) SetDefaults ¶ added in v1.15.2
func (c *SQLTableConfig) SetDefaults()
SetDefaults applies default values.
func (*SQLTableConfig) Validate ¶
func (c *SQLTableConfig) Validate() error
Validate checks the configuration for errors.
type SanitizerGuardrailConfig ¶
type SanitizerGuardrailConfig struct {
Enabled bool `yaml:"enabled" json:"enabled" jsonschema:"title=Enabled,default=true"`
TrimWhitespace bool `yaml:"trim_whitespace,omitempty" json:"trim_whitespace,omitempty" jsonschema:"title=Trim Whitespace,default=true"`
NormalizeUnicode bool `yaml:"normalize_unicode,omitempty" json:"normalize_unicode,omitempty" jsonschema:"title=Normalize Unicode,default=false"`
MaxLength int `` /* 131-byte string literal not displayed */
StripHTML bool `yaml:"strip_html,omitempty" json:"strip_html,omitempty" jsonschema:"title=Strip HTML,default=false"`
}
SanitizerGuardrailConfig configures input sanitization.
type ServerConfig ¶
type ServerConfig struct {
// Host to bind to.
Host string `yaml:"host,omitempty"`
// Port to listen on (HTTP/JSON-RPC).
Port int `yaml:"port,omitempty"`
// GRPCPort is the port for gRPC server (default: 50051).
// Only used when Transport is "grpc".
GRPCPort int `yaml:"grpc_port,omitempty"`
// Transport protocol (json-rpc, grpc).
Transport TransportType `yaml:"transport,omitempty"`
// TLS configuration.
TLS *TLSConfig `yaml:"tls,omitempty"`
// CORS configuration.
CORS *CORSConfig `yaml:"cors,omitempty"`
// Auth configures JWT-based authentication.
Auth *AuthConfig `yaml:"auth,omitempty"`
// Studio configures studio mode for config editing.
Studio *StudioConfig `yaml:"studio,omitempty"`
}
ServerConfig configures the A2A server infrastructure.
This section contains network and security configuration that CANNOT be modified via the Studio API for security reasons. For storage settings (tasks, sessions, memory), use the StorageConfig.
func (*ServerConfig) Address ¶
func (c *ServerConfig) Address() string
Address returns the HTTP server address.
func (*ServerConfig) GRPCAddress ¶
func (c *ServerConfig) GRPCAddress() string
GRPCAddress returns the gRPC server address.
func (*ServerConfig) SetDefaults ¶
func (c *ServerConfig) SetDefaults()
SetDefaults applies default values.
func (*ServerConfig) Validate ¶
func (c *ServerConfig) Validate() error
Validate checks the server configuration.
type SkillConfig ¶
type SkillConfig struct {
// ID is a unique identifier for the skill.
ID string `yaml:"id,omitempty" json:"id,omitempty" jsonschema:"title=Skill ID,description=Unique identifier for the skill"`
// Name is the display name.
Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"title=Skill Name,description=Display name"`
// Description explains what the skill does.
Description string `` /* 127-byte string literal not displayed */
// Tags for categorization.
Tags []string `yaml:"tags,omitempty" json:"tags,omitempty" jsonschema:"title=Tags,description=Tags for categorization"`
// Examples of prompts this skill handles.
Examples []string `` /* 126-byte string literal not displayed */
}
SkillConfig describes an agent skill for A2A discovery.
type SkillFrontmatter ¶ added in v1.12.0
type SkillFrontmatter struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
AllowedTools []string `yaml:"allowed-tools"`
}
SkillFrontmatter represents the YAML frontmatter in SKILL.md.
type StructuredOutputConfig ¶
type StructuredOutputConfig struct {
// Schema is the JSON schema the response must conform to.
// Uses standard JSON Schema format.
//
// Example:
// schema:
// type: object
// properties:
// name: { type: string }
// age: { type: integer }
// required: ["name"]
Schema map[string]interface{} `` /* 126-byte string literal not displayed */
// Strict enables strict schema validation.
// When true, the LLM is constrained to only output valid schema conforming JSON.
// Default: true
Strict *bool `` /* 130-byte string literal not displayed */
// Name is an optional name for the schema (used by some providers).
// Default: "response"
Name string `` /* 132-byte string literal not displayed */
}
StructuredOutputConfig configures JSON schema response format. This enables the LLM to return structured data matching a specific schema.
Ported from legacy pkg/config/types.go for v2 compatibility.
Provider Support:
- OpenAI: Uses text.format.json_schema (strict mode)
- Gemini: Uses ResponseMIMEType + ResponseSchema
- Anthropic: Uses tool_use pattern for structured output
- Ollama: Uses format field with schema
func (*StructuredOutputConfig) IsStrict ¶
func (c *StructuredOutputConfig) IsStrict() bool
IsStrict returns whether strict mode is enabled.
func (*StructuredOutputConfig) SetDefaults ¶
func (c *StructuredOutputConfig) SetDefaults()
SetDefaults applies default values to StructuredOutputConfig.
func (*StructuredOutputConfig) Validate ¶
func (c *StructuredOutputConfig) Validate() error
Validate checks the structured output configuration.
type StudioConfig ¶ added in v0.9.1
type StudioConfig struct {
// Enabled turns on studio mode endpoints (/api/config).
// Default: false
Enabled bool `yaml:"enabled,omitempty"`
// AllowedRoles specifies which JWT roles can access studio endpoints.
// If empty and auth is enabled, defaults to ["operator"].
// If auth is disabled, this field is ignored.
// Example: ["admin", "operator", "platform-engineer"]
AllowedRoles []string `yaml:"allowed_roles,omitempty"`
// ConfigPath is where configuration is saved.
// If empty, uses the originally loaded config file path.
ConfigPath string `yaml:"config_path,omitempty"`
}
StudioConfig configures studio mode for configuration editing.
Studio mode provides a web UI for editing agent configurations and supports role-based access control when authentication is enabled.
Example:
server:
studio:
enabled: true
allowed_roles:
- operator
- admin
config_path: ./config.yaml
func (*StudioConfig) GetAllowedRoles ¶ added in v0.9.1
func (c *StudioConfig) GetAllowedRoles() []string
GetAllowedRoles returns the allowed roles, with "operator" as default.
func (*StudioConfig) IsEnabled ¶ added in v0.9.1
func (c *StudioConfig) IsEnabled() bool
IsEnabled returns whether studio mode is enabled.
func (*StudioConfig) SetDefaults ¶ added in v0.9.1
func (c *StudioConfig) SetDefaults()
SetDefaults applies default values for StudioConfig.
func (*StudioConfig) Validate ¶ added in v0.9.1
func (c *StudioConfig) Validate() error
Validate checks the StudioConfig for errors.
type TLSConfig ¶
type TLSConfig struct {
// Enabled turns on TLS.
Enabled *bool `yaml:"enabled,omitempty"`
// CertFile is the path to the certificate.
CertFile string `yaml:"cert_file,omitempty"`
// KeyFile is the path to the private key.
KeyFile string `yaml:"key_file,omitempty"`
}
TLSConfig configures TLS.
type ThinkingConfig ¶
type ThinkingConfig struct {
// Enabled turns on extended thinking.
Enabled *bool `` /* 126-byte string literal not displayed */
// BudgetTokens is the token budget for thinking.
BudgetTokens int `` /* 155-byte string literal not displayed */
}
ThinkingConfig configures extended thinking (Claude).
type ToolConfig ¶
type ToolConfig struct {
// Type of tool (mcp, function, command).
Type ToolType `` /* 145-byte string literal not displayed */
// Enabled controls whether the tool is active.
Enabled *bool `` /* 128-byte string literal not displayed */
// Description of the tool.
Description string `yaml:"description,omitempty" json:"description,omitempty" jsonschema:"title=Description,description=What this tool does"`
// MCP-specific configuration
// URL is the MCP server URL (for type: mcp).
URL string `yaml:"url,omitempty" json:"url,omitempty" jsonschema:"title=MCP URL,description=MCP server URL (for type=mcp)"`
// Transport specifies the MCP transport (stdio, sse, streamable-http).
Transport string `` /* 154-byte string literal not displayed */
// Command for MCP stdio transport (not to be confused with CommandTool).
Command string `` /* 139-byte string literal not displayed */
// Args for MCP stdio transport.
Args []string `yaml:"args,omitempty" json:"args,omitempty" jsonschema:"title=Args,description=Arguments for MCP stdio transport"`
// Env for MCP stdio transport.
Env map[string]string `` /* 140-byte string literal not displayed */
// Filter limits which tools are exposed from an MCP server.
Filter []string `` /* 131-byte string literal not displayed */
// Function-specific configuration
// Handler is the function name (for type: function).
Handler string `yaml:"handler,omitempty" json:"handler,omitempty" jsonschema:"title=Handler,description=Function name (for type=function)"`
// Parameters schema (for type: function).
Parameters map[string]any `` /* 135-byte string literal not displayed */
// Command tool configuration (for type: command)
// AllowedCommands is a whitelist of allowed base commands.
AllowedCommands []string `` /* 150-byte string literal not displayed */
// DeniedCommands is a blacklist of denied base commands.
DeniedCommands []string `` /* 146-byte string literal not displayed */
// WorkingDirectory for command execution.
WorkingDirectory string `` /* 158-byte string literal not displayed */
// MaxExecutionTime limits command execution duration.
MaxExecutionTime string `` /* 156-byte string literal not displayed */
// DenyByDefault requires explicit allowed_commands whitelist.
DenyByDefault *bool `` /* 170-byte string literal not displayed */
// HITL (Human-in-the-Loop) settings
// RequireApproval requires user approval before execution.
RequireApproval *bool `` /* 179-byte string literal not displayed */
// ApprovalPrompt is the message shown when requesting approval.
ApprovalPrompt string `` /* 151-byte string literal not displayed */
}
ToolConfig configures a tool.
func (*ToolConfig) IsEnabled ¶
func (c *ToolConfig) IsEnabled() bool
IsEnabled returns whether the tool is enabled.
func (*ToolConfig) NeedsApproval ¶
func (c *ToolConfig) NeedsApproval() bool
NeedsApproval returns whether the tool requires approval.
func (*ToolConfig) SetDefaults ¶
func (c *ToolConfig) SetDefaults()
SetDefaults applies default values.
func (*ToolConfig) Validate ¶
func (c *ToolConfig) Validate() error
Validate checks the tool configuration.
type ToolGuardrailsConfig ¶
type ToolGuardrailsConfig struct {
// ChainMode for tool guardrails: "fail_fast" or "collect_all".
ChainMode string `` /* 135-byte string literal not displayed */
// Authorization settings.
Authorization *AuthorizationGuardrailConfig `` /* 145-byte string literal not displayed */
}
ToolGuardrailsConfig contains tool guardrail settings.
type TransportType ¶
type TransportType string
TransportType identifies the server transport.
const ( TransportJSONRPC TransportType = "json-rpc" TransportGRPC TransportType = "grpc" )
type TriggerConfig ¶ added in v1.13.0
type TriggerConfig struct {
// Type of trigger (schedule, webhook).
// Default: schedule
Type TriggerType `` /* 147-byte string literal not displayed */
// Enabled controls whether the trigger is active.
Enabled *bool `` /* 131-byte string literal not displayed */
// Cron expression for schedule triggers.
// Uses standard cron format: minute hour day-of-month month day-of-week
// Example: "0 9 * * *" for daily at 9am
Cron string `` /* 140-byte string literal not displayed */
// Timezone for schedule interpretation.
// Default: UTC
Timezone string `` /* 130-byte string literal not displayed */
// Input is the static input to pass to the agent when triggered.
// For schedule triggers, this is the fixed input.
// For webhook triggers, this is only used if no WebhookInput template is configured.
Input string `yaml:"input,omitempty" json:"input,omitempty" jsonschema:"title=Input,description=Static input for triggered runs"`
// Path is the URL path for the webhook endpoint.
// Default: /webhooks/{agent-name}
Path string `yaml:"path,omitempty" json:"path,omitempty" jsonschema:"title=Webhook Path,description=URL path for webhook endpoint"`
// Methods are the allowed HTTP methods for the webhook.
// Default: ["POST"]
Methods []string `` /* 129-byte string literal not displayed */
// Secret is the HMAC secret for signature verification.
// If set, requests must include a valid signature.
Secret string `` /* 132-byte string literal not displayed */
// SignatureHeader is the HTTP header containing the request signature.
// Common values: X-Hub-Signature-256 (GitHub), X-Shopify-Hmac-Sha256 (Shopify)
// Default: X-Webhook-Signature
SignatureHeader string `` /* 181-byte string literal not displayed */
// WebhookInput configures how webhook payloads are transformed to agent input.
WebhookInput *WebhookInputConfig `` /* 143-byte string literal not displayed */
// Response configures webhook response behavior.
Response *WebhookResponseConfig `` /* 129-byte string literal not displayed */
}
TriggerConfig configures automatic agent invocation.
func (*TriggerConfig) IsEnabled ¶ added in v1.13.0
func (c *TriggerConfig) IsEnabled() bool
IsEnabled returns whether the trigger is enabled.
func (*TriggerConfig) SetDefaults ¶ added in v1.13.0
func (c *TriggerConfig) SetDefaults()
SetDefaults applies default values.
func (*TriggerConfig) Validate ¶ added in v1.13.0
func (c *TriggerConfig) Validate() error
Validate checks the trigger configuration.
type TriggerType ¶ added in v1.13.0
type TriggerType string
TriggerType identifies the trigger type.
const ( // TriggerTypeSchedule triggers on a cron schedule. TriggerTypeSchedule TriggerType = "schedule" // TriggerTypeWebhook triggers on incoming HTTP webhook requests. TriggerTypeWebhook TriggerType = "webhook" )
type VectorStoreConfig ¶
type VectorStoreConfig struct {
// Type is the vector store type: "chromem", "qdrant", "pinecone", "weaviate", "milvus".
Type string `yaml:"type"`
// Host for external vector stores (qdrant, weaviate, milvus).
Host string `yaml:"host,omitempty"`
// Port for external vector stores.
Port int `yaml:"port,omitempty"`
// APIKey for authenticated access.
APIKey string `yaml:"api_key,omitempty"`
// EnableTLS enables TLS connections.
EnableTLS *bool `yaml:"enable_tls,omitempty"`
// PersistPath for chromem file persistence.
PersistPath string `yaml:"persist_path,omitempty"`
// Compress enables gzip compression for chromem persistence.
Compress bool `yaml:"compress,omitempty"`
// Collection is the default collection name (optional).
Collection string `yaml:"collection,omitempty"`
// IndexName for Pinecone.
IndexName string `yaml:"index_name,omitempty"`
// Environment for Pinecone.
Environment string `yaml:"environment,omitempty"`
}
VectorStoreConfig configures a vector database provider.
Example YAML:
vector_stores:
local:
type: chromem
persist_path: .hector/vectors
production:
type: qdrant
host: qdrant.example.com
port: 6333
api_key: ${QDRANT_API_KEY}
func (*VectorStoreConfig) IsEmbedded ¶
func (c *VectorStoreConfig) IsEmbedded() bool
IsEmbedded returns true for embedded vector stores (chromem).
func (*VectorStoreConfig) SetDefaults ¶
func (c *VectorStoreConfig) SetDefaults()
SetDefaults applies default values.
func (*VectorStoreConfig) Validate ¶
func (c *VectorStoreConfig) Validate() error
Validate checks the configuration for errors.
type WebhookFieldExtractor ¶ added in v1.15.0
type WebhookFieldExtractor struct {
// Path is the JSONPath-like path to the field (e.g., ".body.order.id")
Path string `yaml:"path" json:"path" jsonschema:"title=Field Path,description=Path to field in payload"`
// As is the name to use for this field in the template context.
As string `yaml:"as" json:"as" jsonschema:"title=Field Alias,description=Name to use in template"`
}
WebhookFieldExtractor defines a field to extract from webhook payload.
type WebhookInputConfig ¶ added in v1.15.0
type WebhookInputConfig struct {
// Template is a Go text/template for transforming the webhook payload.
// Available data: .body (parsed JSON), .headers (HTTP headers), .query (URL query params)
// Example: "Process order {{.body.order_id}} from {{.headers.X-Shop-Domain}}"
Template string `` /* 157-byte string literal not displayed */
// ExtractFields extracts specific fields from the payload as template variables.
ExtractFields []WebhookFieldExtractor `` /* 140-byte string literal not displayed */
}
WebhookInputConfig configures how webhook payloads are transformed to agent input.
type WebhookResponseConfig ¶ added in v1.15.0
type WebhookResponseConfig struct {
// Mode determines how the webhook responds (sync, async, callback).
// Default: sync
Mode WebhookResponseMode `` /* 171-byte string literal not displayed */
// Timeout is the maximum time to wait for agent completion in sync mode.
// Default: 30s
Timeout time.Duration `` /* 128-byte string literal not displayed */
// CallbackURL is the URL where results are POSTed when mode is "callback".
// Required when using callback mode.
CallbackURL string `` /* 143-byte string literal not displayed */
}
WebhookResponseConfig configures webhook response behavior.
type WebhookResponseMode ¶ added in v1.15.0
type WebhookResponseMode string
WebhookResponseMode defines how webhook triggers respond to requests.
const ( // WebhookResponseSync waits for agent completion before responding. WebhookResponseSync WebhookResponseMode = "sync" // WebhookResponseAsync returns task ID immediately for polling. WebhookResponseAsync WebhookResponseMode = "async" // WebhookResponseCallback returns immediately and POSTs result to callback URL. WebhookResponseCallback WebhookResponseMode = "callback" )