@@ -29,6 +29,14 @@ type Config struct {
2929 WebSearch * WebSearchConfig `yaml:"web_search" json:"web_search"`
3030 PromptTemplates * PromptTemplatesConfig `yaml:"prompt_templates" json:"prompt_templates"`
3131 IM * IMConfig `yaml:"im" json:"im"`
32+ Agent * AgentConfig `yaml:"agent" json:"agent"`
33+ }
34+
35+ // AgentConfig represents the global agent settings.
36+ type AgentConfig struct {
37+ // LLMCallTimeout is the default timeout for a single LLM call in seconds.
38+ // Default: 120 (standard agents) or 300 (can be overridden by Env).
39+ LLMCallTimeout int `yaml:"llm_call_timeout" json:"llm_call_timeout"`
3240}
3341
3442// IMConfig configures the IM integration service.
@@ -408,6 +416,7 @@ func LoadConfig() (*Config, error) {
408416
409417 // Validate configuration values
410418 applyOIDCEnvOverrides (& cfg )
419+ applyAgentEnvOverrides (& cfg )
411420
412421 if err := ValidateConfig (& cfg ); err != nil {
413422 return nil , err
@@ -535,6 +544,20 @@ func applyOIDCEnvOverrides(cfg *Config) {
535544 }
536545}
537546
547+ func applyAgentEnvOverrides (cfg * Config ) {
548+ if cfg .Agent == nil {
549+ cfg .Agent = & AgentConfig {}
550+ }
551+ if value := strings .TrimSpace (os .Getenv ("WEKNORA_AGENT_LLM_TIMEOUT" )); value != "" {
552+ if timeout , err := time .ParseDuration (value ); err == nil {
553+ cfg .Agent .LLMCallTimeout = int (timeout .Seconds ())
554+ } else if sec , err := time .ParseDuration (value + "s" ); err == nil {
555+ // Handle case where user just provides a number like "300"
556+ cfg .Agent .LLMCallTimeout = int (sec .Seconds ())
557+ }
558+ }
559+ }
560+
538561// backfillConversationDefaults resolves prompt template ID references
539562// into actual prompt text content. Only xxx_id fields are used;
540563// no fallback to default templates.
0 commit comments