crewAIInc / crewAI

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
https://crewai.com
MIT License
21.02k stars 2.92k forks source link

[BUG] Agent Fails to Consolidate Results from Multiple Calls to the Same Tool with Different Inputs #1414

Open l024258 opened 1 month ago

l024258 commented 1 month ago

Description

When an agent calls the same tool multiple times with different inputs, only the output from the first tool call is utilized. The subsequent calls with other inputs are ignored, and their outputs are not consolidated or used in the final result. This prevents the agent from handling multiple inputs effectively when the same tool is required multiple times within a workflow.

Steps to Reproduce

Set up an agent to call the same tool multiple times with varying inputs. Execute the agent workflow. Observe the results returned by the agent.

Expected behavior

The agent should consolidate and utilize the results from each tool call, regardless of whether the tool is called once or multiple times with different inputs.

Screenshots/Code snippets

`import os from crewai import Agent, Task, Crew

Importing crewAI tools

from langchain_community.tools import DuckDuckGoSearchResults

Instantiate tools

search_tool = DuckDuckGoSearchResults( max_results=3, )

Create agents

researcher = Agent( role='Market Research Analyst', goal='Provide up-to-date market analysis of the AI in Healthcare industry and AI in Finance industry', backstory='An expert analyst with a keen eye for market trends.', tools=[search_tool], llm=llm, verbose=True )

Define tasks

research = Task( description='Research the latest trends in the AI in Healthcare industry and AI in Finance industry and provide a summary.', expected_output='A summary of the top 3 trending developments with a unique perspective on their significance.', agent=researcher )

Assemble a crew with planning enabled

crew = Crew( agents=[researcher], tasks=[research], llm=llm, verbose=True,

planning=True, # Enable planning feature

)

Execute tasks

crew.kickoff()`

Operating System

macOS Catalina

Python Version

3.10

crewAI Version

0.51.1

crewAI Tools Version

0.12.1

Virtual Environment

Venv

Evidence

`sagemaker.config INFO - Not applying SDK defaults from location: /Library/Application Support/sagemaker/config.yaml sagemaker.config INFO - Not applying SDK defaults from location: /Users/L024258/Library/Application Support/sagemaker/config.yaml 2024-10-09 15:26:39,641 - 8570195776 - init.py-init:1236 - WARNING: SDK is disabled. 2024-10-09 15:26:39,645 - 8570195776 - init.py-init:1236 - WARNING: SDK is disabled.  [2024-10-09 15:26:39][DEBUG]: == Working Agent: Market Research Analyst  [2024-10-09 15:26:39][INFO]: == Starting Task: Research the latest trends in the AI in Healthcare industry and AI in Finance industry and provide a summary.

> Entering new CrewAgentExecutor chain... I need to gather the latest information on trends in the AI in Healthcare industry and AI in Finance industry. I will start by searching for the latest trends in the AI in Healthcare industry.

Action: duckduckgo_results_json Action Input: {"query": "latest trends in AI in Healthcare industry 2023"}2024-10-09 15:26:43,189 - 8570195776 - init.py-init:1236 - WARNING: SDK is disabled. 

[snippet: 1. Generative AI frenzy captures the public's imagination. Following ChatGPT's release in late 2022, generative AI leaped to mainstream attention. As shown in the graphic below, from Jan. 1, 2023, to a peak in early June, Google Trends recorded a meteoric 1330% increase in searches for "generative AI.". Similarly, ChatGPT was Wikipedia ..., title: Five healthcare AI trends we saw in 2023, link: https://hmacademy.com/insights/AI-Catalyst/artificial-intelligence/five-healthcare-ai-trends-we-saw-in-2023], [snippet: Current situation In 2021, the AI in healthcare market was worth over 11 billion U.S. dollars worldwide, with a forecast for the market to reach around 188 billion U.S. dollars by 2030 ..., title: AI in healthcare - statistics & facts | Statista, link: https://www.statista.com/topics/10011/ai-in-healthcare/], [snippet: Current applications of AI in healthcare. While the potential of AI in the future of healthcare is picking up speed, there are already first examples and use cases of gen AI that set new trends. In April 2023, AdaptyvBio started leveraging gen AI for a full-stack protein engineering foundry to accelerate medicine development., title: The Future of AI in Healthcare: Emerging Trends and Use Cases, link: https://www.trinetix.com/insights/the-future-of-ai-in-healthcare-emerging-trends-and-use-cases], [snippet: 1. Try to halt the development of AI until the risks and benefits are fully understood. 2. Go blazing into the unknown, deploying AI at every turn and dealing with issues as they arise. 3. Or fully embrace AI but take considered steps to limit the risks while unlocking the immediate benefits., title: How AI in healthcare can revolutionize medicine worldwide, link: https://www.weforum.org/agenda/2024/01/ai-in-healthcare-buckle-up-for-big-change-but-read-this-before-takeoff/]  Thought: I have gathered some initial information on the latest trends in the AI in Healthcare industry. Now, I need to gather similar information for the AI in Finance industry.

Action: duckduckgo_results_json Action Input: {"query": "latest trends in AI in Finance industry 2023"}2024-10-09 15:26:45,932 - 8570195776 - init.py-init:1236 - WARNING: SDK is disabled. 

[snippet: The McKinsey Global Institute (MGI) estimates that across the global banking sector, gen AI could add between $200 billion and $340 billion in value annually, or 2.8 to 4.7 percent of total industry revenues, largely through increased productivity. 1 The economic potential of generative AI: The next productivity frontier," McKinsey, June 14 ..., title: The future of AI in banking | McKinsey - McKinsey & Company, link: https://www.mckinsey.com/industries/financial-services/our-insights/scaling-gen-ai-in-banking-choosing-the-best-operating-model], [snippet: The industry's AI spend is projected to rise from $35 billion in 2023 to $97 billion by 2027, which represents a compound annual growth rate of 29%. The largest players are aggressively ..., title: The Future Of AI In Financial Services - Forbes, link: https://www.forbes.com/sites/davidparker/2024/10/03/the-future-of-ai-in-financial-services/], [snippet: Generative AI (gen AI) burst onto the scene in early 2023 and is showing clearly positive results—and raising new potential risks—for organizations worldwide.Banking leaders appear to be on board, even with the possible complications. Two-thirds of senior digital and analytics leaders attending a recent McKinsey forum on gen AI 1 McKinsey Banking & Securities Gen AI Forum, September 27 ..., title: Generative AI in banking and financial services | McKinsey, link: https://www.mckinsey.com/industries/financial-services/our-insights/capturing-the-full-value-of-generative-ai-in-banking], [snippet: The adoption of finance AI by finance functions has increased significantly in the past year with 58% using the technology in 2024 - a rise of 21 percentage points from 2023 - according to a survey by Gartner, Inc.. Gartner surveyed 121 finance leaders in June 2024 to understand their use of AI technologies for the finance function. Gartner experts are discussing key issues around finance AI ..., title: Gartner Survey Shows 58% of Finance Functions Using AI in 2024, link: https://www.gartner.com/en/newsroom/press-releases/2024-09-11-gartner-survey-shows-58-percent-of-finance-functions-use-ai-in-2024]  Thought: I have gathered information on the latest trends in both the AI in Healthcare and AI in Finance industries. Now, I will summarize the top 3 trending developments in each industry and provide a unique perspective on their significance.

Final Answer:

AI in Healthcare Industry

  1. Generative AI Frenzy:

    • Trend: Following the release of ChatGPT in late 2022, generative AI has captured mainstream attention. From January 1, 2023, to a peak in early June, Google Trends recorded a 1330% increase in searches for "generative AI".
    • Significance: This surge in interest highlights the potential of generative AI to revolutionize various aspects of healthcare, from patient interaction to drug discovery. The rapid adoption and interest suggest that healthcare providers and researchers are eager to explore and implement these technologies to improve outcomes and efficiency.
  2. AI in Protein Engineering:

    • Trend: In April 2023, AdaptyvBio started leveraging generative AI for a full-stack protein engineering foundry to accelerate medicine development.
    • Significance: This application of AI in protein engineering is a significant step towards personalized medicine. By accelerating the development of new medicines, AI

> Finished chain.  [2024-10-09 15:26:51][DEBUG]: == [Market Research Analyst] Task output: ### AI in Healthcare Industry

  1. Generative AI Frenzy:

    • Trend: Following the release of ChatGPT in late 2022, generative AI has captured mainstream attention. From January 1, 2023, to a peak in early June, Google Trends recorded a 1330% increase in searches for "generative AI".
    • Significance: This surge in interest highlights the potential of generative AI to revolutionize various aspects of healthcare, from patient interaction to drug discovery. The rapid adoption and interest suggest that healthcare providers and researchers are eager to explore and implement these technologies to improve outcomes and efficiency.
  2. AI in Protein Engineering:

    • Trend: In April 2023, AdaptyvBio started leveraging generative AI for a full-stack protein engineering foundry to accelerate medicine development.
    • Significance: This application of AI in protein engineering is a significant step towards personalized medicine. By accelerating the development of new medicines, AI

 `

Possible Solution

None

Additional context

his issue impacts workflows where multiple, distinct inputs are processed sequentially by the same tool, which is critical for tasks requiring iterative processing or comparison.

github-actions[bot] commented 4 days ago

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.