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
20.3k stars 2.81k forks source link

CrewAI Iterated Task Problem #1040

Closed probao closed 2 months ago

probao commented 2 months ago

I see some similar issues here. I want to specific it in detail and wish crewai team or other experts can solve the problem. I create a agent which play guessing number with human. The agent provide a number and human provide feedback. I want the task cannot stop until the agent reach the right number. But the task always run once and I can not solve it.

player = Agent(
    role="Game Player",
    goal=(
        "guess the right number from 1 to 100 which just human know"
        "and summarize a strategy that can help yourself to reach the right number as soon as possible"
    ),
    verbose=True,
    backstory=(
        "You play a guessing number game with human."
        "Human know the number and You don't know the right number."
        "When you provide a number, human will give you the feedback."
        "You should try your best to guess the number as soon as possible."
        "Finally you summarize the strategy to reach the right number."
    )
)

guess = Task(
    description="Guess the right number. This task cannot stop until player reach the right number",
    expected_output="summary a strategy regarding how to guess number",
    human_input=True,
    output_file="strategy.md",  
    agent=player, 
)

crew = Crew(
    agents=[player],
    tasks=[guess],
    memory=True,
    verbose=True
)

result = crew.kickoff()
probao commented 2 months ago

just in terms of this issue, using from langchain.agents import load_tools human_tools = load_tools(["human"]), not the human_input=True can solve the problem