Skip to content

[Bug]: WorkflowRuntimeError: Error in step 'run_agent_step': when running non OpenAI LLM #17654

@pazevedo-hyland

Description

@pazevedo-hyland

Bug Description

Getting this error WorkflowRuntimeError: Error in step 'run_agent_step': 'toolUse' whenever I run an non OpenAI LLM such as Bedrock Converse on new Agent Workflows

Image

Version

0.12.14

Steps to Reproduce

Use any tool and define as such:


from llama_index.llms.bedrock import Bedrock
from llama_index.llms.bedrock_converse import BedrockConverse

from llama_index.core.agent.workflow import FunctionAgent, ReActAgent
from llama_index.core.agent.workflow import AgentWorkflow

llm= BedrockConverse(
    model="anthropic.claude-3-haiku-20240307-v1:0",
    #context_size=300000
    
)

workflow = AgentWorkflow.from_tools_or_functions(
    [tavily_tool.to_tool_list()[0]],
    llm=llm,
    system_prompt=(
        "You are a helpful assistant that can search the web for information."
    )
)

# Run the agent
response = await workflow.run(
    user_msg="What is the latest news about AI?",
)

Relevant Logs/Tracbacks

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
File ~/cin-ml-agent/.venv/lib/python3.12/site-packages/llama_index/core/workflow/workflow.py:247, in Workflow._start.<locals>._task(name, queue, step, config)
    246 try:
--> 247     new_ev = await instrumented_step(**kwargs)
    248     break  # exit the retrying loop

File ~/cin-ml-agent/.venv/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:367, in Dispatcher.span.<locals>.async_wrapper(func, instance, args, kwargs)
    366 try:
--> 367     result = await func(*args, **kwargs)
    368 except BaseException as e:

File ~/cin-ml-agent/.venv/lib/python3.12/site-packages/llama_index/core/agent/workflow/multi_agent_workflow.py:290, in AgentWorkflow.run_agent_step(self, ctx, ev)
    288 tools = await self.get_tools(ev.current_agent_name, ev.input[-1].content or "")
--> 290 agent_output = await agent.take_step(
    291     ctx,
    292     ev.input,
    293     tools,
    294     memory,
    295 )
    297 ctx.write_event_to_stream(agent_output)

File ~/cin-ml-agent/.venv/lib/python3.12/site-packages/llama_index/core/agent/workflow/function_agent.py:43, in FunctionAgent.take_step(self, ctx, llm_input, tools, memory)
     40 response = await self.llm.astream_chat_with_tools(  # type: ignore
     41     tools, chat_history=current_llm_input, allow_parallel_tool_calls=True
...
    260     )
    261     if delay is None:
    262         # We're done retrying

WorkflowRuntimeError: Error in step 'run_agent_step': 'toolUse'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageIssue needs to be triaged/prioritized

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions