Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion agent/transports/chat_completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,16 @@ def build_kwargs(
if gh_reasoning is not None:
extra_body["reasoning"] = gh_reasoning
else:
extra_body["reasoning"] = {"enabled": True, "effort": "medium"}
# Use the user-configured effort level when available,
# falling back to "medium" for known providers. Custom
# providers (vLLM etc.) carry the user's reasoning_config
# effort so thinking_token_budget is respected. See #20576.
_effort = "medium"
if reasoning_config and isinstance(reasoning_config, dict):
_e = (reasoning_config.get("effort") or "").strip().lower()
if _e in ("low", "medium", "high"):
_effort = _e
extra_body["reasoning"] = {"enabled": True, "effort": _effort}

if provider_name == "gemini":
raw_thinking_config = _build_gemini_thinking_config(model, reasoning_config)
Expand Down
8 changes: 8 additions & 0 deletions run_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -8662,6 +8662,14 @@ def _supports_reasoning_extra_body(self) -> bool:
opts = self._lmstudio_reasoning_options_cached()
# "off-only" (or absent) means no real reasoning capability.
return any(opt and opt != "off" for opt in opts)
# Custom provider (e.g. vLLM, Ollama, etc.): honor explicit
# reasoning_config from the user. vLLM supports reasoning_effort
# and thinking_token_budget for thinking models; without this gate
# those parameters are silently dropped. See #20576.
if (self.provider or "").strip().lower() == "custom":
if self.reasoning_config and isinstance(self.reasoning_config, dict):
return self.reasoning_config.get("enabled") is not False
return False
if "openrouter" not in self._base_url_lower:
return False
if "api.mistral.ai" in self._base_url_lower:
Expand Down
Loading