Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8c2d6f6

Browse files
authored
server: add --agent arg, remove redundant webui naming compat (ggml-org#24801)
* server: add --agent arg, remove redundant webui naming compat * corrent env * fix the test * llama-gen-docs * nits: wordings
1 parent 38724ab commit 8c2d6f6

8 files changed

Lines changed: 43 additions & 92 deletions

File tree

common/arg.cpp

Lines changed: 18 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2830,62 +2830,26 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
28302830
params.api_prefix = value;
28312831
}
28322832
).set_examples({LLAMA_EXAMPLE_SERVER}).set_env("LLAMA_ARG_API_PREFIX"));
2833-
// Deprecated: use --ui-config instead (kept for backward compat)
28342833
add_opt(common_arg(
2835-
{"--webui-config"}, "JSON",
2836-
"[DEPRECATED: use --ui-config] JSON that provides default WebUI settings (overrides WebUI defaults)",
2837-
[](common_params & params, const std::string & value) {
2838-
params.ui_config_json = value;
2839-
params.webui_config_json = value;
2840-
}
2841-
).set_examples({LLAMA_EXAMPLE_SERVER}).set_env("LLAMA_ARG_WEBUI_CONFIG"));
2842-
2843-
add_opt(common_arg(
2844-
{"--ui-config"}, "JSON",
2834+
{"--ui-config", "--webui-config"}, "JSON",
28452835
"JSON that provides default UI settings (overrides UI defaults)",
28462836
[](common_params & params, const std::string & value) {
28472837
params.ui_config_json = value;
2848-
params.webui_config_json = value;
28492838
}
28502839
).set_examples({LLAMA_EXAMPLE_SERVER}).set_env("LLAMA_ARG_UI_CONFIG"));
2851-
2852-
// Deprecated: use --ui-config-file instead (kept for backward compat)
28532840
add_opt(common_arg(
2854-
{"--webui-config-file"}, "PATH",
2855-
"[DEPRECATED: use --ui-config-file] JSON file that provides default WebUI settings (overrides WebUI defaults)",
2856-
[](common_params & params, const std::string & value) {
2857-
params.ui_config_json = read_file(value);
2858-
params.webui_config_json = params.ui_config_json;
2859-
}
2860-
).set_examples({LLAMA_EXAMPLE_SERVER}).set_env("LLAMA_ARG_WEBUI_CONFIG_FILE"));
2861-
2862-
add_opt(common_arg(
2863-
{"--ui-config-file"}, "PATH",
2841+
{"--ui-config-file", "--webui-config-file"}, "PATH",
28642842
"JSON file that provides default UI settings (overrides UI defaults)",
28652843
[](common_params & params, const std::string & value) {
28662844
params.ui_config_json = read_file(value);
2867-
params.webui_config_json = params.ui_config_json;
28682845
}
28692846
).set_examples({LLAMA_EXAMPLE_SERVER}).set_env("LLAMA_ARG_UI_CONFIG_FILE"));
2870-
2871-
// Deprecated: use --ui-mcp-proxy instead (kept for backward compat)
28722847
add_opt(common_arg(
2873-
{"--webui-mcp-proxy"},
2874-
{"--no-webui-mcp-proxy"},
2875-
"[DEPRECATED: use --ui-mcp-proxy/--no-ui-mcp-proxy] experimental: whether to enable MCP CORS proxy",
2876-
[](common_params & params, bool value) {
2877-
params.ui_mcp_proxy = value;
2878-
params.webui_mcp_proxy = value;
2879-
}
2880-
).set_examples({LLAMA_EXAMPLE_SERVER}).set_env("LLAMA_ARG_WEBUI_MCP_PROXY"));
2881-
2882-
add_opt(common_arg(
2883-
{"--ui-mcp-proxy"},
2884-
{"--no-ui-mcp-proxy"},
2848+
{"--ui-mcp-proxy", "--webui-mcp-proxy"},
2849+
{"--no-ui-mcp-proxy", "--no-webui-mcp-proxy"},
28852850
"experimental: whether to enable MCP CORS proxy - do not enable in untrusted environments (default: disabled)",
28862851
[](common_params & params, bool value) {
28872852
params.ui_mcp_proxy = value;
2888-
params.webui_mcp_proxy = value;
28892853
}
28902854
).set_examples({LLAMA_EXAMPLE_SERVER}).set_env("LLAMA_ARG_UI_MCP_PROXY"));
28912855
add_opt(common_arg(
@@ -2897,24 +2861,26 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
28972861
params.server_tools = parse_csv_row(value);
28982862
}
28992863
).set_examples({LLAMA_EXAMPLE_SERVER}).set_env("LLAMA_ARG_TOOLS"));
2900-
// Deprecated: use --ui/--no-ui instead (kept for backward compat)
2901-
add_opt(common_arg(
2902-
{"--webui"},
2903-
{"--no-webui"},
2904-
"[DEPRECATED: use --ui/--no-ui] whether to enable the Web UI",
2864+
add_opt(common_arg(
2865+
{"-ag", "--agent"},
2866+
{"-no-ag", "--no-agent"},
2867+
"whether to enable CORS proxy and all built-in tools - do not enable in untrusted environments (default: disabled)",
29052868
[](common_params & params, bool value) {
2906-
params.ui = value;
2907-
params.webui = value;
2869+
if (value) {
2870+
params.server_tools = {"all"};
2871+
params.ui_mcp_proxy = true;
2872+
} else {
2873+
params.server_tools.clear();
2874+
params.ui_mcp_proxy = false;
2875+
}
29082876
}
2909-
).set_examples({LLAMA_EXAMPLE_SERVER}).set_env("LLAMA_ARG_WEBUI"));
2910-
2877+
).set_examples({LLAMA_EXAMPLE_SERVER}).set_env("LLAMA_ARG_AGENT"));
29112878
add_opt(common_arg(
2912-
{"--ui"},
2913-
{"--no-ui"},
2879+
{"--ui", "--webui"},
2880+
{"--no-ui", "--no-webui"},
29142881
string_format("whether to enable the Web UI (default: %s)", params.ui ? "enabled" : "disabled"),
29152882
[](common_params & params, bool value) {
29162883
params.ui = value;
2917-
params.webui = value;
29182884
}
29192885
).set_examples({LLAMA_EXAMPLE_SERVER}).set_env("LLAMA_ARG_UI"));
29202886
add_opt(common_arg(

common/common.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -624,12 +624,6 @@ struct common_params {
624624

625625
// UI configs
626626
bool ui = true;
627-
628-
// Deprecated: use ui, ui_mcp_proxy, ui_config_json instead
629-
bool webui = ui;
630-
bool webui_mcp_proxy = false;
631-
std::string webui_config_json;
632-
633627
bool ui_mcp_proxy = false;
634628
std::string ui_config_json;
635629

tools/cli/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
| `-mmu, --mmproj-url URL` | URL to a multimodal projector file. see tools/mtmd/README.md<br/>(env: LLAMA_ARG_MMPROJ_URL) |
162162
| `--mmproj-auto, --no-mmproj, --no-mmproj-auto` | whether to use multimodal projector file (if available), useful when using -hf (default: enabled)<br/>(env: LLAMA_ARG_MMPROJ_AUTO) |
163163
| `--mmproj-offload, --no-mmproj-offload` | whether to enable GPU offloading for multimodal projector (default: enabled)<br/>(env: LLAMA_ARG_MMPROJ_OFFLOAD) |
164-
| `--image, --audio FILE` | path to an image or audio file. use with multimodal models, use comma-separated values for multiple files |
164+
| `--image, --audio, --video FILE` | path to an image, audio, or video file. use with multimodal models, use comma-separated values for multiple files |
165165
| `--image-min-tokens N` | minimum number of tokens each image can take, only used by vision models with dynamic resolution (default: read from model)<br/>(env: LLAMA_ARG_IMAGE_MIN_TOKENS) |
166166
| `--image-max-tokens N` | maximum number of tokens each image can take, only used by vision models with dynamic resolution (default: read from model)<br/>(env: LLAMA_ARG_IMAGE_MAX_TOKENS) |
167167
| `--chat-template-kwargs STRING` | sets additional params for the json template parser, must be a valid json object string, e.g. '{"key1":"value1","key2":"value2"}'<br/>(env: LLAMA_ARG_CHAT_TEMPLATE_KWARGS) |
@@ -174,6 +174,7 @@
174174
| `--chat-template-file JINJA_TEMPLATE_FILE` | set custom jinja chat template file (default: template taken from model's metadata)<br/>if suffix/prefix are specified, template will be disabled<br/>only commonly used templates are accepted (unless --jinja is set before this flag):<br/>list of built-in templates:<br/>bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml, command-r, deepseek, deepseek-ocr, deepseek2, deepseek3, exaone-moe, exaone3, exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, granite-4.0, granite-4.1, grok-2, hunyuan-dense, hunyuan-moe, hunyuan-vl, kimi-k2, llama2, llama2-sys, llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm, mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7, mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3, phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca, yandex, zephyr<br/>(env: LLAMA_ARG_CHAT_TEMPLATE_FILE) |
175175
| `--skip-chat-parsing, --no-skip-chat-parsing` | force a pure content parser, even if a Jinja template is specified; model will output everything in the content section, including any reasoning and/or tool calls (default: disabled)<br/>(env: LLAMA_ARG_SKIP_CHAT_PARSING) |
176176
| `--simple-io` | use basic IO for better compatibility in subprocesses and limited consoles |
177+
| `--log-prompts-dir PATH` | Log prompts to directory (only used for debugging, default: disabled) |
177178
| `--spec-draft-hf, -hfd, -hfrd, --hf-repo-draft <user>/<model>[:quant]` | Same as --hf-repo, but for the draft model (default: unused)<br/>(env: LLAMA_ARG_SPEC_DRAFT_HF_REPO) |
178179
| `--spec-draft-threads, -td, --threads-draft N` | number of threads to use during generation (default: same as --threads) |
179180
| `--spec-draft-threads-batch, -tbd, --threads-batch-draft N` | number of threads to use during batch and prompt processing (default: same as --threads-draft) |

tools/server/README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,12 @@ For the full list of features, please refer to [server's changelog](https://gith
175175
| `-np, --parallel N` | number of server slots (default: -1, -1 = auto)<br/>(env: LLAMA_ARG_N_PARALLEL) |
176176
| `-cb, --cont-batching, -nocb, --no-cont-batching` | whether to enable continuous batching (a.k.a dynamic batching) (default: enabled)<br/>(env: LLAMA_ARG_CONT_BATCHING) |
177177
| `-mm, --mmproj FILE` | path to a multimodal projector file. see tools/mtmd/README.md<br/>note: if -hf is used, this argument can be omitted<br/>(env: LLAMA_ARG_MMPROJ) |
178-
| `-tk, --talker-model FILE` | path to the qwen3-omni talker gguf, enables the /v1/audio/speech endpoint<br/>(env: LLAMA_ARG_TALKER_MODEL) |
179-
| `-c2w, --code2wav-model FILE` | path to the qwen3-omni code2wav gguf, the talker code detokenizer<br/>(env: LLAMA_ARG_CODE2WAV_MODEL) |
180178
| `-mmu, --mmproj-url URL` | URL to a multimodal projector file. see tools/mtmd/README.md<br/>(env: LLAMA_ARG_MMPROJ_URL) |
181179
| `--mmproj-auto, --no-mmproj, --no-mmproj-auto` | whether to use multimodal projector file (if available), useful when using -hf (default: enabled)<br/>(env: LLAMA_ARG_MMPROJ_AUTO) |
182180
| `--mmproj-offload, --no-mmproj-offload` | whether to enable GPU offloading for multimodal projector (default: enabled)<br/>(env: LLAMA_ARG_MMPROJ_OFFLOAD) |
183181
| `--image-min-tokens N` | minimum number of tokens each image can take, only used by vision models with dynamic resolution (default: read from model)<br/>(env: LLAMA_ARG_IMAGE_MIN_TOKENS) |
184182
| `--image-max-tokens N` | maximum number of tokens each image can take, only used by vision models with dynamic resolution (default: read from model)<br/>(env: LLAMA_ARG_IMAGE_MAX_TOKENS) |
183+
| `--mtmd-batch-max-tokens N` | maximum number of image tokens per batch when encoding images (default: 1024)<br/>(env: LLAMA_ARG_MTMD_BATCH_MAX_TOKENS) |
185184
| `-a, --alias STRING` | set model name aliases, comma-separated (to be used by API)<br/>(env: LLAMA_ARG_ALIAS) |
186185
| `--tags STRING` | set model tags, comma-separated (informational, not used for routing)<br/>(env: LLAMA_ARG_TAGS) |
187186
| `--embd-normalize N` | normalisation for embeddings (default: 2) (-1=none, 0=max absolute int16, 1=taxicab, 2=euclidean, >2=p-norm) |
@@ -190,15 +189,12 @@ For the full list of features, please refer to [server's changelog](https://gith
190189
| `--reuse-port` | allow multiple sockets to bind to the same port (default: disabled)<br/>(env: LLAMA_ARG_REUSE_PORT) |
191190
| `--path PATH` | path to serve static files from (default: )<br/>(env: LLAMA_ARG_STATIC_PATH) |
192191
| `--api-prefix PREFIX` | prefix path the server serves from, without the trailing slash (default: )<br/>(env: LLAMA_ARG_API_PREFIX) |
193-
| `--webui-config JSON` | [DEPRECATED: use --ui-config] JSON that provides default WebUI settings (overrides WebUI defaults)<br/>(env: LLAMA_ARG_WEBUI_CONFIG) |
194-
| `--ui-config JSON` | JSON that provides default UI settings (overrides UI defaults)<br/>(env: LLAMA_ARG_UI_CONFIG) |
195-
| `--webui-config-file PATH` | [DEPRECATED: use --ui-config-file] JSON file that provides default WebUI settings (overrides WebUI defaults)<br/>(env: LLAMA_ARG_WEBUI_CONFIG_FILE) |
196-
| `--ui-config-file PATH` | JSON file that provides default UI settings (overrides UI defaults)<br/>(env: LLAMA_ARG_UI_CONFIG_FILE) |
197-
| `--webui-mcp-proxy, --no-webui-mcp-proxy` | [DEPRECATED: use --ui-mcp-proxy/--no-ui-mcp-proxy] experimental: whether to enable MCP CORS proxy<br/>(env: LLAMA_ARG_WEBUI_MCP_PROXY) |
198-
| `--ui-mcp-proxy, --no-ui-mcp-proxy` | experimental: whether to enable MCP CORS proxy - do not enable in untrusted environments (default: disabled)<br/>(env: LLAMA_ARG_UI_MCP_PROXY) |
192+
| `--ui-config, --webui-config JSON` | JSON that provides default UI settings (overrides UI defaults)<br/>(env: LLAMA_ARG_UI_CONFIG) |
193+
| `--ui-config-file, --webui-config-file PATH` | JSON file that provides default UI settings (overrides UI defaults)<br/>(env: LLAMA_ARG_UI_CONFIG_FILE) |
194+
| `--ui-mcp-proxy, --webui-mcp-proxy, --no-ui-mcp-proxy, --no-webui-mcp-proxy` | experimental: whether to enable MCP CORS proxy - do not enable in untrusted environments (default: disabled)<br/>(env: LLAMA_ARG_UI_MCP_PROXY) |
199195
| `--tools TOOL1,TOOL2,...` | experimental: whether to enable built-in tools for AI agents - do not enable in untrusted environments (default: no tools)<br/>specify "all" to enable all tools<br/>available tools: read_file, file_glob_search, grep_search, exec_shell_command, write_file, edit_file, apply_diff, get_datetime<br/>(env: LLAMA_ARG_TOOLS) |
200-
| `--webui, --no-webui` | [DEPRECATED: use --ui/--no-ui] whether to enable the Web UI<br/>(env: LLAMA_ARG_WEBUI) |
201-
| `--ui, --no-ui` | whether to enable the Web UI (default: enabled)<br/>(env: LLAMA_ARG_UI) |
196+
| `-ag, --agent, -no-ag, --no-agent` | whether to enable CORS proxy and all built-in tools - do not enable in untrusted environments (default: disabled)<br/>(env: LLAMA_ARG_AGENT) |
197+
| `--ui, --webui, --no-ui, --no-webui` | whether to enable the Web UI (default: enabled)<br/>(env: LLAMA_ARG_UI) |
202198
| `--embedding, --embeddings` | restrict to only support embedding use case; use only with dedicated embedding models (default: disabled)<br/>(env: LLAMA_ARG_EMBEDDINGS) |
203199
| `--rerank, --reranking` | enable reranking endpoint on server (default: disabled)<br/>(env: LLAMA_ARG_RERANKING) |
204200
| `--api-key KEY` | API key to use for authentication, multiple keys can be provided as a comma-separated list (default: none)<br/>(env: LLAMA_API_KEY) |
@@ -207,6 +203,7 @@ For the full list of features, please refer to [server's changelog](https://gith
207203
| `--ssl-cert-file FNAME` | path to file a PEM-encoded SSL certificate<br/>(env: LLAMA_ARG_SSL_CERT_FILE) |
208204
| `--chat-template-kwargs STRING` | sets additional params for the json template parser, must be a valid json object string, e.g. '{"key1":"value1","key2":"value2"}'<br/>(env: LLAMA_ARG_CHAT_TEMPLATE_KWARGS) |
209205
| `-to, --timeout N` | server read/write timeout in seconds (default: 3600)<br/>(env: LLAMA_ARG_TIMEOUT) |
206+
| `--sse-ping-interval N` | server SSE ping interval in seconds (-1 = disabled, default: 30)<br/>(env: LLAMA_ARG_SSE_PING_INTERVAL) |
210207
| `--threads-http N` | number of threads used to process HTTP requests (default: -1)<br/>(env: LLAMA_ARG_THREADS_HTTP) |
211208
| `--cache-prompt, --no-cache-prompt` | whether to enable prompt caching (default: enabled)<br/>(env: LLAMA_ARG_CACHE_PROMPT) |
212209
| `--cache-reuse N` | min chunk size to attempt reusing from the cache via KV shifting, requires prompt caching to be enabled (default: 0)<br/>[(card)](https://ggml.ai/f0.png)<br/>(env: LLAMA_ARG_CACHE_REUSE) |
@@ -231,6 +228,7 @@ For the full list of features, please refer to [server's changelog](https://gith
231228
| `-sps, --slot-prompt-similarity SIMILARITY` | how much the prompt of a request must match the prompt of a slot in order to use that slot (default: 0.10, 0.0 = disabled) |
232229
| `--lora-init-without-apply` | load LoRA adapters without applying them (apply later via POST /lora-adapters) (default: disabled) |
233230
| `--sleep-idle-seconds SECONDS` | number of seconds of idleness after which the server will sleep (default: -1; -1 = disabled) |
231+
| `--log-prompts-dir PATH` | Log prompts to directory (only used for debugging, default: disabled) |
234232
| `--spec-draft-hf, -hfd, -hfrd, --hf-repo-draft <user>/<model>[:quant]` | Same as --hf-repo, but for the draft model (default: unused)<br/>(env: LLAMA_ARG_SPEC_DRAFT_HF_REPO) |
235233
| `--spec-draft-threads, -td, --threads-draft N` | number of threads to use during generation (default: same as --threads) |
236234
| `--spec-draft-threads-batch, -tbd, --threads-batch-draft N` | number of threads to use during batch and prompt processing (default: same as --threads-draft) |

tools/server/server-context.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,11 +1302,8 @@ struct server_context_impl {
13021302
}
13031303
}
13041304

1305-
// populate UI settings (from either new ui_config_json or deprecated webui_config_json)
13061305
{
1307-
const std::string & cfg = !params_base.ui_config_json.empty()
1308-
? params_base.ui_config_json
1309-
: params_base.webui_config_json;
1306+
const std::string & cfg = params_base.ui_config_json;
13101307
if (!cfg.empty()) {
13111308
try {
13121309
json json_settings = json::parse(cfg);
@@ -4304,18 +4301,18 @@ void server_routes::init_routes() {
43044301
{ "endpoint_props", params.endpoint_props },
43054302
{ "endpoint_metrics", params.endpoint_metrics },
43064303
// New keys
4307-
{ "ui", params.ui },
4308-
{ "ui_settings", meta->json_ui_settings },
4304+
{ "ui", params.ui },
4305+
{ "ui_settings", meta->json_ui_settings },
43094306
// Deprecated: use ui/ui_settings instead (kept for backward compat)
4310-
{ "webui", params.webui },
4311-
{ "webui_settings", meta->json_webui_settings },
4307+
{ "webui", params.ui },
4308+
{ "webui_settings", meta->json_ui_settings },
43124309
{ "chat_template", tmpl_default },
43134310
{ "chat_template_caps", meta->chat_template_caps },
43144311
{ "bos_token", meta->bos_token_str },
43154312
{ "eos_token", meta->eos_token_str },
43164313
{ "build_info", meta->build_info },
43174314
{ "is_sleeping", queue_tasks.is_sleeping() },
4318-
{ "cors_proxy_enabled", params.ui_mcp_proxy || params.webui_mcp_proxy },
4315+
{ "cors_proxy_enabled", params.ui_mcp_proxy },
43194316
};
43204317
if (params.use_jinja) {
43214318
if (!tmpl_tools.empty()) {

tools/server/server-models.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,9 +1462,9 @@ void server_models_routes::init_routes() {
14621462
auto res = std::make_unique<server_http_res>();
14631463
res_ok(res, {
14641464
// TODO: add support for this on web UI
1465-
{"role", "router"},
1466-
{"max_instances", params.models_max},
1467-
{"models_autoload", params.models_autoload},
1465+
{"role", "router"},
1466+
{"max_instances", params.models_max},
1467+
{"models_autoload", params.models_autoload},
14681468
// this is a dummy response to make sure the UI doesn't break
14691469
{"model_alias", "llama-server"},
14701470
{"model_path", "none"},
@@ -1473,11 +1473,10 @@ void server_models_routes::init_routes() {
14731473
{"n_ctx", 0},
14741474
}},
14751475
// New key
1476-
{"ui_settings", ui_settings},
1477-
// Deprecated: use ui_settings instead (kept for backward compat)
1478-
{"webui_settings", webui_settings},
1479-
{"build_info", std::string(llama_build_info())},
1480-
{"cors_proxy_enabled", params.ui_mcp_proxy || params.webui_mcp_proxy},
1476+
{"ui_settings", ui_settings},
1477+
{"webui_settings", webui_settings},
1478+
{"build_info", std::string(llama_build_info())},
1479+
{"cors_proxy_enabled", params.ui_mcp_proxy},
14811480
});
14821481
return res;
14831482
}

tools/server/server-models.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,7 @@ struct server_models_routes {
212212
server_models models;
213213
server_models_routes(const common_params & params, int argc, char ** argv)
214214
: params(params), models(params, argc, argv) {
215-
// Support both new ui_config_json and deprecated webui_config_json
216-
const std::string & cfg = !this->params.ui_config_json.empty()
217-
? this->params.ui_config_json
218-
: this->params.webui_config_json;
215+
const std::string & cfg = this->params.ui_config_json;
219216
if (!cfg.empty()) {
220217
try {
221218
json json_settings = json::parse(cfg);

0 commit comments

Comments
 (0)