qwen_agent/agent
autobee-sparticle 213e541697
fix: resolve PrePrompt Hook env var crash and increase Mem0 pool size (#24)
1. Fix "all environment values must be bytes or str" error in hook execution
   by ensuring all env values are converted to str (getattr may return None
   when attribute exists but is None). Also sanitize shell_env values.

2. Increase MEM0_POOL_SIZE default from 20 to 50 to address "connection pool
   exhausted" errors under high concurrency.

Fixes: sparticleinc/felo-mygpt#2519

Co-authored-by: zhuchao <zhuchaowe@163.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 22:04:31 +09:00
..
__init__.py 新增agent文件夹,修改import引用,增加custom_mcp_manager 2025-11-26 17:23:02 +08:00
agent_config.py 增加取消推理 2026-03-16 22:22:39 +08:00
agent_memory_cache.py 修改balance资源配置 2025-12-23 23:11:24 +08:00
chat_history_manager.py db_pool 2026-01-19 23:39:04 +08:00
checkpoint_manager.py db_pool 2026-01-19 23:39:04 +08:00
checkpoint_utils.py refactor: migrate from Memori to Mem0 for long-term memory 2026-01-20 21:15:30 +08:00
config_cache.py 修改general_agent提示词 2025-12-03 17:53:18 +08:00
custom_filesystem_middleware.py skill.md文件长度限制解除 2026-03-02 12:55:39 +08:00
db_pool_manager.py refactor(mem0): optimize connection pool and async memory handling 2026-01-22 19:39:12 +08:00
deep_assistant.py shell_env支持 2026-03-16 13:31:59 +08:00
guideline_middleware.py rename general agent 2026-02-06 17:05:17 +08:00
logging_handler.py on_tool_start 长度调整 2026-02-15 18:12:22 +08:00
mem0_config.py feat: 添加 PreMemoryPrompt hook 支持自定义记忆提取提示词 2026-03-30 20:36:35 +08:00
mem0_manager.py feat: 添加 PreMemoryPrompt hook 支持自定义记忆提取提示词 2026-03-30 20:36:35 +08:00
mem0_middleware.py bug fix 2026-03-04 14:30:44 +08:00
plugin_hook_loader.py fix: resolve PrePrompt Hook env var crash and increase Mem0 pool size (#24) 2026-04-01 22:04:31 +09:00
prompt_loader.py shell_env support 2026-03-24 00:12:19 +08:00
summarization_middleware.py update summary 2026-02-04 15:31:41 +08:00
tool_output_length_middleware.py 修改确保 max_length 永远不会是 None 2026-03-04 14:08:26 +08:00
tool_use_cleanup_middleware.py 修复完成。主要改动: 1. 新增 _clean_content_blocks 方法:专门处理 content 字段的清理 - 当 content 是列表格式时,过滤掉 type: 'tool_use' 的块(如果 id 不在 valid_tool_call_ids 中) - 返回清理后的 content 和是否有文本内容的标志 2. 更新 _cleanup_tool_use_messages 方法: - 调用 _clean_content_blocks 来清理 content - 使用清理后的 cleaned_content 创建新的 AIMessage 问题根源:之前的代码只清空了 tool_calls=[],但没有从 content 列表中移除 type: 'tool_use' 的块。Anthropic API 会检查这两个地方,导致报错。 2025-12-23 19:11:27 +08:00