config

package
v1.41.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolPtr

func BoolPtr(b bool) *bool

BoolPtr returns a pointer to the given bool value.

func BoolValue

func BoolValue(b *bool, defaultValue bool) bool

BoolValue returns the value of the bool pointer, or the default if nil.

func DefaultDSN added in v1.17.1

func DefaultDSN() string

DefaultDSN returns the default database connection string.

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 IntPtr

func IntPtr(i int) *int

IntPtr returns a pointer to the given int value.

func IntValue added in v1.14.0

func IntValue(i *int, defaultValue int) int

IntValue returns the value of the int pointer, or the default if nil.

func LoadDotEnv

func LoadDotEnv(paths ...string) error

LoadDotEnv loads environment variables from .env files.

Search order (first found wins):

  1. Explicit path if provided
  2. .env in current directory
  3. .env in config file's directory (if config path provided)
  4. .env in home directory (~/.env)

This function is idempotent and safe to call multiple times. Existing environment variables are NOT overwritten.

func LoadDotEnvForConfig

func LoadDotEnvForConfig(configPath string) error

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 ReadLeanConfigJSON added in v1.40.3

func ReadLeanConfigJSON(path string) ([]byte, error)

ReadLeanConfigJSON reads a YAML config file and returns lean JSON without applying defaults. This preserves only the fields explicitly set by the user, suitable for DB storage where the full defaults-applied config would be bloated.

func ReloadDotEnv added in v1.12.0

func ReloadDotEnv(paths ...string) (map[string]string, error)

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

func ReloadDotEnvForConfig(configPath string) (map[string]string, error)

ReloadDotEnvForConfig reloads .env from the config file's directory. Returns the map of loaded environment variables.

func ValidateAppConfig added in v1.21.0

func ValidateAppConfig(cfg *AppConfig) error

ValidateAppConfig validates the app configuration comprehensively. This is the SINGLE SOURCE OF TRUTH for all config validation. It validates both individual config types AND cross-references.

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
	//   - "conditional": Routes based on condition agent result
	Type string `` /* 201-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 */

	// ConditionAgent references the agent that evaluates the condition.
	// The condition agent's output should contain a JSON object with the ConditionField.
	// Only used when Type="conditional".
	ConditionAgent string `` /* 155-byte string literal not displayed */

	// ConditionField is the JSON field to check in condition agent's output.
	// If the field is truthy, OnTrueAgent runs; otherwise OnFalseResponse is returned.
	// Default: "safe"
	// Only used when Type="conditional".
	ConditionField string `` /* 171-byte string literal not displayed */

	// OnTrueAgent references the agent to run when condition is true.
	// Only used when Type="conditional".
	OnTrueAgent string `` /* 142-byte string literal not displayed */

	// OnFalseResponse is the static response when condition is false.
	// Only used when Type="conditional".
	OnFalseResponse string `` /* 197-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 AppConfig added in v1.21.0

type AppConfig struct {
	// Metadata
	Version string `yaml:"version,omitempty" json:"version,omitempty"`

	// Resources (all app-scoped)
	LLMs           map[string]*LLMConfig           `yaml:"llms,omitempty" json:"llms,omitempty"`
	Tools          map[string]*ToolConfig          `yaml:"tools,omitempty" json:"tools,omitempty"`
	Agents         map[string]*AgentConfig         `yaml:"agents,omitempty" json:"agents,omitempty"`
	Guardrails     map[string]*GuardrailsConfig    `yaml:"guardrails,omitempty" json:"guardrails,omitempty"`
	VectorStores   map[string]*VectorStoreConfig   `yaml:"vector_stores,omitempty" json:"vector_stores,omitempty"`
	Embedders      map[string]*EmbedderConfig      `yaml:"embedders,omitempty" json:"embedders,omitempty"`
	DocumentStores map[string]*DocumentStoreConfig `yaml:"document_stores,omitempty" json:"document_stores,omitempty"`

	// Defaults
	Defaults *DefaultsConfig `yaml:"defaults,omitempty" json:"defaults,omitempty"`
}

AppConfig is the application-level configuration. This contains ONLY functional business logic (agents, tools, LLMs). Operational settings (database, port, logging) are passed via CLI/env.

Example config.yaml:

version: "2"
name: my-app
description: My AI application

llms:
  default:
    provider: anthropic
    model: claude-sonnet-4
    api_key: ${ANTHROPIC_API_KEY}

agents:
  assistant:
    llm: default
    instruction: You are a helpful assistant.

func LoadAppConfig added in v1.21.0

func LoadAppConfig(path string) (*AppConfig, error)

LoadAppConfig loads an app configuration from a YAML file.

func ParseAppConfigJSON added in v1.21.0

func ParseAppConfigJSON(data []byte) (*AppConfig, error)

ParseAppConfigJSON parses an app configuration from JSON bytes.

func (*AppConfig) GetAgent added in v1.21.0

func (c *AppConfig) GetAgent(name string) (*AgentConfig, bool)

GetAgent retrieves an agent by name.

func (*AppConfig) ListAgents added in v1.21.0

func (c *AppConfig) ListAgents() []string

ListAgents returns a sorted list of agent names.

func (*AppConfig) SetDefaults added in v1.21.0

func (c *AppConfig) SetDefaults()

SetDefaults applies default values to the config.

type AppConfigLoadResult added in v1.41.0

type AppConfigLoadResult struct {
	Config   *AppConfig // Full config with defaults applied and validated
	LeanJSON []byte     // JSON of user-specified fields only, for DB storage
}

AppConfigLoadResult holds both the full (defaults-applied) config and the lean JSON (user-specified fields only) from a single file read.

func LoadAppConfigWithLean added in v1.41.0

func LoadAppConfigWithLean(path string) (*AppConfigLoadResult, error)

LoadAppConfigWithLean reads a YAML config file once and returns both the validated config (with defaults) and the lean JSON (without defaults).

type AuthConfig

type AuthConfig struct {
	// Secret token for admin API authentication
	Secret string

	// JWT authentication (optional)
	JWKSURL         string // JWKS URL for JWT validation
	Issuer          string // Expected JWT issuer
	Audience        string // Expected JWT audience
	ClientID        string // Public client ID for frontend
	RefreshInterval int    // JWKS refresh interval in seconds

	// SigningSeed is a deterministic seed for generating the signing key (Ed25519 or RSA).
	// If provided, the server will generate the same key on every restart.
	SigningSeed string

	// Runtime state
	Enabled bool // Computed: true if Secret or JWKS is configured
}

AuthConfig configures authentication for the server.

func (*AuthConfig) IsEnabled

func (a *AuthConfig) IsEnabled() bool

IsEnabled returns true if authentication is configured.

func (*AuthConfig) SetDefaults

func (a *AuthConfig) SetDefaults()

SetDefaults applies default values to auth config.

func (*AuthConfig) Validate

func (a *AuthConfig) Validate() error

Validate validates the auth configuration.

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 BlobSourceConfig added in v1.21.0

type BlobSourceConfig struct {
	// URL is the blob storage URL.
	// Examples:
	//   s3://my-bucket/docs?region=us-east-1
	//   gs://my-bucket/docs
	//   azblob://my-container/docs
	URL string `yaml:"url"`

	// Prefix filters to blobs with this prefix (optional).
	// For nested paths within a bucket.
	Prefix string `yaml:"prefix,omitempty"`
}

BlobSourceConfig configures a blob storage source.

Blob sources provide unified access to local and cloud storage: - file:///path/to/dir - Local filesystem - s3://bucket/prefix?region=us-east-1 - AWS S3 - gs://bucket/prefix - Google Cloud Storage - azblob://container/prefix - Azure Blob Storage

Example YAML:

blob:
  url: s3://my-bucket/documents?region=us-east-1
  prefix: company-docs/

Environment variables for credentials:

  • AWS: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION
  • GCS: GOOGLE_APPLICATION_CREDENTIALS
  • Azure: AZURE_STORAGE_ACCOUNT, AZURE_STORAGE_KEY

func (*BlobSourceConfig) Validate added in v1.21.0

func (c *BlobSourceConfig) Validate() error

Validate checks the configuration for errors.

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

	// RAG options
	DocsFolder       string
	RAGWatch         *bool
	MCPParserTool    string
	VectorType       string
	VectorHost       string
	VectorAPIKey     string
	EmbedderProvider string
	EmbedderModel    string
	EmbedderURL      string
	IncludeContext   *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 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 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 configures message retention.
	// - For "buffer_window": Exact number of recent messages to keep.
	// - For "summary_buffer": Minimum number of recent messages to guarantee (soft floor).
	//   Note: If Budget is too small to fit this many messages, WindowSize is dynamically reduced.
	// Default: 20
	WindowSize int `` /* 209-byte string literal not displayed */

	// Budget is the token budget for token_window and summary_buffer strategies.
	// For "summary_buffer", this is the primary constraint.
	// If the Budget cannot fit 'WindowSize' messages, WindowSize is automatically lowered to prevent loops.
	// Default: 8000
	Budget int `` /* 186-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. MemoryConfig configures agent memory behavior.

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 of credential: "bearer", "api_key", or "basic"
	Type string `yaml:"type,omitempty" json:"type,omitempty"`

	// Token for bearer authentication
	Token string `yaml:"token,omitempty" json:"token,omitempty"`

	// APIKey for API key authentication
	APIKey string `yaml:"api_key,omitempty" json:"api_key,omitempty"`

	// APIKeyHeader is the header name for API key (default: X-API-Key)
	APIKeyHeader string `yaml:"api_key_header,omitempty" json:"api_key_header,omitempty"`

	// Username for basic authentication
	Username string `yaml:"username,omitempty" json:"username,omitempty"`

	// Password for basic authentication
	Password string `yaml:"password,omitempty" json:"password,omitempty"`
}

CredentialsConfig holds authentication credentials for HTTP requests. Used for API tools, webhook endpoints, and external service integrations.

func (*CredentialsConfig) SetDefaults

func (c *CredentialsConfig) SetDefaults()

SetDefaults applies default values.

func (*CredentialsConfig) Validate

func (c *CredentialsConfig) Validate() error

Validate checks the credentials configuration.

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.

func NewDBPool

func NewDBPool() *DBPool

NewDBPool creates a new database pool manager.

func (*DBPool) Close

func (p *DBPool) Close() error

Close closes all database connections.

func (*DBPool) Get

func (p *DBPool) Get(cfg *DatabaseConfig) (*sql.DB, error)

Get returns a database connection for the given config. For the same DSN, it returns the same connection pool.

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
	// Params holds additional connection parameters
	Params map[string]string `yaml:"-" json:"-"`
}

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 string `yaml:"llm,omitempty" json:"llm,omitempty"`
}

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: "blob", "sql", "api", "collection".
	Type string `yaml:"type"`

	// Include patterns for files (for blob sources).
	Include []string `yaml:"include,omitempty"`

	// Exclude patterns for files (for blob sources).
	Exclude []string `yaml:"exclude,omitempty"`

	// MaxFileSize limits file size in bytes (for blob 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"`

	// Blob configuration (for blob sources - local, S3, GCS, Azure).
	Blob *BlobSourceConfig `yaml:"blob,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: blob
      blob:
        url: "file://./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

type Duration time.Duration

Duration is a time.Duration that supports YAML parsing.

Supports formats like: "1s", "5m", "2h", "100ms", "1h30m"

func (Duration) Duration

func (d Duration) Duration() time.Duration

Duration returns the time.Duration value.

func (Duration) MarshalYAML

func (d Duration) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler for Duration.

func (Duration) String

func (d Duration) String() string

String returns the string representation.

func (*Duration) UnmarshalYAML

func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error

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
	AppConfig  *AppConfig // Structured config for internal use
	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. Uses GenerateLeanConfig for smart env detection (provider, SKILL.md, etc.) so the file is immediately useful for new users.

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"`

	// Moderation configures LLM-powered content moderation.
	// Adds semantic understanding beyond regex-based guardrails.
	Moderation *ModerationGuardrailConfig `` /* 141-byte string literal not displayed */
}

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.

func (*LLMConfig) Validate

func (c *LLMConfig) Validate() error

Validate checks the LLM configuration.

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 LakeraModerationConfig added in v1.21.0

type LakeraModerationConfig struct {
	// ProjectID is the Lakera project ID for policy configuration.
	// If empty, uses the default Lakera Guard policy.
	ProjectID string `` /* 140-byte string literal not displayed */

	// Breakdown enables detailed detector breakdown in response.
	Breakdown bool `` /* 129-byte string literal not displayed */

	// Endpoint is the API endpoint URL (optional).
	// Default: https://api.lakera.ai/v2/guard
	Endpoint string `yaml:"endpoint,omitempty" json:"endpoint,omitempty" jsonschema:"title=Endpoint,description=Custom API endpoint URL"`
}

LakeraModerationConfig configures Lakera Guard v2 API.

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 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 ModerationGuardrailConfig added in v1.21.0

type ModerationGuardrailConfig struct {
	// Enabled controls whether moderation is active.
	Enabled bool `yaml:"enabled" json:"enabled" jsonschema:"title=Enabled,default=false"`

	// Strategy determines which moderation approach to use.
	// Values:
	//   - "none": Disabled
	//   - "openai": OpenAI Moderation API (free)
	//   - "lakera": Lakera Guard API
	//   - "prompt": Custom prompt with any LLM
	Strategy string `` /* 172-byte string literal not displayed */

	// OpenAI configures the OpenAI Moderation provider.
	OpenAI *OpenAIModerationConfig `yaml:"openai,omitempty" json:"openai,omitempty" jsonschema:"title=OpenAI Config,description=OpenAI Moderation API settings"`

	// Lakera configures the Lakera Guard provider.
	Lakera *LakeraModerationConfig `yaml:"lakera,omitempty" json:"lakera,omitempty" jsonschema:"title=Lakera Config,description=Lakera Guard API settings"`

	// Prompt configures the prompt-based moderation provider.
	Prompt *PromptModerationConfig `yaml:"prompt,omitempty" json:"prompt,omitempty" jsonschema:"title=Prompt Config,description=Custom LLM prompt settings"`

	// Action when content is flagged.
	Action string `yaml:"action,omitempty" json:"action,omitempty" jsonschema:"title=Action,enum=block,enum=warn,default=block"`
}

ModerationGuardrailConfig configures LLM-powered content moderation. This provides semantic understanding beyond regex-based guardrails.

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 OpenAIModerationConfig added in v1.21.0

type OpenAIModerationConfig struct {
	// Model is the moderation model to use.
	// Default: "omni-moderation-latest"
	Model string `` /* 181-byte string literal not displayed */

	// Threshold is the score above which content is flagged (0-1).
	// Default: 0.8
	Threshold float64 `` /* 155-byte string literal not displayed */
}

OpenAIModerationConfig configures OpenAI's Moderation API.

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 PromptModerationConfig added in v1.21.0

type PromptModerationConfig struct {
	// LLM references a configured LLM by name.
	// If empty, uses the agent's LLM.
	LLM string `yaml:"llm,omitempty" json:"llm,omitempty" jsonschema:"title=LLM,description=LLM to use for moderation"`

	// Template is the moderation prompt template.
	// Use {input} as placeholder for the content to check.
	Template string `yaml:"template,omitempty" json:"template,omitempty" jsonschema:"title=Template,description=Custom moderation prompt template"`

	// SafeField is the JSON field to check in the response.
	// Default: "safe"
	SafeField string `yaml:"safe_field,omitempty" json:"safe_field,omitempty" jsonschema:"title=Safe Field,default=safe"`
}

PromptModerationConfig configures prompt-based moderation.

type QueueConfig added in v1.21.0

type QueueConfig struct {
	// Workers is the number of concurrent worker goroutines.
	// Default: 4
	Workers int `yaml:"workers" json:"workers"`

	// MaxRetries is the maximum number of retry attempts for failed tasks.
	// Default: 3
	MaxRetries int `yaml:"max_retries" json:"max_retries"`

	// InitialDelay is the delay before the first retry.
	// Default: 1s
	InitialDelay time.Duration `yaml:"initial_delay" json:"initial_delay"`

	// MaxDelay is the maximum delay between retries.
	// Default: 5m
	MaxDelay time.Duration `yaml:"max_delay" json:"max_delay"`

	// BackoffFactor is the multiplier for exponential backoff.
	// Default: 2.0
	BackoffFactor float64 `yaml:"backoff_factor" json:"backoff_factor"`

	// StaleThreshold is how old a "processing" item must be to be considered stale.
	// Default: 5m
	StaleThreshold time.Duration `yaml:"stale_threshold" json:"stale_threshold"`
}

QueueConfig configures the task queue for durable execution.

func (*QueueConfig) SetDefaults added in v1.21.0

func (q *QueueConfig) SetDefaults()

SetDefaults applies default values to queue config.

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"`

	// IPHeaders defines the HTTP headers to check for client IP addresses (in order of priority).
	// Used when rate limiting falls back to IP-based identification.
	// Defaults to ["X-Forwarded-For", "X-Real-IP"] if not specified.
	// Common values:
	//   - "X-Forwarded-For" - Standard proxy header (comma-separated list, leftmost = original client)
	//   - "X-Real-IP" - Single IP from proxy (nginx, etc.)
	//   - "CF-Connecting-IP" - Cloudflare's client IP header
	//   - Custom headers for your specific proxy/load balancer
	IPHeaders []string `yaml:"ip_headers,omitempty" json:"ip_headers,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) 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 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 {
	// Database
	Database       string          // Raw DSN (e.g., "postgres://...", "sqlite://...")
	DatabaseConfig *DatabaseConfig // Parsed database configuration

	// Network
	Host string // Host to bind to (e.g., "0.0.0.0", "127.0.0.1")
	Port int    // Port to listen on (e.g., 8080)

	// Logging
	LogLevel  string // Log level: debug, info, warn, error
	LogFormat string // Log format: json, text
	LogFile   string // Log file path (empty = stderr)

	// Authentication
	Auth *AuthConfig // Authentication configuration

	// Queue configuration for durable task execution
	Queue *QueueConfig

	// Observability
	MetricsEnabled  bool   // Enable Prometheus metrics endpoint
	TracingEndpoint string // OTLP tracing endpoint (e.g., "localhost:4317")

	// Rate Limiting (operational/infrastructure)
	RateLimit *RateLimitConfig `yaml:"rate_limit,omitempty" json:"rate_limit,omitempty"`
}

ServerConfig holds server-level operational settings. These are passed via CLI flags and environment variables ONLY. They control HOW the server runs, not WHAT it does.

func (*ServerConfig) Address

func (c *ServerConfig) Address() string

Address returns the server address as host:port.

func (*ServerConfig) GetDatabaseConfig added in v1.21.0

func (c *ServerConfig) GetDatabaseConfig() (*DatabaseConfig, error)

GetDatabaseConfig returns the parsed database configuration.

func (*ServerConfig) SetDefaults

func (c *ServerConfig) SetDefaults()

SetDefaults applies default values to server config.

func (*ServerConfig) Validate

func (c *ServerConfig) Validate() error

Validate validates 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.

SkillConfig configures agent skill cards for A2A discovery.

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 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 ToolType

type ToolType string

ToolType identifies the tool type.

const (
	// ToolTypeMCP is an MCP (Model Context Protocol) tool.
	ToolTypeMCP ToolType = "mcp"

	// ToolTypeFunction is a built-in function tool.
	ToolTypeFunction ToolType = "function"

	// ToolTypeCommand is a built-in command execution tool.
	ToolTypeCommand ToolType = "command"
)

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"`
	// EnablePersistence enables file persistence for the vector store.
	// Default: true for chromem (saved to .hector/vectors)
	EnablePersistence *bool `yaml:"enable_persistence,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 */

	// SessionID is an optional Go template for deriving a session/context ID from the payload.
	// If set, multiple webhooks with the same derived ID will continue the same conversation.
	// Example: "pr-{{.Body.repository.full_name}}-{{.Body.number}}"
	SessionID string `` /* 180-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"
)

Jump to

Keyboard shortcuts

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