OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

backend runs, but fails after start up (No agent class registered under 'LangchainsAgent)

Open qwaszaq opened this issue 2 years ago • 3 comments

Describe the bug

my backend starts properly with uvicorn, and then it fails... frontend is fine (however due to the fail of backend cannot test it ;))

INFO: connection closed

LLM_API_KEY="ollama" LLM_MODEL="ollama/llama2:13b" LLM_EMBEDDING_MODEL="local" LLM_BASE_URL="http://localhost:<11434>" WORKSPACE_DIR="./workspace"

My model and agent (you can see these settings in the UI):

  • Model:
  • Agent:

Commands I ran to install and run OpenDevin: like you provided in the tutorial... "make ..."

Logs, error messages, and screenshots:

Setup and configuration

INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://127.0.0.1:3000 (Press CTRL+C to quit) INFO: ('127.0.0.1', 54336) - "WebSocket /ws" [accepted] INFO: connection open INFO: 127.0.0.1:54344 - "GET /litellm-models HTTP/1.1" 200 OK INFO: 127.0.0.1:54346 - "GET /litellm-agents HTTP/1.1" 200 OK INFO: 127.0.0.1:54348 - "GET /litellm-models HTTP/1.1" 200 OK INFO: 127.0.0.1:54350 - "GET /litellm-agents HTTP/1.1" 200 OK ERROR: Exception in ASGI application Traceback (most recent call last): File "/home/ab/.local/share/virtualenvs/OpenDevin-iDsBEdMa/lib/python3.11/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 240, in run_asgi result = await self.app(self.scope, self.asgi_receive, self.asgi_send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ab/.local/share/virtualenvs/OpenDevin-iDsBEdMa/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ab/.local/share/virtualenvs/OpenDevin-iDsBEdMa/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in call await super().call(scope, receive, send) File "/home/ab/.local/share/virtualenvs/OpenDevin-iDsBEdMa/lib/python3.11/site-packages/starlette/applications.py", line 123, in call await self.middleware_stack(scope, receive, send) File "/home/ab/.local/share/virtualenvs/OpenDevin-iDsBEdMa/lib/python3.11/site-packages/starlette/middleware/errors.py", line 151, in call await self.app(scope, receive, send) File "/home/ab/.local/share/virtualenvs/OpenDevin-iDsBEdMa/lib/python3.11/site-packages/starlette/middleware/cors.py", line 77, in call await self.app(scope, receive, send) File "/home/ab/.local/share/virtualenvs/OpenDevin-iDsBEdMa/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/home/ab/.local/share/virtualenvs/OpenDevin-iDsBEdMa/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/home/ab/.local/share/virtualenvs/OpenDevin-iDsBEdMa/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/home/ab/.local/share/virtualenvs/OpenDevin-iDsBEdMa/lib/python3.11/site-packages/starlette/routing.py", line 756, in call await self.middleware_stack(scope, receive, send) File "/home/ab/.local/share/virtualenvs/OpenDevin-iDsBEdMa/lib/python3.11/site-packages/starlette/routing.py", line 776, in app await route.handle(scope, receive, send) File "/home/ab/.local/share/virtualenvs/OpenDevin-iDsBEdMa/lib/python3.11/site-packages/starlette/routing.py", line 373, in handle await self.app(scope, receive, send) File "/home/ab/.local/share/virtualenvs/OpenDevin-iDsBEdMa/lib/python3.11/site-packages/starlette/routing.py", line 96, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "/home/ab/.local/share/virtualenvs/OpenDevin-iDsBEdMa/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/home/ab/.local/share/virtualenvs/OpenDevin-iDsBEdMa/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/home/ab/.local/share/virtualenvs/OpenDevin-iDsBEdMa/lib/python3.11/site-packages/starlette/routing.py", line 94, in app await func(session) File "/home/ab/.local/share/virtualenvs/OpenDevin-iDsBEdMa/lib/python3.11/site-packages/fastapi/routing.py", line 348, in app await dependant.call(**values) File "/home/ab/OpenDevin/opendevin/server/listen.py", line 25, in websocket_endpoint await session.start_listening() File "/home/ab/OpenDevin/opendevin/server/session.py", line 89, in start_listening await self.create_controller(data) File "/home/ab/OpenDevin/opendevin/server/session.py", line 136, in create_controller AgentCls = Agent.get_cls(agent_cls) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ab/OpenDevin/opendevin/agent.py", line 90, in get_cls raise ValueError(f"No agent class registered under '{name}'.") ValueError: No agent class registered under 'LangchainsAgent'.

qwaszaq avatar Apr 04 '24 16:04 qwaszaq

LangchainsAgent isn't in use in code anymore. Are you sure you have pulled the latest codebase?

foragerr avatar Apr 04 '24 17:04 foragerr

I will double check tm.

qwaszaq avatar Apr 04 '24 18:04 qwaszaq

I get the same error.

On Macbook M1, with micromamba, python 3.11, config.toml as

LLM_API_KEY="ollama"
LLM_MODEL = "ollama/llama2:latest"
LLM_EMBEDDING_MODEL="local"
LLM_BASE_URL="http://localhost:11434"
WORKSPACE_DIR="./workspace"
  File "~/OpenDevin/opendevin/agent.py", line 90, in get_cls
    raise ValueError(f"No agent class registered under '{name}'.")
ValueError: No agent class registered under 'LangchainsAgent'.

At opendevin/server/agent/manager.py, function create_controller gets start_event as {'action': 'initialize', 'args': {'model': 'mistral.mixtral-8x7b-instruct-v0:1', 'agent_cls': 'LangchainsAgent', 'directory': './workspace'}}

jpedrocr avatar Apr 05 '24 23:04 jpedrocr

Please do git pull to update, and make build to rebuild the project. I think it's only due to outdated code, it shouldn't happen on the current code.

enyst avatar Apr 06 '24 02:04 enyst

Solution: Clear the local storage when an error occurs during socket connection initialization.

Implementation: Consider adding localStorage.clear() at line 17 or 18 within the Socket.initialize() function located at frontend/src/services/socket.ts. This code will execute only in the event of an error. However, be cautious of any potential side effects.

jpedrocr avatar Apr 06 '24 05:04 jpedrocr

Closing this, as it's due to outdated code. If you have a proposal @jpedrocr please submit a PR or new issue.

enyst avatar Apr 06 '24 21:04 enyst