[BUG] Tool invocation occurs twice in version 0.177.0
Description
After upgrading from version 0.165.1 to 0.177.0, I observed that tools are being invoked exactly twice on every call initiated by the LLM. In the earlier version (0.165.1), the same architecture executed tools correctly with a single invocation.
This issue introduces redundant executions, leading to duplicate outputs and unnecessary latency. The duplicate calls occur within a few milliseconds of each other, which strongly suggests an internal execution or callback duplication in the updated release.
Steps to Reproduce
Steps to Reproduce:
-
Set up a multi-crew architecture with agents configured to call external tools.
-
Register at least 4 tools in the environment.
-
Trigger tool execution through an agent.
-
Observe that the tool is invoked twice in quick succession (within milliseconds).
Expected behavior
Each tool call from the LLM should result in exactly one execution.
In version 0.177.0, every tool call is executed twice.
In version 0.165.0, the same architecture executes correctly with a single invocation.
Screenshots/Code snippets
Can't share project screenshot or code
Operating System
Windows 11
Python Version
3.11
crewAI Version
Issue in 0.177.0, currently using 0.165.1
crewAI Tools Version
0.62.3
Virtual Environment
Venv
Evidence
Can't share project logs or screenshots
Possible Solution
None
Additional context
None
Same here. I'm experiencing the same problem after upgrading from 0.165.x to 0.177.0.
I tried to reproduce this multiple times, but wasn't able to
(crewaienv) viditostwal@192 Tools-invocation % python main.py
╭──────────────────────────────────────────────────────────────── Crew Execution Started ────────────────────────────────────────────────────────────────╮
│ │
│ Crew Execution Started │
│ Name: crew │
│ ID: bcc97f19-8d61-42b1-adf0-3f2cc71091b5 │
│ Tool Args: │
│ │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
🚀 Crew: crew
└── 📋 Task: a2603b52-6263-4569-875c-12d5b2afd289
Status: Executing Task...
╭─────────────────────────────────────────────────────────────────── 🤖 Agent Started ───────────────────────────────────────────────────────────────────╮
│ │
│ Agent: Content Specialist │
│ │
│ Task: Take the input text and use the available tools to summarize, extract keywords, analyze sentiment, and format it. Your final answer MUST │
│ include all four outputs.This is the user input Artificial Intelligence is transforming industries. Many people love its potential, but some fear │
│ job loss. Overall, it is a powerful tool shaping the future. │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
🚀 Crew: crew
└── 📋 Task: a2603b52-6263-4569-875c-12d5b2afd289
Status: Executing Task...
└── 🔧 Used summarizer_tool (1)
╭─────────────────────────────────────────────────────────────── 🔧 Agent Tool Execution ────────────────────────────────────────────────────────────────╮
│ │
│ Agent: Content Specialist │
│ │
│ Thought: Thought: I need to summarize the input text first. │
│ │
│ Using Tool: summarizer_tool │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭────────────────────────────────────────────────────────────────────── Tool Input ──────────────────────────────────────────────────────────────────────╮
│ │
│ "{\"text\": \"Artificial Intelligence is transforming industries. Many people love its potential, but some fear job loss. Overall, it is a powerful │
│ tool shaping the future.\"}" │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────── Tool Output ──────────────────────────────────────────────────────────────────────╮
│ │
│ Artificial Intelligence is transforming industries. │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
🚀 Crew: crew
└── 📋 Task: a2603b52-6263-4569-875c-12d5b2afd289
Status: Executing Task...
├── 🔧 Used summarizer_tool (1)
└── 🔧 Used keyword_extractor_tool (1)
╭─────────────────────────────────────────────────────────────── 🔧 Agent Tool Execution ────────────────────────────────────────────────────────────────╮
│ │
│ Agent: Content Specialist │
│ │
│ Thought: Thought: Next, I will extract the keywords from the input text. │
│ │
│ Using Tool: keyword_extractor_tool │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭────────────────────────────────────────────────────────────────────── Tool Input ──────────────────────────────────────────────────────────────────────╮
│ │
│ "{\"text\": \"Artificial Intelligence is transforming industries. Many people love its potential, but some fear job loss. Overall, it is a powerful │
│ tool shaping the future.\"}" │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────── Tool Output ──────────────────────────────────────────────────────────────────────╮
│ │
│ overall, powerful, people, potential, future, transforming, shaping, industries, intelligence, artificial │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
🚀 Crew: crew
└── 📋 Task: a2603b52-6263-4569-875c-12d5b2afd289
Status: Executing Task...
├── 🔧 Used summarizer_tool (1)
├── 🔧 Used keyword_extractor_tool (1)
└── 🔧 Used sentiment_analyzer_tool (1)
╭─────────────────────────────────────────────────────────────── 🔧 Agent Tool Execution ────────────────────────────────────────────────────────────────╮
│ │
│ Agent: Content Specialist │
│ │
│ Thought: Thought: Now I will analyze the sentiment of the input text. │
│ │
│ Using Tool: sentiment_analyzer_tool │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭────────────────────────────────────────────────────────────────────── Tool Input ──────────────────────────────────────────────────────────────────────╮
│ │
│ "{\"text\": \"Artificial Intelligence is transforming industries. Many people love its potential, but some fear job loss. Overall, it is a powerful │
│ tool shaping the future.\"}" │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────── Tool Output ──────────────────────────────────────────────────────────────────────╮
│ │
│ Positive │
│ │
│ │
│ You ONLY have access to the following tools, and should NEVER make up tools that are not listed here: │
│ │
│ Tool Name: summarizer_tool │
│ Tool Arguments: {'text': {'description': None, 'type': 'str'}} │
│ Tool Description: Summarize text by returning the first sentence. │
│ Tool Name: keyword_extractor_tool │
│ Tool Arguments: {'text': {'description': None, 'type': 'str'}} │
│ Tool Description: Extract keywords (naive approach: return unique words > 5 chars). │
│ Tool Name: sentiment_analyzer_tool │
│ Tool Arguments: {'text': {'description': None, 'type': 'str'}} │
│ Tool Description: Naive sentiment analyzer: counts positive/negative words. │
│ Tool Name: formatter_tool │
│ Tool Arguments: {'text': {'description': None, 'type': 'str'}} │
│ Tool Description: Format text into bullet points (split by sentences). │
│ │
│ IMPORTANT: Use the following format in your response: │
│ │
│ ``` │
│ Thought: you should always think about what to do │
│ Action: the action to take, only one name of [summarizer_tool, keyword_extractor_tool, sentiment_analyzer_tool, formatter_tool], just the name, │
│ exactly as it's written. │
│ Action Input: the input to the action, just a simple JSON object, enclosed in curly braces, using " to wrap keys and values. │
│ Observation: the result of the action │
│ ``` │
│ │
│ Once all necessary information is gathered, return the following format: │
│ │
│ ``` │
│ Thought: I now know the final answer │
│ Final Answer: the final answer to the original input question │
│ ``` │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
🚀 Crew: crew
└── 📋 Task: a2603b52-6263-4569-875c-12d5b2afd289
Status: Executing Task...
├── 🔧 Used summarizer_tool (1)
├── 🔧 Used keyword_extractor_tool (1)
├── 🔧 Used sentiment_analyzer_tool (1)
└── 🔧 Used formatter_tool (1)
╭─────────────────────────────────────────────────────────────── 🔧 Agent Tool Execution ────────────────────────────────────────────────────────────────╮
│ │
│ Agent: Content Specialist │
│ │
│ Thought: Thought: Now I will format the input text into bullet points. │
│ │
│ Using Tool: formatter_tool │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭────────────────────────────────────────────────────────────────────── Tool Input ──────────────────────────────────────────────────────────────────────╮
│ │
│ "{\"text\": \"Artificial Intelligence is transforming industries. Many people love its potential, but some fear job loss. Overall, it is a powerful │
│ tool shaping the future.\"}" │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────── Tool Output ──────────────────────────────────────────────────────────────────────╮
│ │
│ - Artificial Intelligence is transforming industries │
│ - Many people love its potential, but some fear job loss │
│ - Overall, it is a powerful tool shaping the future │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
🚀 Crew: crew
└── 📋 Task: a2603b52-6263-4569-875c-12d5b2afd289
Status: Executing Task...
├── 🔧 Used summarizer_tool (1)
├── 🔧 Used keyword_extractor_tool (1)
├── 🔧 Used sentiment_analyzer_tool (1)
└── 🔧 Used formatter_tool (1)
╭──────────────────────────────────────────────────────────────── ✅ Agent Final Answer ─────────────────────────────────────────────────────────────────╮
│ │
│ Agent: Content Specialist │
│ │
│ Final Answer: │
│ - Summary: Artificial Intelligence is transforming industries. │
│ - Keywords: overall, powerful, people, potential, future, transforming, shaping, industries, intelligence, artificial │
│ - Sentiment: Positive │
│ - Formatted version: │
│ - Artificial Intelligence is transforming industries │
│ - Many people love its potential, but some fear job loss │
│ - Overall, it is a powerful tool shaping the future │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
🚀 Crew: crew
└── 📋 Task: a2603b52-6263-4569-875c-12d5b2afd289
Assigned to: Content Specialist
Status: ✅ Completed
├── 🔧 Used summarizer_tool (1)
├── 🔧 Used keyword_extractor_tool (1)
├── 🔧 Used sentiment_analyzer_tool (1)
└── 🔧 Used formatter_tool (1)
╭─────────────────────────────────────────────────────────────────── Task Completion ────────────────────────────────────────────────────────────────────╮
│ │
│ Task Completed │
│ Name: a2603b52-6263-4569-875c-12d5b2afd289 │
│ Agent: Content Specialist │
│ Tool Args: │
│ │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─────────────────────────────────────────────────────────────────── Crew Completion ────────────────────────────────────────────────────────────────────╮
│ │
│ Crew Execution Completed │
│ Name: crew │
│ ID: bcc97f19-8d61-42b1-adf0-3f2cc71091b5 │
│ Tool Args: │
│ Final Output: - Summary: Artificial Intelligence is transforming industries. │
│ - Keywords: overall, powerful, people, potential, future, transforming, shaping, industries, intelligence, artificial │
│ - Sentiment: Positive │
│ - Formatted version: │
│ - Artificial Intelligence is transforming industries │
│ - Many people love its potential, but some fear job loss │
│ - Overall, it is a powerful tool shaping the future │
│ │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
=== Final Result ===
- Summary: Artificial Intelligence is transforming industries.
- Keywords: overall, powerful, people, potential, future, transforming, shaping, industries, intelligence, artificial
- Sentiment: Positive
- Formatted version:
- Artificial Intelligence is transforming industries
- Many people love its potential, but some fear job loss
- Overall, it is a powerful tool shaping the future
(crewaienv) viditostwal@192 Tools-invocation %
some simple example .
Result in v0.177.0: Each tool executes twice Result in v0.165.1: Tools execute once as expected
I am facing this error while trying to run this code @Priluka
File "/Users/viditostwal/Desktop/crewai-issues/Tools-invocation/Tools-invocation.py", line 92, in <module>
main()
File "/Users/viditostwal/Desktop/crewai-issues/Tools-invocation/Tools-invocation.py", line 52, in main
email_agent = Agent(
^^^^^^
File "/opt/anaconda3/envs/crewaienv/lib/python3.11/site-packages/pydantic/main.py", line 253, in __init__
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for Agent
tools.0
Input should be a valid dictionary or instance of BaseTool [type=model_type, input_value=[Wrapper(name='GMAIL_CREA... current_usage_count=0)], input_type=list]
For further information visit https://errors.pydantic.dev/2.11/v/model_type
Are you sure it's a subclass of Basetool?
Hi @Priluka, nice catch. Tool was indeed called twice.
The above mentioned PR should resolve that. @hkjxflb0
This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.