Good evening guys, `controlflow` code that works l...
# marvin-ai
α
Good evening guys,
controlflow
code that works locally and has been working online for a while, has suddenly stopped working. The culprit:
Copy code
ValueError: Task #b454bc74 ("Provide a detailed analysis of how similar compani...") failed: Encountered HTTP 429 errors while trying to fetch data using the Tavily search tool, indicating rate limits have been exceeded. Unable to complete the task due to technical limitations.
11:15:42 PM
Error
Finished in state Failed('Task run encountered an exception ValueError: Task #b454bc74 ("Provide a detailed analysis of how similar compani...") failed: Encountered HTTP 429 errors while trying to fetch data using the Tavily search tool, indicating rate limits have been exceeded. Unable to complete the task due to technical limitations.')
The simplest code snippet:
Copy code
import controlflow as cf
from langchain_community.tools import TavilySearchResults
...

tavily_agent = cf.Agent(
    name="Industry Researcher",
    description="An AI agent that researches the latest trends and performance of any given industry.",
    #model="anthropic/claude-3-5-sonnet-20240620",
    model="openai/gpt-4o",
    tools=[TavilySearchResults(tavily_api_key=Secret.load("tavily-api-key", _sync=True).get())],
)

 ### Task 5
industry_trends = cf.Task(
    objective="""
    Provide a detailed analysis of how similar companies are faring in the given industry.
    """,
    agents=[tavily_agent],
    context={"industry": industry},
    result_type=IndustryTrends
)
trends = industry_trends.run()
I have contacted Tavily support and they have validated that I am not crossing any limits. This looks like a Prefect/Controlflow bug. Any thoughts ?
Thinking that local execution works perfectly fine, and executing it from Prefect doesn't work, I'm wondering whether somehow running it from Prefect induces multiple retries that break the rate limits. But then again this makes so little sense.
Cloudwatch error logs