aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Nicholas Tindle <nicholas.tindle@agpt.co> 2024-01-12 08:41:43 -0500
committerGravatar GitHub <noreply@github.com> 2024-01-12 14:41:43 +0100
commit97023b9a3caff9b1edd56fa11c9189a6f4ecaacd (patch)
tree1d870bbc4dfca934a019388c119f17bf2f2d2247
parentfix(forge): cast port to int (#6643) (diff)
downloadAuto-GPT-97023b9a3caff9b1edd56fa11c9189a6f4ecaacd.tar.gz
Auto-GPT-97023b9a3caff9b1edd56fa11c9189a6f4ecaacd.tar.bz2
Auto-GPT-97023b9a3caff9b1edd56fa11c9189a6f4ecaacd.zip
feat(agent/server): Make port configurable, add documentation for Agent Protocol DB and port config (#6569)
* docs: Add documentation on how to use Agent Protocol in the template - Added documentation on how to use Agent Protocol and its settings in the `.env.template` file. - An explanation is provided for the `AP_SERVER_PORT` and `AP_SERVER_DB_URL` settings. - This change aims to improve the understanding and usage of Agent Protocol in the project. * docs: Update usage.md with information about configuring the API port - Update the documentation for the `serve` mode in `usage.md` - Add information about configuring the port for the API server using the `AP_SERVER_PORT` environment variable. --------- Co-authored-by: Reinier van der Leer <pwuts@agpt.co>
-rw-r--r--autogpts/autogpt/.env.template9
-rw-r--r--autogpts/autogpt/autogpt/app/main.py3
-rw-r--r--docs/content/AutoGPT/usage.md2
3 files changed, 12 insertions, 2 deletions
diff --git a/autogpts/autogpt/.env.template b/autogpts/autogpt/.env.template
index 886cfe4db..251e9e3fb 100644
--- a/autogpts/autogpt/.env.template
+++ b/autogpts/autogpt/.env.template
@@ -220,3 +220,12 @@ OPENAI_API_KEY=your-openai-api-key
## PLAIN_OUTPUT - Disables animated typing and the spinner in the console output. (Default: False)
# PLAIN_OUTPUT=False
+
+
+################################################################################
+### Agent Protocol Server Settings
+################################################################################
+## AP_SERVER_PORT - Specifies what port the agent protocol server will listen on. (Default: 8000)
+# AP_SERVER_PORT=8000
+# # AP_SERVER_DB_URL - Specifies what connection url the agent protocol database will connect to (Default: Internal SQLite)
+# AP_SERVER_DB_URL=sqlite:///data/ap_server.db
diff --git a/autogpts/autogpt/autogpt/app/main.py b/autogpts/autogpt/autogpt/app/main.py
index 290886c43..a9cbc563b 100644
--- a/autogpts/autogpt/autogpt/app/main.py
+++ b/autogpts/autogpt/autogpt/app/main.py
@@ -365,10 +365,11 @@ async def run_auto_gpt_server(
database_string=os.getenv("AP_SERVER_DB_URL", "sqlite:///data/ap_server.db"),
debug_enabled=debug,
)
+ port: int = int(os.getenv("AP_SERVER_PORT", default=8000))
server = AgentProtocolServer(
app_config=config, database=database, llm_provider=llm_provider
)
- await server.start()
+ await server.start(port=port)
def _configure_openai_provider(config: Config) -> OpenAIProvider:
diff --git a/docs/content/AutoGPT/usage.md b/docs/content/AutoGPT/usage.md
index 4ab752dcf..09447f03d 100644
--- a/docs/content/AutoGPT/usage.md
+++ b/docs/content/AutoGPT/usage.md
@@ -115,7 +115,7 @@ To exit the program, press ++ctrl+c++
### `serve` &ndash; Agent Protocol mode with UI
With `serve`, the application exposes an Agent Protocol compliant API and serves a
-frontend, by default on `http://localhost:8000`.
+frontend, by default on `http://localhost:8000`. You can configure the port it is served on with the `AP_SERVER_PORT` environment variable.
<details>
<summary>