assafelovic / gpt-researcher

LLM based autonomous agent that does online comprehensive research on any given topic
https://gptr.dev
Apache License 2.0
14k stars 1.81k forks source link

recursion_limit erorr on multi agent #767

Open emilmirzayev opened 4 weeks ago

emilmirzayev commented 4 weeks ago

Hi. When running the default task in multi agent setting (is AI hype) with the task.json below, it hits recursion_limit of langgraph. Here is the error message:

REVISOR: Rewriting draft based on feedback...
REVISOR: Revision notes: I revised the abstract to clarify the specific research questions, enhancing the focus of the study. I ensured all in-text citations follow APA format, checking for consistency, including page numbers where applicable, and confirming that all sources were included in the reference list. I reformatted the references for consistency in italics and capitalization according to APA guidelines. I standardized the formatting of section headings for uniformity. The conclusion was enhanced with a more explicit summary of implications for practitioners. I simplified complex sentences for better readability and conducted a thorough proofreading to check for any remaining grammatical errors. Thank you for your valuable feedback.
Traceback (most recent call last):
  File "C:\Users\emilm\Desktop\gpt-researcher\multi_agents\main.py", line 52, in <module>
    asyncio.run(main())
  File "C:\Users\emilm\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\emilm\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\emilm\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 654, in run_until_complete      
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\emilm\Desktop\gpt-researcher\multi_agents\main.py", line 47, in main
    research_report = await chief_editor.run_research_task(task_id=uuid.uuid4())
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\emilm\Desktop\gpt-researcher\multi_agents\agents\master.py", line 84, in run_research_task
    result = await chain.ainvoke({"task": self.task}, config=config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\emilm\Desktop\gpt-researcher\researcherEnv\Lib\site-packages\langgraph\pregel\__init__.py", line 1386, in ainvoke
    async for chunk in self.astream(
  File "C:\Users\emilm\Desktop\gpt-researcher\researcherEnv\Lib\site-packages\langgraph\pregel\__init__.py", line 1265, in astream
    _panic_or_proceed(done, inflight, loop.step, asyncio.TimeoutError)
  File "C:\Users\emilm\Desktop\gpt-researcher\researcherEnv\Lib\site-packages\langgraph\pregel\__init__.py", line 1419, in _panic_or_proceed
    raise exc
  File "C:\Users\emilm\Desktop\gpt-researcher\researcherEnv\Lib\site-packages\langgraph\pregel\executor.py", line 123, in done   
    task.result()
  File "C:\Users\emilm\Desktop\gpt-researcher\researcherEnv\Lib\site-packages\langgraph\pregel\retry.py", line 75, in arun_with_retry
    await task.proc.ainvoke(task.input, task.config)
  File "C:\Users\emilm\Desktop\gpt-researcher\researcherEnv\Lib\site-packages\langchain_core\runnables\base.py", line 2920, in ainvoke
    input = await asyncio.create_task(part(), context=context)  # type: ignore
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\emilm\Desktop\gpt-researcher\researcherEnv\Lib\site-packages\langgraph\utils.py", line 124, in ainvoke
    ret = await asyncio.create_task(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\emilm\Desktop\gpt-researcher\multi_agents\agents\editor.py", line 95, in run_parallel_research
    research_results = [result['draft'] for result in await asyncio.gather(*final_drafts)]
                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\emilm\Desktop\gpt-researcher\researcherEnv\Lib\site-packages\langgraph\pregel\__init__.py", line 1386, in ainvoke
    async for chunk in self.astream(
  File "C:\Users\emilm\Desktop\gpt-researcher\researcherEnv\Lib\site-packages\langgraph\pregel\__init__.py", line 1285, in astream
    raise GraphRecursionError(
langgraph.errors.GraphRecursionError: Recursion limit of 25 reached without hitting a stop condition. You can increase the limit by setting the `recursion_limit` config key.

The default value is 25, but I would be interested to know how can I increase it. Task json below:

{
  "query": "Is AI in a hype cycle?",
  "max_sections": 3,
  "publish_formats": {
    "markdown": true,
    "pdf": false,
    "docx": false
  },
  "follow_guidelines": true,
  "model": "gpt-4o-mini",
  "guidelines": [
    "The report MUST be written in APA format"
    ],
  "verbose": true
}

thank you for help.

ElishaKay commented 3 weeks ago

Sup @emilmirzayev,

Are you running multi_agents via the CLI or the Full-Stack Docker Experience?

emilmirzayev commented 3 weeks ago

Hi. I run it on the work computer, so I can not set up Docker there. I am using pure CLI version

justrussian commented 4 days ago

Is there somewhere in the configs to raise this limit?