Josh-XT / AGiXT

AGiXT is a dynamic AI Agent Automation Platform that seamlessly orchestrates instruction management and complex task execution across diverse AI providers. Combining adaptive memory, smart features, and a versatile plugin system, AGiXT delivers efficient and comprehensive AI solutions.
https://AGiXT.com
MIT License
2.65k stars 354 forks source link

Empty response from backend #245

Closed peter-bonanni closed 1 year ago

peter-bonanni commented 1 year ago

Description

When trying to run the Agent-LLM project for the first time using the docker instructions I am unable to interact with the backend from the frontend or the docker host.

Steps to Reproduce the Bug

I follow the quick start instructions:

git clone https://github.com/Josh-XT/Agent-LLM
cd Agent-LLM
git clone https://github.com/JamesonRGrieve/Agent-LLM-Frontend frontend --recurse-submodules 
docker-compose up -d

Everything is running fine in docker, and I can connect to http://localhost:3000 however I see connection refused errors on every tab of the interface.

When curling the backend from the docker host I get empty responses on all endpoints. The same thing appears to be happening from the frontend inside the docker container.

Host Example:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (52) Empty reply from server

Expected Behavior

The backend does not response with empty responses.

Actual Behavior

The backend responds normally.

Additional Context / Screenshots

No response

Operating System

Python Version

Environment Type - Connection

Environment Type - Container

Acknowledgements

Josh-XT commented 1 year ago

Please run this to see if your back end is running.

docker-compose ps -a
peter-bonanni commented 1 year ago

Just ran it on the latest release version: (I was seeing same behavior on main when I tried that a couple hours ago)

agent-llm-117-alpha-backend-1    agent-llm-117-alpha-backend    "python /app/app.py"     backend             About an hour ago   Up About an hour    0.0.0.0:7437->7437/tcp
agent-llm-117-alpha-frontend-1   agent-llm-117-alpha-frontend   "docker-entrypoint.s…"   frontend            About an hour ago   Up About an hour    0.0.0.0:3000->3000/tcp

The output logs when the backend startup are:

2023-05-07 18:09:48 Collecting en-core-web-sm==3.5.0
2023-05-07 18:09:48   Downloading https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.5.0/en_core_web_sm-3.5.0-py3-none-any.whl (12.8 MB)
2023-05-07 18:09:49      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.8/12.8 MB 10.9 MB/s eta 0:00:00
2023-05-07 18:09:49 Requirement already satisfied: spacy<3.6.0,>=3.5.0 in ./.local/lib/python3.10/site-packages (from en-core-web-sm==3.5.0) (3.5.2)
2023-05-07 18:09:50 Requirement already satisfied: spacy-legacy<3.1.0,>=3.0.11 in ./.local/lib/python3.10/site-packages (from spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (3.0.12)
2023-05-07 18:09:50 Requirement already satisfied: spacy-loggers<2.0.0,>=1.0.0 in ./.local/lib/python3.10/site-packages (from spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (1.0.4)
2023-05-07 18:09:50 Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in ./.local/lib/python3.10/site-packages (from spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (1.0.9)
2023-05-07 18:09:50 Requirement already satisfied: cymem<2.1.0,>=2.0.2 in ./.local/lib/python3.10/site-packages (from spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (2.0.7)
2023-05-07 18:09:50 Requirement already satisfied: preshed<3.1.0,>=3.0.2 in ./.local/lib/python3.10/site-packages (from spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (3.0.8)
2023-05-07 18:09:50 Requirement already satisfied: thinc<8.2.0,>=8.1.8 in ./.local/lib/python3.10/site-packages (from spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (8.1.10)
2023-05-07 18:09:50 Requirement already satisfied: wasabi<1.2.0,>=0.9.1 in ./.local/lib/python3.10/site-packages (from spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (1.1.1)
2023-05-07 18:09:50 Requirement already satisfied: srsly<3.0.0,>=2.4.3 in ./.local/lib/python3.10/site-packages (from spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (2.4.6)
2023-05-07 18:09:50 Requirement already satisfied: catalogue<2.1.0,>=2.0.6 in ./.local/lib/python3.10/site-packages (from spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (2.0.8)
2023-05-07 18:09:50 Requirement already satisfied: typer<0.8.0,>=0.3.0 in ./.local/lib/python3.10/site-packages (from spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (0.7.0)
2023-05-07 18:09:50 Requirement already satisfied: pathy>=0.10.0 in ./.local/lib/python3.10/site-packages (from spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (0.10.1)
2023-05-07 18:09:50 Requirement already satisfied: smart-open<7.0.0,>=5.2.1 in ./.local/lib/python3.10/site-packages (from spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (6.3.0)
2023-05-07 18:09:50 Requirement already satisfied: tqdm<5.0.0,>=4.38.0 in ./.local/lib/python3.10/site-packages (from spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (4.65.0)
2023-05-07 18:09:50 Requirement already satisfied: numpy>=1.15.0 in ./.local/lib/python3.10/site-packages (from spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (1.24.3)
2023-05-07 18:09:50 Requirement already satisfied: requests<3.0.0,>=2.13.0 in ./.local/lib/python3.10/site-packages (from spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (2.30.0)
2023-05-07 18:09:50 Requirement already satisfied: pydantic!=1.8,!=1.8.1,<1.11.0,>=1.7.4 in ./.local/lib/python3.10/site-packages (from spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (1.10.7)
2023-05-07 18:09:50 Requirement already satisfied: jinja2 in ./.local/lib/python3.10/site-packages (from spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (3.1.2)
2023-05-07 18:09:50 Requirement already satisfied: setuptools in /usr/local/lib/python3.10/site-packages (from spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (65.5.1)
2023-05-07 18:09:50 Requirement already satisfied: packaging>=20.0 in ./.local/lib/python3.10/site-packages (from spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (23.1)
2023-05-07 18:09:50 Requirement already satisfied: langcodes<4.0.0,>=3.2.0 in ./.local/lib/python3.10/site-packages (from spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (3.3.0)
2023-05-07 18:09:50 Requirement already satisfied: typing-extensions>=4.2.0 in ./.local/lib/python3.10/site-packages (from pydantic!=1.8,!=1.8.1,<1.11.0,>=1.7.4->spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (4.5.0)
2023-05-07 18:09:50 Requirement already satisfied: charset-normalizer<4,>=2 in ./.local/lib/python3.10/site-packages (from requests<3.0.0,>=2.13.0->spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (3.1.0)
2023-05-07 18:09:50 Requirement already satisfied: idna<4,>=2.5 in ./.local/lib/python3.10/site-packages (from requests<3.0.0,>=2.13.0->spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (3.4)
2023-05-07 18:09:50 Requirement already satisfied: urllib3<3,>=1.21.1 in ./.local/lib/python3.10/site-packages (from requests<3.0.0,>=2.13.0->spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (1.26.15)
2023-05-07 18:09:50 Requirement already satisfied: certifi>=2017.4.17 in ./.local/lib/python3.10/site-packages (from requests<3.0.0,>=2.13.0->spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (2023.5.7)
2023-05-07 18:09:50 Requirement already satisfied: blis<0.8.0,>=0.7.8 in ./.local/lib/python3.10/site-packages (from thinc<8.2.0,>=8.1.8->spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (0.7.9)
2023-05-07 18:09:50 Requirement already satisfied: confection<1.0.0,>=0.0.1 in ./.local/lib/python3.10/site-packages (from thinc<8.2.0,>=8.1.8->spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (0.0.4)
2023-05-07 18:09:50 Requirement already satisfied: click<9.0.0,>=7.1.1 in ./.local/lib/python3.10/site-packages (from typer<0.8.0,>=0.3.0->spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (8.1.3)
2023-05-07 18:09:50 Requirement already satisfied: MarkupSafe>=2.0 in ./.local/lib/python3.10/site-packages (from jinja2->spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (2.1.2)
2023-05-07 18:09:51 Installing collected packages: en-core-web-sm
2023-05-07 18:09:51 Successfully installed en-core-web-sm-3.5.0
2023-05-07 18:09:52 INFO:     Started server process [7]
2023-05-07 18:09:52 INFO:     Waiting for application startup.
2023-05-07 18:09:52 INFO:     Application startup complete.
2023-05-07 18:09:52 INFO:     Uvicorn running on http://127.0.0.1:7437 (Press CTRL+C to quit)

Which all looks normal to me.

Josh-XT commented 1 year ago

Yeah. Can you access the back end docs at http://localhost:7437/docs ?

peter-bonanni commented 1 year ago

Yeah. Can you access the back end docs at http://localhost:7437/docs ?

Sadly, any endpoint on 7437 from the docker host gets an empty response in both my browser and in curl.

Output from curl:

$ curl --verbose http://localhost:7437/docs
*   Trying 127.0.0.1:7437...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to localhost (127.0.0.1) port 7437 (#0)
> GET /docs HTTP/1.1
> Host: localhost:7437
> User-Agent: curl/7.83.0
> Accept: */*
>
* Empty reply from server
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
* Closing connection 0
curl: (52) Empty reply from server
Josh-XT commented 1 year ago

The container may also be at http://backend.docker.local:7437

peter-bonanni commented 1 year ago

The container may also be at http://backend.docker.local:7437

That name doesn't resolve in my dns. I don't think the issue is reaching docker containers in general. I reach the frontend just fine @ 3000. Even on the backed port I am establishing a successful TCP connection however I'm not getting any bytes back in the response.

Example of successful curl on frontend using localhost.

1) port 3000 (#0)
> GET / HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.83.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< X-Powered-By: Next.js
< ETag: "idlp67s4kcpgu"
< Content-Type: text/html; charset=utf-8
< Content-Length: 33006
< Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate
< Vary: Accept-Encoding
< Date: Mon, 08 May 2023 00:55:11 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5
<
{ [33006 bytes data]
100 33006  100 33006    0     0   628k      0 --:--:-- --:--:-- --:--:--  644k42">Loading...</h1>;</div></main></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{},"page":"/","query":{},"buildId":"Zh7J96z2H1GzN6N24ovpU","isFallback":false,"appGip":true,"scriptLoader":[]}</script></body></html>
* Connection #0 to host localhost left intact

How do I up the verbosity of the backend process? Right now when it replies with an empty response I'm not seeing anything in the logs on the backend. On the frontend I only see an unhandled promise warning when making requests to the backend through the frontend UI. Network inspector also shows the empty responses.

Josh-XT commented 1 year ago

The container may also be at http://backend.docker.local:7437

That name doesn't resolve in my dns. I don't think the issue is reaching docker containers in general. I reach the frontend just fine @ 3000. Even on the backed port I am establishing a successful TCP connection however I'm not getting any bytes back in the response.

Example of successful curl on frontend using localhost.

1) port 3000 (#0)
> GET / HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.83.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< X-Powered-By: Next.js
< ETag: "idlp67s4kcpgu"
< Content-Type: text/html; charset=utf-8
< Content-Length: 33006
< Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate
< Vary: Accept-Encoding
< Date: Mon, 08 May 2023 00:55:11 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5
<
{ [33006 bytes data]
100 33006  100 33006    0     0   628k      0 --:--:-- --:--:-- --:--:--  644k42">Loading...</h1>;</div></main></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{},"page":"/","query":{},"buildId":"Zh7J96z2H1GzN6N24ovpU","isFallback":false,"appGip":true,"scriptLoader":[]}</script></body></html>
* Connection #0 to host localhost left intact

How do I up the verbosity of the backend process? Right now when it replies with an empty response I'm not seeing anything in the logs on the backend. On the frontend I only see an unhandled promise warning when making requests to the backend through the frontend UI. Network inspector also shows the empty responses.

If you're not able to get to http://localhost:7437/docs in a browser , I'm not sure what is going on with your machine. The logs would show if there was a connection made, it sounds like none is being established to the back end.

peter-bonanni commented 1 year ago

If you're not able to get to http://localhost:7437/docs in a browser , I'm not sure what is going on with your machine. The logs would show if there was a connection made, it sounds like none is being established to the back end.

Yeah, next I'm going to try running it without docker just in case. I can reach the backend when running in docker I just get empty responses for everything.

peter-bonanni commented 1 year ago

When running the backend locally without docker I am able to access the backend just fine. It must be some sort of issue related to my fresh local docker install. I'll close this for now because I don't think it's an issue with the project. I'll try the docker files on my dev machine tomorrow and see how it goes.

stjepanoviccc commented 6 months ago

Hello man, I would like to ask did you fix it? I'm having same issue, when running app locally every endpoint works, but when i dockerize it it's returning empty responses, but yesterday it was giving me good responses so i dont know what's happening