feat(agent): support customizable LLM call timeout#916
Merged
lyingbug merged 1 commit intoApr 7, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
描述 (Description)
针对 issue #870 中提到的智能体长推理超时问题以及个人遇到的同样问题,引入了对智能体(Agent) LLM 调用超时的多级自定义支持。
主要变更内容:
WEKNORA_AGENT_LLM_TIMEOUT,允许通过.env文件快速调整所有 Agent 的默认超时时间(默认 120s)。docker-compose.yml环境部分,确保环境变量能正确传递到应用容器。CustomAgentConfig结构中增加了llm_call_timeout字段,支持在数据库层面为特定“重推理”智能体设置更长的时长限制(例如 600s)。智能体特定配置 > 环境变量全局默认值 > 系统硬编码默认值的优先级分层,兼顾了灵活性和易用性。.env.example,增加了相关配置项的说明及优先级注释。解决的问题:
解决了在调用复杂的推理模型(如 GLM5 部署的模型)进行长思考任务时,由于系统硬编码的 120s 超时时间导致的
context deadline exceeded报错以及中途连接断开的问题。变更类型 (Type of Change)
影响范围 (Scope)
测试 (Testing)
测试步骤 (Test Steps)
1.在 .env 中设置 WEKNORA_AGENT_LLM_TIMEOUT=2。
2.调用具有长任务的 Agent,观察是否能在 2 秒后触发预期超时。
检查清单 (Checklist)
相关 Issue
Fixes #870
数据库迁移 (Database Migration)
配置变更 (Configuration Changes)
需在
.env中添加或修改WEKNORA_AGENT_LLM_TIMEOUT。部署说明 (Deployment Notes)
由于修改了
docker-compose.yml环境变量映射,部署时需重启容器以加载新映射配置。