New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP]Feature, configurable network port #6678
base: master
Are you sure you want to change the base?
[WIP]Feature, configurable network port #6678
Conversation
β Deploy Preview for auto-gpt-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the useful proposal! Please check out the comments below:
try: | ||
pids = subprocess.check_output(["lsof", "-t", "-i", ":8000"]).split() | ||
pids = subprocess.check_output(["lsof", "-t", "-i", ":"+str(agent_port)]).split() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pids = subprocess.check_output(["lsof", "-t", "-i", ":"+str(agent_port)]).split() | |
pids = subprocess.check_output(["lsof", "-t", "-i", f":{agent_port}"]).split() |
@@ -314,7 +317,7 @@ def stop(): | |||
click.echo("No process is running on port 8000") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
click.echo("No process is running on port 8000") | |
click.echo(f"No process is running on port {agent_port}") |
agent_port: int = UserConfigurable( | ||
default=8000, | ||
from_env=lambda: int(v) if (v := os.getenv("AGENT_PORT")) else None, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in the "Application Settings" section, e.g. on line 55. Also, can you rename agent_port
to serve_port
or agent_serve_port
?
kill $(lsof -t -i :8000) | ||
kill $(lsof -t -i :${AGENT_PORT:-8080}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This should default to 8000 like it does now
- This will break the benchmark when
AGENT_PORT
is not set to its default, because AGBenchmark uses thehost
property (including port) fromagbenchmark_config/config.json
to connect to the subject agent's API.
set -a | ||
source .env | ||
set +a | ||
python3 cli.py "$@" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing \n
|
||
python3 cli.py "$@" | ||
set -a | ||
source .env |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For most users, .env
does not exist and this shows a warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AGBenchmark reads PORT
, not BENCHMARK_PORT
:
AutoGPT/benchmark/agbenchmark/__main__.py
Lines 191 to 193 in 25cc6ad
# Run the FastAPI application using uvicorn | |
port = port or int(os.getenv("PORT", 8080)) | |
uvicorn.run(app, host="0.0.0.0", port=port) |
@@ -368,7 +368,7 @@ async def run_auto_gpt_server( | |||
server = AgentProtocolServer( | |||
app_config=config, database=database, llm_provider=llm_provider | |||
) | |||
await server.start() | |||
await server.start(port=config.serving_port) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does not match the config attribute created in config.py
Just merged #6569 which makes the port configurable but doesn't touch the |
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
Background
This implements a configurable network port. I often have other stuff running locally on port 8000 and I wanted to be able to change this default.
Changes ποΈ
This only adds a config option named serving_port which reads the environment variable PORT, if this is not present it defaults to 8000.
PR Quality Scorecard β¨
+2 pts
+5 pts
+5 pts
+5 pts
-4 pts
+4 pts
+5 pts
-5 pts
agbenchmark
to verify that these changes do not regress performance? β+10 pts