use llama3.1 error #74

Closed
opened 2026-02-16 01:15:34 -05:00 by yindo · 2 comments
Owner

Originally created by @rechjq on GitHub (Aug 16, 2024).

code:

from llama_agents import (
    AgentService,
    AgentOrchestrator,
    ControlPlaneServer,
    SimpleMessageQueue,
)

from llama_index.core.agent import ReActAgent
from llama_index.core.tools import FunctionTool
from llama_index.llms.openai import OpenAI
from llama_index.llms.ollama import Ollama
llm = Ollama(model="llama3.1:latest", base_url="http://127.0.0.1:11434",temperature=0.0, request_timeout=120.0)

def get_the_secret_fact() -> str:
    """Returns the secret fact."""
    return "The secret fact is: A baby llama is called a 'Cria'."


tool = FunctionTool.from_defaults(fn=get_the_secret_fact)
agent1 = ReActAgent.from_tools([tool], llm=llm)
agent2 = ReActAgent.from_tools([], llm=llm)

# create our multi-agent framework components
message_queue = SimpleMessageQueue(port=8000)
control_plane = ControlPlaneServer(
    message_queue=message_queue,
    orchestrator=AgentOrchestrator(llm=llm),
    port=8001,
)
agent_server_1 = AgentService(
    agent=agent1,
    message_queue=message_queue,
    description="Useful for getting the secret fact.",
    service_name="secret_fact_agent",
    port=8002,
)
agent_server_2 = AgentService(
    agent=agent2,
    message_queue=message_queue,
    description="Useful for getting random dumb facts.",
    service_name="dumb_fact_agent",
    port=8003,
)
from llama_agents import LocalLauncher
launcher = LocalLauncher(
    [agent_server_1, agent_server_2],
    control_plane,
    message_queue,
)
result = launcher.launch_single("What is the secret fact?")
print(f"Result: {result}")

errors:
NFO:llama_agents.services.agent - secret_fact_agent launch_local
INFO:llama_agents.services.agent - dumb_fact_agent launch_local
INFO:llama_agents.message_queues.base - Publishing message to 'control_plane' with action 'new_task'
INFO:llama_agents.message_queues.simple - Launching message queue locally
INFO:llama_agents.services.agent - Processing initiated.
INFO:llama_agents.services.agent - Processing initiated.
INFO:llama_agents.message_queues.base - Publishing message to 'secret_fact_agent' with action 'new_task'
INFO:llama_agents.message_queues.simple - Successfully published message 'control_plane' to consumer.
INFO:llama_agents.services.agent - Created new task: 5cfa51c0-00e4-459c-86eb-93b4ee70fbf7
INFO:llama_agents.message_queues.simple - Successfully published message 'secret_fact_agent' to consumer.
ERROR:llama_agents.services.agent - Error in secret_fact_agent processing_loop: Reached max iterations.
Shutting down.
Task exception was never retrieved
future: <Task cancelling name='Task-2' coro=<AgentService.processing_loop() done, defined at /home/wjq/.local/lib/python3.10/site-packages/llama_agents/services/agent.py:215> exception=SystemExit(0)>
Traceback (most recent call last):
File "/home/wjq/.local/lib/python3.10/site-packages/llama_agents/services/agent.py", line 234, in processing_loop
step_output = await self.agent.arun_step(task_id)
File "/home/wjq/.local/lib/python3.10/site-packages/llama_index/core/instrumentation/dispatcher.py", line 290, in async_wrapper
result = await func(*args, **kwargs)
File "/home/wjq/.local/lib/python3.10/site-packages/llama_index/core/agent/runner/base.py", line 493, in arun_step
return await self._arun_step(
File "/home/wjq/.local/lib/python3.10/site-packages/llama_index/core/instrumentation/dispatcher.py", line 290, in async_wrapper
result = await func(*args, **kwargs)
File "/home/wjq/.local/lib/python3.10/site-packages/llama_index/core/agent/runner/base.py", line 453, in _arun_step
cur_step_output = await self.agent_worker.arun_step(step, task, **kwargs)
File "/home/wjq/.local/lib/python3.10/site-packages/llama_index/core/instrumentation/dispatcher.py", line 290, in async_wrapper
result = await func(*args, **kwargs)
File "/home/wjq/.local/lib/python3.10/site-packages/llama_index/core/callbacks/utils.py", line 56, in async_wrapper
return await func(self, *args, **kwargs)
File "/home/wjq/.local/lib/python3.10/site-packages/llama_index/core/agent/react/step.py", line 788, in arun_step
return await self._arun_step(step, task)
File "/home/wjq/.local/lib/python3.10/site-packages/llama_index/core/agent/react/step.py", line 612, in _arun_step
agent_response = self._get_response(
File "/home/wjq/.local/lib/python3.10/site-packages/llama_index/core/agent/react/step.py", line 434, in _get_response
raise ValueError("Reached max iterations.")
ValueError: Reached max iterations.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
self.run_forever()
File "/usr/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
self._run_once()
File "/usr/lib/python3.10/asyncio/base_events.py", line 1909, in _run_once
handle._run()
File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/wjq/.local/lib/python3.10/site-packages/llama_agents/services/agent.py", line 291, in processing_loop
signal.raise_signal(signal.SIGINT)
File "/home/wjq/.local/lib/python3.10/site-packages/llama_agents/launchers/local.py", line 138, in signal_handler
sys.exit(0)
SystemExit: 0

Originally created by @rechjq on GitHub (Aug 16, 2024). code: ``` from llama_agents import ( AgentService, AgentOrchestrator, ControlPlaneServer, SimpleMessageQueue, ) from llama_index.core.agent import ReActAgent from llama_index.core.tools import FunctionTool from llama_index.llms.openai import OpenAI from llama_index.llms.ollama import Ollama llm = Ollama(model="llama3.1:latest", base_url="http://127.0.0.1:11434",temperature=0.0, request_timeout=120.0) def get_the_secret_fact() -> str: """Returns the secret fact.""" return "The secret fact is: A baby llama is called a 'Cria'." tool = FunctionTool.from_defaults(fn=get_the_secret_fact) agent1 = ReActAgent.from_tools([tool], llm=llm) agent2 = ReActAgent.from_tools([], llm=llm) # create our multi-agent framework components message_queue = SimpleMessageQueue(port=8000) control_plane = ControlPlaneServer( message_queue=message_queue, orchestrator=AgentOrchestrator(llm=llm), port=8001, ) agent_server_1 = AgentService( agent=agent1, message_queue=message_queue, description="Useful for getting the secret fact.", service_name="secret_fact_agent", port=8002, ) agent_server_2 = AgentService( agent=agent2, message_queue=message_queue, description="Useful for getting random dumb facts.", service_name="dumb_fact_agent", port=8003, ) from llama_agents import LocalLauncher launcher = LocalLauncher( [agent_server_1, agent_server_2], control_plane, message_queue, ) result = launcher.launch_single("What is the secret fact?") print(f"Result: {result}") ``` errors: NFO:llama_agents.services.agent - secret_fact_agent launch_local INFO:llama_agents.services.agent - dumb_fact_agent launch_local INFO:llama_agents.message_queues.base - Publishing message to 'control_plane' with action 'new_task' INFO:llama_agents.message_queues.simple - Launching message queue locally INFO:llama_agents.services.agent - Processing initiated. INFO:llama_agents.services.agent - Processing initiated. INFO:llama_agents.message_queues.base - Publishing message to 'secret_fact_agent' with action 'new_task' INFO:llama_agents.message_queues.simple - Successfully published message 'control_plane' to consumer. INFO:llama_agents.services.agent - Created new task: 5cfa51c0-00e4-459c-86eb-93b4ee70fbf7 INFO:llama_agents.message_queues.simple - Successfully published message 'secret_fact_agent' to consumer. ERROR:llama_agents.services.agent - Error in secret_fact_agent processing_loop: Reached max iterations. Shutting down. Task exception was never retrieved future: <Task cancelling name='Task-2' coro=<AgentService.processing_loop() done, defined at /home/wjq/.local/lib/python3.10/site-packages/llama_agents/services/agent.py:215> exception=SystemExit(0)> Traceback (most recent call last): File "/home/wjq/.local/lib/python3.10/site-packages/llama_agents/services/agent.py", line 234, in processing_loop step_output = await self.agent.arun_step(task_id) File "/home/wjq/.local/lib/python3.10/site-packages/llama_index/core/instrumentation/dispatcher.py", line 290, in async_wrapper result = await func(*args, **kwargs) File "/home/wjq/.local/lib/python3.10/site-packages/llama_index/core/agent/runner/base.py", line 493, in arun_step return await self._arun_step( File "/home/wjq/.local/lib/python3.10/site-packages/llama_index/core/instrumentation/dispatcher.py", line 290, in async_wrapper result = await func(*args, **kwargs) File "/home/wjq/.local/lib/python3.10/site-packages/llama_index/core/agent/runner/base.py", line 453, in _arun_step cur_step_output = await self.agent_worker.arun_step(step, task, **kwargs) File "/home/wjq/.local/lib/python3.10/site-packages/llama_index/core/instrumentation/dispatcher.py", line 290, in async_wrapper result = await func(*args, **kwargs) File "/home/wjq/.local/lib/python3.10/site-packages/llama_index/core/callbacks/utils.py", line 56, in async_wrapper return await func(self, *args, **kwargs) File "/home/wjq/.local/lib/python3.10/site-packages/llama_index/core/agent/react/step.py", line 788, in arun_step return await self._arun_step(step, task) File "/home/wjq/.local/lib/python3.10/site-packages/llama_index/core/agent/react/step.py", line 612, in _arun_step agent_response = self._get_response( File "/home/wjq/.local/lib/python3.10/site-packages/llama_index/core/agent/react/step.py", line 434, in _get_response raise ValueError("Reached max iterations.") ValueError: Reached max iterations. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete self.run_forever() File "/usr/lib/python3.10/asyncio/base_events.py", line 603, in run_forever self._run_once() File "/usr/lib/python3.10/asyncio/base_events.py", line 1909, in _run_once handle._run() File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/home/wjq/.local/lib/python3.10/site-packages/llama_agents/services/agent.py", line 291, in processing_loop signal.raise_signal(signal.SIGINT) File "/home/wjq/.local/lib/python3.10/site-packages/llama_agents/launchers/local.py", line 138, in signal_handler sys.exit(0) SystemExit: 0
yindo closed this issue 2026-02-16 01:15:34 -05:00
Author
Owner

@logan-markewich commented on GitHub (Aug 16, 2024):

You can see it reached the max iterations

Usually this means the agent is stuck. Open source models are not the most reliable being react agents yet

@logan-markewich commented on GitHub (Aug 16, 2024): You can see it reached the max iterations Usually this means the agent is stuck. Open source models are not the most reliable being react agents yet
Author
Owner

@logan-markewich commented on GitHub (Sep 5, 2024):

We've done a major refactor, and I don't think this issue is relevant anymore

@logan-markewich commented on GitHub (Sep 5, 2024): We've done a major refactor, and I don't think this issue is relevant anymore
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/llama_deploy#74