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
18.98k stars 2.61k forks source link

How to use max_execution_time on the agent #732

Closed praveenreddy854 closed 2 weeks ago

praveenreddy854 commented 3 months ago

I want to set the max_execution_time to 60 seconds. The current implementation doesn't seem to be working. Also, can this explicitly state if max_execution_time is in seconds or minutes or hours etc.

I have tried max_execution_time = 1 and max_execution_time = 60 in both the cases the agent didn't stop at or slightly after 60th second mark.

Here is my agent.

grocery_shopping_lister_agent = Agent(
    role="Grocery Shopping Lister",
    goal="Help user to add a todo list items to buy list of groceries",
    tools=[search_tool, scrape_tool],
    allow_delegation=False,
    max_iter=2,
    max_rpm=10,
    max_execution_time=1,
    verbose=True,
    backstory=(
        "As a grocery shopping lister, you should be able to provide a list of groceries to buy."
        "You should look at the user's purchase history if available and suggest items to buy."
        "Also look for nearby grocery stores and their availability of items."
        #"If the recipe is not empty then skip executing and return early with a message not applicable."
    ),
    llm=azure_llm
)
gadgethome commented 3 months ago

Hi max_execution_time is in seconds. Are you setting on each of the agents?

praveenreddy854 commented 3 months ago

Yes @gadgethome, I did set the max_execution_time on all agents https://github.com/praveenreddy854/crewai-agents/blob/master/todo.ipynb

github-actions[bot] commented 3 weeks 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.

github-actions[bot] commented 2 weeks ago

This issue was closed because it has been stalled for 5 days with no activity.