From 681b4747a61899d890da29e474f85f030230ad91 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sun, 1 Feb 2026 23:33:45 +0800 Subject: [PATCH] feat: add proactive capability configuration with cron tools support --- astrbot/core/config/default.py | 29 +++++++++++++++++++ .../method/agent_sub_stages/internal.py | 5 ++++ .../en-US/features/config-metadata.json | 14 +++++++++ .../zh-CN/features/config-metadata.json | 14 +++++++++ 4 files changed, 62 insertions(+) diff --git a/astrbot/core/config/default.py b/astrbot/core/config/default.py index a752dfc55..7874892ea 100644 --- a/astrbot/core/config/default.py +++ b/astrbot/core/config/default.py @@ -114,6 +114,9 @@ DEFAULT_CONFIG = { "provider": "moonshotai", "moonshotai_api_key": "", }, + "proactive_capability": { + "add_cron_tools": True, + }, "sandbox": { "enable": False, "booter": "shipyard", @@ -2232,6 +2235,14 @@ CONFIG_METADATA_2 = { }, }, }, + "proactive_capability": { + "type": "object", + "items": { + "add_cron_tools": { + "type": "bool", + }, + }, + }, }, }, "provider_stt_settings": { @@ -2684,6 +2695,7 @@ CONFIG_METADATA_3 = { "skills": { "description": "Skills", "type": "object", + "hint": "", "items": { "provider_settings.skills.runtime": { "description": "Skill Runtime", @@ -2698,7 +2710,24 @@ CONFIG_METADATA_3 = { "provider_settings.enable": True, }, }, + "proactive_capability": { + "description": "主动型 Agent", + "hint": "https://docs.astrbot.app/use/proactive-agent.html", + "type": "object", + "items": { + "provider_settings.proactive_capability.add_cron_tools": { + "description": "启用", + "type": "bool", + "hint": "启用后,将会传递给 Agent 相关工具来实现主动型 Agent。你可以告诉 AstrBot 未来某个时间要做的事情,它将被定时触发然后执行任务。", + }, + }, + "condition": { + "provider_settings.agent_runner_type": "local", + "provider_settings.enable": True, + }, + }, "truncate_and_compress": { + "hint": "", "description": "上下文管理策略", "type": "object", "items": { diff --git a/astrbot/core/pipeline/process_stage/method/agent_sub_stages/internal.py b/astrbot/core/pipeline/process_stage/method/agent_sub_stages/internal.py index 6c6b72dff..2331d07e8 100644 --- a/astrbot/core/pipeline/process_stage/method/agent_sub_stages/internal.py +++ b/astrbot/core/pipeline/process_stage/method/agent_sub_stages/internal.py @@ -94,6 +94,10 @@ class InternalAgentSubStage(Stage): self.sandbox_cfg = settings.get("sandbox", {}) + # Proactive capability configuration + proactive_cfg = settings.get("proactive_capability", {}) + self.add_cron_tools = proactive_cfg.get("add_cron_tools", True) + self.conv_manager = ctx.plugin_manager.context.conversation_manager self.main_agent_cfg = MainAgentBuildConfig( @@ -113,6 +117,7 @@ class InternalAgentSubStage(Stage): llm_safety_mode=self.llm_safety_mode, safety_mode_strategy=self.safety_mode_strategy, sandbox_cfg=self.sandbox_cfg, + add_cron_tools=self.add_cron_tools, provider_settings=settings, subagent_orchestrator=conf.get("subagent_orchestrator", {}), timezone=self.ctx.plugin_manager.context.get_config().get("timezone"), diff --git a/dashboard/src/i18n/locales/en-US/features/config-metadata.json b/dashboard/src/i18n/locales/en-US/features/config-metadata.json index e3aa9fe78..df582828c 100644 --- a/dashboard/src/i18n/locales/en-US/features/config-metadata.json +++ b/dashboard/src/i18n/locales/en-US/features/config-metadata.json @@ -165,6 +165,7 @@ } }, "skills": { + "hint": "https://docs.astrbot.app/use/skills.html", "description": "Skills", "provider_settings": { "skills": { @@ -175,7 +176,20 @@ } } }, + "proactive_capability": { + "description": "Proactive Agent", + "hint": "https://docs.astrbot.app/en/use/proactive-agent.html", + "provider_settings": { + "proactive_capability": { + "add_cron_tools": { + "description": "Enable", + "hint": "When enabled, related tools will be passed to the Agent to implement proactive Agent capabilities. You can tell AstrBot what to do at a future time, and it will be triggered on schedule to execute the task, and report the result back to you." + } + } + } + }, "truncate_and_compress": { + "hint": "https://docs.astrbot.app/en/use/context-compress.html" "description": "Context Management Strategy", "provider_settings": { "max_context_length": { diff --git a/dashboard/src/i18n/locales/zh-CN/features/config-metadata.json b/dashboard/src/i18n/locales/zh-CN/features/config-metadata.json index 619e7bfb5..650e2064f 100644 --- a/dashboard/src/i18n/locales/zh-CN/features/config-metadata.json +++ b/dashboard/src/i18n/locales/zh-CN/features/config-metadata.json @@ -165,6 +165,7 @@ } }, "skills": { + "hint": "https://docs.astrbot.app/en/use/skills.html", "description": "Skills", "provider_settings": { "skills": { @@ -175,7 +176,20 @@ } } }, + "proactive_capability": { + "description": "主动型 Agent", + "hint": "https://docs.astrbot.app/use/proactive-agent.html", + "provider_settings": { + "proactive_capability": { + "add_cron_tools": { + "description": "启用", + "hint": "启用后,将会传递给 Agent 相关工具来实现主动型 Agent。你可以告诉 AstrBot 未来某个时间要做的事情,它将被定时触发然后执行任务,然后将结果发送给你。" + } + } + } + }, "truncate_and_compress": { + "hint": "https://docs.astrbot.app/use/context-compress.html", "description": "上下文管理策略", "provider_settings": { "max_context_length": {