From 2a64901522c08a2bf944c9363c7ae0889a66582e Mon Sep 17 00:00:00 2001 From: Tomas Valenta Date: Wed, 19 Jul 2023 15:49:45 +0200 Subject: [PATCH] Allow customizing server port --- agent/python/agent_protocol/agent.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/agent/python/agent_protocol/agent.py b/agent/python/agent_protocol/agent.py index c778437..09a8a55 100644 --- a/agent/python/agent_protocol/agent.py +++ b/agent/python/agent_protocol/agent.py @@ -7,9 +7,6 @@ from .dependencies import * from .models import Step, Task, TaskRequestBody -config = Config() -config.bind = ["localhost:8000"] # As an example configuration setting - from .server import app from .models import ( @@ -156,5 +153,7 @@ def handle_task(handler: Callable[[TaskInput | None], Awaitable[StepHandler]]): return Agent @staticmethod - def start(): + def start(port: int = 8000): + config = Config() + config.bind = [f"localhost:{port}"] # As an example configuration setting trio.run(serve, app, config)