Commit Graph

43 Commits

Author SHA1 Message Date
朱潮
e67d50b4fc rename general agent 2026-02-06 17:05:17 +08:00
朱潮
525801d7f5 update summary 2026-02-04 15:31:41 +08:00
朱潮
f1107ea35a 增加enable_thinking和enable_memory 2026-01-28 17:13:41 +08:00
朱潮
5134c0d8a6 添加环境变量 2026-01-25 21:46:02 +08:00
朱潮
f694101747 refactor: migrate from Memori to Mem0 for long-term memory
Replace Memori with Mem0 for memory management:
- Delete memori_config.py, memori_manager.py, memori_middleware.py
- Add mem0_config.py, mem0_manager.py, mem0_middleware.py
- Update environment variables (MEMORI_* -> MEM0_*)
- Integrate Mem0 with LangGraph middleware
- Add sync connection pool for Mem0 in DBPoolManager
- Move checkpoint message prep to config creation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 21:15:30 +08:00
朱潮
456bcf50e6 refactor: move Memori initialization to fastapi_app.py
Move init_global_memori from deep_assistant.py to fastapi_app.py
lifespan function for proper application-level initialization.

This ensures Memori is initialized once at startup and closed at
shutdown, rather than checking and potentially initializing on every
agent creation.

Changes:
- fastapi_app.py: Add Memori init/close in lifespan
- deep_assistant.py: Simplify to only get memori_manager

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-20 00:15:21 +08:00
朱潮
455a48409d feat: integrate Memori long-term memory system
Add Memori (https://github.com/MemoriLabs/Memori) integration for
persistent cross-session memory capabilities in both create_agent
and create_deep_agent.

## New Files

- agent/memori_config.py: MemoriConfig dataclass for configuration
- agent/memori_manager.py: MemoriManager for connection and instance management
- agent/memori_middleware.py: MemoriMiddleware for memory recall/storage
- tests/: Unit tests for Memori components

## Modified Files

- agent/agent_config.py: Added enable_memori, memori_semantic_search_top_k, etc.
- agent/deep_assistant.py: Integrated MemoriMiddleware into init_agent()
- utils/settings.py: Added MEMORI_* environment variables
- pyproject.toml: Added memori>=3.1.0 dependency

## Features

- Semantic memory search with configurable top-k and threshold
- Multi-tenant isolation (entity_id=user, process_id=bot, session_id)
- Memory injection into system prompt
- Background asynchronous memory augmentation
- Graceful degradation when Memori is unavailable

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-20 00:12:43 +08:00
朱潮
af63c54778 db_pool 2026-01-19 23:39:04 +08:00
朱潮
174a5e2059 deep_agent支持 checkpoint 2026-01-11 00:08:19 +08:00
朱潮
b3303ef8e6 refactor(sse): simplify error handling and remove __debug__ security issue
- Remove __debug__ conditional that exposed tracebacks in production
- Simplify error response structure to {"error": str(e)}
- Remove redundant exception handling in init_agent()
- Remove unnecessary traceback logging
- Reduce code from ~30 lines to ~10 lines

Fixes security vulnerability where __debug__ is always True
unless Python runs with -O flag, causing full tracebacks
to be sent to clients in production.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-07 20:24:30 +08:00
朱潮
8a85e9025e fix(sse): properly handle MCP tool errors and send error responses to client
- Enhance exception handling in agent_task() to capture and send structured error messages via SSE stream
- Add [DONE] marker to outer exception handler to ensure proper stream termination
- Improve MCP tool loading error handling in init_agent() to prevent cascading failures
- Add detailed error logging with traceback for debugging

Fixes RemoteProtocolError that occurred when MCP tool calls failed,
which previously caused incomplete chunked read errors and connection drops.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-07 19:24:28 +08:00
朱潮
1233bdda0c ♻️ refactor(deep-agent): customize agent memory middleware path display
- Change workspace_root from ~/.deepagents/{bot_id} to projects/robot/{bot_id}
- Refactor CustomSkillsMiddleware to support user and project skills separately
- Update skill path formatting for better visibility in system prompts
- Remove unused symlink_utils module and related setup code
- Clean up imports in fastapi_app.py and utils/__init__.py
2026-01-07 12:05:40 +08:00
朱潮
8c67630bbd ♻️ refactor(deep-agent): customize agent memory middleware path display
Override AgentMemoryMiddleware to simplify agent directory display.
The CustomAgentMemoryMiddleware shows "." instead of full path.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 21:00:49 +08:00
朱潮
a6f166d51e refactor: simplify path displays and remove sensitive config data
- Add CustomSkillsMiddleware to show ./skills instead of full paths
- Enable virtual_mode for FilesystemBackend in local mode
- Display "." instead of ~/.deepagents/{bot_id} in system prompt
- Remove backend_host and masterkey from robot project config

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 20:30:44 +08:00
朱潮
7c9e270a66 feat(deep-agent): add custom workspace_root support for shell commands
- Add create_custom_cli_agent function to support custom workspace_root
- Set shell workspace to ~/.deepagents/{bot_id} for deep_agent type
- Pass system_prompt to create_custom_cli_agent for proper context
- Fix duplicate <env> tag in system_prompt_deep_agent.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 18:18:38 +08:00
朱潮
49a0447f9f 🔧 chore(deep-agent): disable shell feature by default
Set enable_shell=False to disable shell command execution capabilities
in the deep agent for security reasons.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 16:59:33 +08:00
朱潮
0e6b2f1511 add CHECKPOINT_DB_URL 2025-12-24 20:43:10 +08:00
朱潮
b86a8364e9 db 2025-12-24 11:05:10 +08:00
朱潮
06102559ef add SUMMARIZATION_MESSAGES_TO_KEEP 2025-12-23 22:31:26 +08:00
朱潮
9162b4258d update init agent 2025-12-23 22:26:59 +08:00
朱潮
d8dc973b95 sqlite pool and change agent cache to tools cache 2025-12-23 22:18:18 +08:00
朱潮
09a9c8be93 add MCP_HTTP_TIMEOUT and try catch 2025-12-23 20:13:46 +08:00
朱潮
61c6b69aa5 add agent/tool_use_cleanup_middleware.py 2025-12-23 12:04:26 +08:00
朱潮
aaad9df20a add skills 2025-12-22 23:47:12 +08:00
朱潮
95786d559e sqlite dir check exists 2025-12-18 11:32:43 +08:00
朱潮
881845f284 use sqlite 2025-12-18 11:12:05 +08:00
朱潮
6bad1743b3 warm_up 2025-12-18 00:38:04 +08:00
朱潮
47f1d1c7eb cache 2025-12-17 23:05:42 +08:00
朱潮
436dab1a2f memory saver全局 2025-12-17 21:58:59 +08:00
朱潮
b78b178c03 删除agent manager 2025-12-17 20:27:06 +08:00
朱潮
e36787fb63 修改agent_config 2025-12-16 21:26:20 +08:00
朱潮
9525c0f883 add AgentConfig 2025-12-16 16:06:47 +08:00
朱潮
b6975e1762 TOOL_OUTPUT_MAX_LENGTH 2025-12-15 23:54:32 +08:00
朱潮
77c8f5e501 settings 2025-12-15 21:58:54 +08:00
朱潮
0d50cd8e9f session_id 2025-12-15 21:36:13 +08:00
朱潮
c391c97b24 llm log 2025-12-15 13:29:38 +08:00
朱潮
a41d45ccd9 get_tools_from_mcp 2025-12-13 20:20:31 +08:00
朱潮
ac4006fd59 before_agent guideline 2025-12-13 17:08:28 +08:00
朱潮
ec9558fd4c update guidline 2025-12-13 02:52:01 +08:00
朱潮
66b816c3b2 add default transport 2025-12-12 20:28:27 +08:00
朱潮
9c3715d9b0 add default transport 2025-12-12 20:26:23 +08:00
朱潮
d6334aa655 add default transport 2025-12-12 20:11:19 +08:00
朱潮
720db80ae9 add deep_agent 2025-12-12 18:41:52 +08:00