From 9f1e4a07c9a661e696986436d7348fbab999d8dd Mon Sep 17 00:00:00 2001 From: Ashwin Bharambe Date: Fri, 31 Oct 2025 13:48:55 -0700 Subject: [PATCH] feat: support `workers` in run config (#4014) Cherry-pick of #3992 to release-0.3.x Adds support for configuring the number of workers in run.yaml configuration files. Co-authored-by: ehhuang --- llama_stack/cli/stack/run.py | 3 ++- llama_stack/core/datatypes.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/llama_stack/cli/stack/run.py b/llama_stack/cli/stack/run.py index f9c91dc9c..f185c311e 100644 --- a/llama_stack/cli/stack/run.py +++ b/llama_stack/cli/stack/run.py @@ -128,7 +128,7 @@ class StackRun(Subcommand): config = StackRunConfig(**cast_image_name_to_string(replace_env_vars(config_contents))) port = args.port or config.server.port - host = config.server.host or ["::", "0.0.0.0"] + host = config.server.host or "0.0.0.0" # Set the config file in environment so create_app can find it os.environ["LLAMA_STACK_CONFIG"] = str(config_file) @@ -140,6 +140,7 @@ class StackRun(Subcommand): "lifespan": "on", "log_level": logger.getEffectiveLevel(), "log_config": logger_config, + "workers": config.server.workers, } keyfile = config.server.tls_keyfile diff --git a/llama_stack/core/datatypes.py b/llama_stack/core/datatypes.py index 5f4775d87..369beddb5 100644 --- a/llama_stack/core/datatypes.py +++ b/llama_stack/core/datatypes.py @@ -471,6 +471,10 @@ class ServerConfig(BaseModel): "- true: Enable localhost CORS for development\n" "- {allow_origins: [...], allow_methods: [...], ...}: Full configuration", ) + workers: int = Field( + default=1, + description="Number of workers to use for the server", + ) class StackRunConfig(BaseModel):