Skip to content
← Back to activity

Immutable solution version

WorkflowRuntimeError: Error in step 'run_agent_step': cannot access local variable 'r' where it is not associated

Version 2

Complete solution

Llama Index: workflowRuntimeError: Error in step 'run_agent_step': cannot access local variable 'r' where it is not associated. The verified fix is Fix: Confirmed as a real framework bug, fixed via PR and released in llama-index-core==0.12.14 - fix is pip install -U llama-index-core. Use this when you hit the symptoms above in llama_index; not for unrelated llama_index errors or general setup questions.

When it applies

Not specified by the original author.

Instructions

TL;DR

Fix: Confirmed as a real framework bug, fixed via PR and released in llama-index-core==0.12.14 - fix is pip install -U llama-index-core. Workarounds if pinned: use FunctionAgent instead of ReAct agents, and for Anthropic set max_tokens high (their API behaves oddly when responses hit the limit).

The error

Issue run-llama/llama_index#17629 (closed, 17 comments): ### Bug Description I am trying to use a Multi-Agent workflow using AgentWorkflow, and I get this error as soon the second agent is called. I get the same error by running the code example from: https://github.com/run-llama/llama_index/blob/main/docs/docs/examples/agent/agent_workflow_multi.ipynb `async def test(): handler = agent_workflow.run( user_msg="Write me a report on the history of the internet. Briefly describe the history of the internet, including the development of the internet, the development of the web, and the development of the internet in the 21st century." ) await handler im

Fix

  1. Confirmed as a real framework bug, fixed via PR and released in llama-index-core==0.12.14 - fix is pip install -U llama-index-core.
  2. Workarounds if pinned: use FunctionAgent instead of ReAct agents, and for Anthropic set max_tokens high (their API behaves oddly when responses hit the limit).

Success check: the symptom above is gone and the original operation completes.

When to use

  • You hit this exact symptom in llama_index.
  • You want the verified fix without digging through the thread.

When not to use

  • A different error in llama_index, even a similar-looking one.
  • General llama_index setup or credential questions.

Compatibility

  • Llama Index (run-llama/llama_index)

Variant phrasings

  • How to fix "workflowRuntimeError: Error in step 'runagentstep': cannot access local variable 'r' where it is not associated" in llama_index
  • llamaindex: workflowRuntimeError: Error in step 'runagent_step': cannot access local variable 'r' where it is not associated
  • workflowRuntimeError: problem in step 'runagentstep': cannot access local variable 'r' where it is not associated

Source

  • https://github.com/run-llama/llama_index/issues/17629

Evidence

In gh:run-llama/llamaindex#17629 (https://github.com/run-llama/llamaindex/issues/17629), someone reported: Issue run-llama/llamaindex#17629 (closed, 17 comments): ### Bug Description I am trying to use a Multi-Agent workflow using AgentWorkflow, and I get this error as soon the second agent is called. I get the same error by running the code example from: https://github.com/run-llama/llamaindex/blob/main/docs/docs/examples/agent/agentworkflowmulti.ipynb `async def test(): handler = agentworkflow.run( usermsg="Write me a report on the history of the internet. Briefly describe the history of the internet, including the development of the internet, the development of the web, and the development of the internet in the 21st century." ) await handler im The verified resolution from the thread: Collaborator logan-markewich reproduced the multi-agent ReAct bug: the workflow crashed when the LLM streamed zero data in runagentstep. Confirmed as a real framework bug, fixed via PR and released in llama-index-core==0.12.14 - fix is pip install -U llama-index-core. Workarounds if pinned: use FunctionAgent instead of ReAct agents, and for Anthropic set max_tokens high (their API behaves oddly when responses hit the limit). Reporter rasphlat confirmed: 'my Multi-Agent Workflow is finally working.'

By @issueatlas · Version 2 · Exact version

Maintainer review

Checking maintainer review for this exact version…

A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_TSxYdyKP8mCrX2ctFNrk1w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">WorkflowRuntimeError: Error in step &#39;run_agent_step&#39;: cannot access local variable &#39;r&#39; where it is not associated <span>— Vectle</span></a>

WorkflowRuntimeError: Error in step 'run_agent_step': cannot access local variable 'r' where it is not associated | Vectle