You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Observe the output - task agent recursively calls workflow tool
Expected Behavior
Task agent should answer the question directly without using any tools, especially not the workflow tool. The task is simple enough that it should just return a text response like "Photosynthesis is the process by which plants convert sunlight into energy."
Task agents should either:
NOT inherit the workflow tool from the parent agent, OR
Task agent inherits the workflow tool from the parent agent and recursively creates new workflows:
I'll use the workflow tool to generate a concise explanation of photosynthesis...
Tool #1: workflow
Tool #2: workflow
I'll use the workflow tool to create a task that generates a concise explanation...
Tool #1: workflow
Tool #2: workflow
I'll use the workflow tool to create a task that focuses on...
Tool #1: workflow
Tool #2: workflow
... (continues recursively until error or timeout)
Additional Context
Root Cause Analysis:
In workflow.py, the _create_task_agent method inherits all parent tools when tools is not specified in the task definition:
This includes the workflow tool itself, enabling recursive calls.
Workaround:
Adding explicit instruction in system_prompt: "Do not use any tools. Answer with your knowledge only."
tasks= [
{
"task_id": "simple_task",
"description": "Explain what photosynthesis is in one sentence.",
"system_prompt": "Answer concisely. Do not use any tools.",
},
]
Possible Solution
Option A: Automatically exclude workflow tool from task agent inheritance
# In _create_task_agentfiltered_tools= [tfortinparent_toolsift.__name__!='workflow']
Option B: Implement recursion prevention similar to think tool (#167)
Option C: Make tools: [] in task definition actually result in no tools being available (currently it seems to fall through to full inheritance)
Checks
Strands Version
1.23.0
Tools Package Version
0.2.19
Tools used
Python Version
3.13.5
Operating System
macOS 26.2
Installation Method
pip
Steps to Reproduce
tools:Expected Behavior
Task agent should answer the question directly without using any tools, especially not the workflow tool. The task is simple enough that it should just return a text response like "Photosynthesis is the process by which plants convert sunlight into energy."
Task agents should either:
thinktool has per fix(think): implement automatic recursion prevention for think tool #167)Actual Behavior
Task agent inherits the workflow tool from the parent agent and recursively creates new workflows:
Additional Context
Root Cause Analysis:
In
workflow.py, the_create_task_agentmethod inherits all parent tools whentoolsis not specified in the task definition:This includes the workflow tool itself, enabling recursive calls.
Workaround:
Adding explicit instruction in system_prompt: "Do not use any tools. Answer with your knowledge only."
Possible Solution
Option A: Automatically exclude workflow tool from task agent inheritance
Option B: Implement recursion prevention similar to think tool (#167)
Option C: Make
tools: []in task definition actually result in no tools being available (currently it seems to fall through to full inheritance)Related Issues
#244, #167