Skip to content

Commit 997b511

Browse files
a61995987Soulter
andauthored
feat: add image urls / paths supports for subagent (#5348)
* fix: 修复5081号PR在子代理执行后台任务时,未正确使用系统配置的流式/非流请求的问题(#5081) * feat:为子代理增加远程图片URL参数支持 * fix: update description for image_urls parameter in HandoffTool to clarify usage in multimodal tasks * ruff format --------- Co-authored-by: Soulter <905617992@qq.com>
1 parent c5bd074 commit 997b511

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

astrbot/core/agent/handoff.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ def default_parameters(self) -> dict:
4444
"type": "string",
4545
"description": "The input to be handed off to another agent. This should be a clear and concise request or task.",
4646
},
47+
"image_urls": {
48+
"type": "array",
49+
"items": {"type": "string"},
50+
"description": "Optional: An array of image sources (public HTTP URLs or local file paths) used as references in multimodal tasks such as video generation.",
51+
},
4752
"background_task": {
4853
"type": "boolean",
4954
"description": (

astrbot/core/astr_agent_tool_exec.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ async def _execute_handoff(
9999
**tool_args,
100100
):
101101
input_ = tool_args.get("input")
102+
image_urls = tool_args.get("image_urls")
102103

103104
# make toolset for the agent
104105
tools = tool.agent.tools
@@ -143,11 +144,13 @@ async def _execute_handoff(
143144
event=event,
144145
chat_provider_id=prov_id,
145146
prompt=input_,
147+
image_urls=image_urls,
146148
system_prompt=tool.agent.instructions,
147149
tools=toolset,
148150
contexts=contexts,
149151
max_steps=30,
150152
run_hooks=tool.agent.run_hooks,
153+
stream=ctx.get_config().get("provider_settings", {}).get("stream", False),
151154
)
152155
yield mcp.types.CallToolResult(
153156
content=[mcp.types.TextContent(type="text", text=llm_resp.completion_text)]
@@ -314,7 +317,12 @@ async def _wake_main_agent_for_background_result(
314317
message_type=session.message_type,
315318
)
316319
cron_event.role = event.role
317-
config = MainAgentBuildConfig(tool_call_timeout=3600)
320+
config = MainAgentBuildConfig(
321+
tool_call_timeout=3600,
322+
streaming_response=ctx.get_config()
323+
.get("provider_settings", {})
324+
.get("stream", False),
325+
)
318326

319327
req = ProviderRequest()
320328
conv = await _get_session_conv(event=cron_event, plugin_context=ctx)

0 commit comments

Comments
 (0)