AttributeError: 'function' object has no attribute 'launch_server' #44

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

Originally created by @DARK-art108 on GitHub (Jul 13, 2024).

This is my code , which is producing this error

queue_task = asyncio.create_task(self.message_queue.launch_server())
AttributeError: 'function' object has no attribute 'launch_server'
from llama_agents import (
    AgentService,
    HumanService,
    AgentOrchestrator,
    CallableMessageConsumer,
    ControlPlaneServer,
    ServerLauncher,
    SimpleMessageQueue,
    QueueMessage,
)
import os
from dotenv import dotenv_values
import json
from src.queues.smq import SMQ
env_config = dotenv_values(".env")
os.environ["MISTRAL_API_KEY"] = env_config["MISTRAL_API_KEY"]

config = json.load(open("config.json"))
if not config:
    raise Exception("Config file not found")



class Server:
    def __init__(self) -> None:
        self.llm = config.get("llm")
        self.agent_service = Services(llm=self.llm)

    def human_consumer(self):
        human_consumer = CallableMessageConsumer(handler=self.agent_service.result_handler, message_type="human")
        return human_consumer
    
    def server_launcher(self):
        agent_server_1,agent_server_2,human_service =  self.agent_service.agent_server()
        control_plane = self.agent_service.control_plane
        launcher = ServerLauncher(
                [agent_server_1, agent_server_2, human_service],
                control_plane,
                SMQ.smq_client,
                additional_consumers=[self.human_consumer()],
            )
        launcher.launch_servers()
    
if __name__ == "__main__":
    server = Server()
    server.server_launcher()

Any solution for this?

Originally created by @DARK-art108 on GitHub (Jul 13, 2024). This is my code , which is producing this error ``` queue_task = asyncio.create_task(self.message_queue.launch_server()) AttributeError: 'function' object has no attribute 'launch_server' ``` ```from src.services import Services from llama_agents import ( AgentService, HumanService, AgentOrchestrator, CallableMessageConsumer, ControlPlaneServer, ServerLauncher, SimpleMessageQueue, QueueMessage, ) import os from dotenv import dotenv_values import json from src.queues.smq import SMQ env_config = dotenv_values(".env") os.environ["MISTRAL_API_KEY"] = env_config["MISTRAL_API_KEY"] config = json.load(open("config.json")) if not config: raise Exception("Config file not found") class Server: def __init__(self) -> None: self.llm = config.get("llm") self.agent_service = Services(llm=self.llm) def human_consumer(self): human_consumer = CallableMessageConsumer(handler=self.agent_service.result_handler, message_type="human") return human_consumer def server_launcher(self): agent_server_1,agent_server_2,human_service = self.agent_service.agent_server() control_plane = self.agent_service.control_plane launcher = ServerLauncher( [agent_server_1, agent_server_2, human_service], control_plane, SMQ.smq_client, additional_consumers=[self.human_consumer()], ) launcher.launch_servers() if __name__ == "__main__": server = Server() server.server_launcher() ``` Any solution for this?
yindo closed this issue 2026-02-16 01:15:21 -05:00
Author
Owner

@logan-markewich commented on GitHub (Jul 13, 2024):

I don't think SMQ.client is returning what you needed. I think it might be SMQ.client() ?

@logan-markewich commented on GitHub (Jul 13, 2024): I don't think SMQ.client is returning what you needed. I think it might be `SMQ.client()` ?
Author
Owner

@DARK-art108 commented on GitHub (Jul 13, 2024):

@logan-markewich Tried same still same error.

@DARK-art108 commented on GitHub (Jul 13, 2024): @logan-markewich Tried same still same error.
Author
Owner

@logan-markewich commented on GitHub (Jul 13, 2024):

Thats pretty sus. What is SMQ? Like what class?

@logan-markewich commented on GitHub (Jul 13, 2024): Thats pretty sus. What is SMQ? Like what class?
Author
Owner

@logan-markewich commented on GitHub (Jul 13, 2024):

It's a property in the class that I think it is, so no brackets needed

https://github.com/run-llama/llama-agents/blob/de7ae001f983411b05a31bb733169ed6a7854d59/llama_agents/message_queues/simple.py#L209

@logan-markewich commented on GitHub (Jul 13, 2024): It's a property in the class that I think it is, so no brackets needed https://github.com/run-llama/llama-agents/blob/de7ae001f983411b05a31bb733169ed6a7854d59/llama_agents/message_queues/simple.py#L209
Author
Owner

@logan-markewich commented on GitHub (Jul 13, 2024):

But for some reason for you, it's complaining that it's a function

@logan-markewich commented on GitHub (Jul 13, 2024): But for some reason for you, it's complaining that it's a function
Author
Owner

@DARK-art108 commented on GitHub (Jul 14, 2024):

Hi @logan-markewich this is my queue initialization

message_queue = SimpleMessageQueue()
queue_client = message_queue.client

And these are debug tracelogs :

Traceback (most recent call last):
  File "/Users/riteshyadav/miniforge3/envs/genai/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Users/riteshyadav/miniforge3/envs/genai/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/Users/riteshyadav/.vscode/extensions/ms-python.debugpy-2024.6.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module>
    cli.main()
  File "/Users/riteshyadav/.vscode/extensions/ms-python.debugpy-2024.6.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
    run()
  File "/Users/riteshyadav/.vscode/extensions/ms-python.debugpy-2024.6.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file
    runpy.run_path(target, run_name="__main__")
  File "/Users/riteshyadav/.vscode/extensions/ms-python.debugpy-2024.6.0-darwin-arm64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "/Users/riteshyadav/.vscode/extensions/ms-python.debugpy-2024.6.0-darwin-arm64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/Users/riteshyadav/.vscode/extensions/ms-python.debugpy-2024.6.0-darwin-arm64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
    exec(code, run_globals)
  File "/Users/riteshyadav/Desktop/llama-agents/server.py", line 49, in <module>
    server.server_launcher()
  File "/Users/riteshyadav/Desktop/llama-agents/server.py", line 45, in server_launcher
    launcher.launch_servers()
  File "/Users/riteshyadav/miniforge3/envs/genai/lib/python3.10/site-packages/llama_agents/launchers/server.py", line 100, in launch_servers
    return asyncio.run(self.alaunch_servers())
  File "/Users/riteshyadav/miniforge3/envs/genai/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/Users/riteshyadav/miniforge3/envs/genai/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/Users/riteshyadav/miniforge3/envs/genai/lib/python3.10/site-packages/llama_agents/launchers/server.py", line 111, in alaunch_servers
    control_plane_task = asyncio.create_task(self.control_plane.launch_server())
AttributeError: 'function' object has no attribute 'launch_server'
Task exception was never retrieved
future: <Task finished name='Task-2' coro=<SimpleRemoteClientMessageQueue.launch_server() done, defined at /Users/riteshyadav/miniforge3/envs/genai/lib/python3.10/site-packages/llama_agents/message_queues/simple.py:114> exception=NotImplementedError('`launch_server()` is not implemented for this class.')>
Traceback (most recent call last):
  File "/Users/riteshyadav/miniforge3/envs/genai/lib/python3.10/site-packages/llama_agents/message_queues/simple.py", line 115, in launch_server
    raise NotImplementedError(
NotImplementedError: `launch_server()` is not implemented for this class.
@DARK-art108 commented on GitHub (Jul 14, 2024): Hi @logan-markewich this is my queue initialization ``` message_queue = SimpleMessageQueue() queue_client = message_queue.client ``` And these are debug tracelogs : ``` Traceback (most recent call last): File "/Users/riteshyadav/miniforge3/envs/genai/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/Users/riteshyadav/miniforge3/envs/genai/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/Users/riteshyadav/.vscode/extensions/ms-python.debugpy-2024.6.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module> cli.main() File "/Users/riteshyadav/.vscode/extensions/ms-python.debugpy-2024.6.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main run() File "/Users/riteshyadav/.vscode/extensions/ms-python.debugpy-2024.6.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file runpy.run_path(target, run_name="__main__") File "/Users/riteshyadav/.vscode/extensions/ms-python.debugpy-2024.6.0-darwin-arm64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path return _run_module_code(code, init_globals, run_name, File "/Users/riteshyadav/.vscode/extensions/ms-python.debugpy-2024.6.0-darwin-arm64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code _run_code(code, mod_globals, init_globals, File "/Users/riteshyadav/.vscode/extensions/ms-python.debugpy-2024.6.0-darwin-arm64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code exec(code, run_globals) File "/Users/riteshyadav/Desktop/llama-agents/server.py", line 49, in <module> server.server_launcher() File "/Users/riteshyadav/Desktop/llama-agents/server.py", line 45, in server_launcher launcher.launch_servers() File "/Users/riteshyadav/miniforge3/envs/genai/lib/python3.10/site-packages/llama_agents/launchers/server.py", line 100, in launch_servers return asyncio.run(self.alaunch_servers()) File "/Users/riteshyadav/miniforge3/envs/genai/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/Users/riteshyadav/miniforge3/envs/genai/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/Users/riteshyadav/miniforge3/envs/genai/lib/python3.10/site-packages/llama_agents/launchers/server.py", line 111, in alaunch_servers control_plane_task = asyncio.create_task(self.control_plane.launch_server()) AttributeError: 'function' object has no attribute 'launch_server' Task exception was never retrieved future: <Task finished name='Task-2' coro=<SimpleRemoteClientMessageQueue.launch_server() done, defined at /Users/riteshyadav/miniforge3/envs/genai/lib/python3.10/site-packages/llama_agents/message_queues/simple.py:114> exception=NotImplementedError('`launch_server()` is not implemented for this class.')> Traceback (most recent call last): File "/Users/riteshyadav/miniforge3/envs/genai/lib/python3.10/site-packages/llama_agents/message_queues/simple.py", line 115, in launch_server raise NotImplementedError( NotImplementedError: `launch_server()` is not implemented for this class. ```
Author
Owner

@DARK-art108 commented on GitHub (Jul 15, 2024):

@logan-markewich any views onto above?

@DARK-art108 commented on GitHub (Jul 15, 2024): @logan-markewich any views onto above?
Author
Owner

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

@DARK-art108 I think you just need to update? pip install -U llama-agents

@logan-markewich commented on GitHub (Jul 16, 2024): @DARK-art108 I think you just need to update? `pip install -U llama-agents`
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#44