Closed akshatjain99 closed 6 days ago
Can you be more specific and share code and other details like you would on Stack Overflow so that we can help?
Hey @mangalprada,
My crew looks like this:
`from crewai import Agent, Crew, Task
from agents.tools.extractData import ExtractData
from agents.tools.makeApiCall import MakeAPICall
class CrewExperiment:
def __init__(self, llm):
self.llm = llm
def run(self):
recipe_agent = Agent(
role='Code Expert',
goal='From the relevant information about the APIs, write an algorithm of list of steps that can be used to get the fields specified by the user.',
backstory="""
Background:
You are a code expert agent that understands APIs, JSON and how to link multiple steps together.
Your main aim is to write an algorithm with a list of steps to fulfill an objective.
`Based on the action you want to perform, select the desired tool and get the definition from there.
For example, to make an API call, use the 'makeApiCall' tool.
##############################################################################################################
Task:
The user has come to you with two sets of information: a list of selected APIs and a list of fields that it wants to fetch.
Write a strcutured step by step algorithm that starts from scratch and adds all the fields asked by the user to the user's model.
You must use the tools and get their definition and use those in the recipe.
##############################################################################################################
""",
llm=self.llm,
allow_delegation=True,
verbose=True,
tools=[MakeAPICall(), ExtractData()],
)
prepare_recipe = Task(
description=("""
Write an algorithm that contains a list of steps and their definitions to add the required fields to my model.
The information about the selected APIs is as follows:
The API that is needed to get the field is:
- "method": "GET",
- "url": "https://xyz.com/api/",
- "response": "{{firstname: "", lastname: "", email: ""}}",
The fields that need to be extracted are : first name, last name, email
##############################################################################################################
"""),
expected_output='Algorithm that contains a list of steps to extract the fields mentioned.',
agent = recipe_agent
)
crew = Crew(
agents=[recipe_agent],
tasks=[prepare_recipe],
verbose=True
)
result = crew.kickoff(inputs={})
return result`
and I have two tools:
Both tools take in an argument and return the json response.
My hunch is that is not able to capture the tool output correctly, maybe? Because the agent keeps going in a loop calling the tools again and again - so maybe it is not recognizing that the tool has already been called and it has the output for that?
@mangalprada, any thoughts on this?
I've had a similar experience unfortunately and it's super frustrating: it correctly identifies the tool or agent to delegate to but then in the response it's as if the data/answer never makes it back to whoever requested the tool/agent and it keeps looping.
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.
Hey folks,
I have a simple crew that takes in an instruction from the user and makes an API call (using a tool) to fetch some data. Even though the agent correctly identifies that it wants to make an API call, while calling the tool, it is stuck in a forever loop.
It keeps calling the tool with the same input again and again, the tool however never gets executed and ultimately, I get a timeout exception.
console.txt
For context, I'm using gpt-4o.
Any help will be appreciated, Thanks.