The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(openai): agent.text_verbosity controls Responses answer length
Brandon Zarnitz3910489f78f5
diff --git a/agent/agent_init.py b/agent/agent_init.pyindex b48037180be..d52408ce549 100644--- a/agent/agent_init.py+++ b/agent/agent_init.py@@ -1337,6 +1337,13 @@ def _apply_agent_section(agent, _agent_cfg):# "auto" (codex_responses only), true (all api_modes), false, or model substrings.agent._intent_ack_continuation = _agent_section.get("intent_ack_continuation", "auto")+ # Responses `text.verbosity`: "" / unknown value = not sent (never flips the provider default).+ _verbosity = str(_agent_section.get("text_verbosity") or "").strip().lower()+ if _verbosity and _verbosity not in {"low", "medium", "high"}:+ logger.warning("Unknown agent.text_verbosity %r; expected low, medium or high — ignoring", _verbosity)+ _verbosity = ""+ agent.text_verbosity = _verbosity or None+# Default-on boolean gates: anti-stall guards (notice-only), universal guidance toggles# (ALL models, unlike enforcement), the local toolchain probe, Bot Mode protocol section.for _key in (diff --git a/agent/chat_completion_helpers.py b/agent/chat_completion_helpers.pyindex f1a9d4541af..18b71807a98 100644--- a/agent/chat_completion_helpers.py+++ b/agent/chat_completion_helpers.py@@ -1359,7 +1359,7 @@ def _build_codex_kwargs(agent, api_messages, tools_for_api, reasoning_config, reis_codex_backend=is_codex_backend, is_xai_responses=is_xai_responses,github_reasoning_extra=agent._github_models_reasoning_extra_body() if is_github_responses else None,replay_encrypted_reasoning=bool(getattr(agent, "_codex_reasoning_replay_enabled", True)),- context_management=context_management)+ context_management=context_management, text_verbosity=getattr(agent, "text_verbosity", None))diff --git a/agent/transports/codex.py b/agent/transports/codex.pyindex 985c498d09d..380da033121 100644--- a/agent/transports/codex.py+++ b/agent/transports/codex.py@@ -656,6 +656,11 @@ class ResponsesApiTransport(ProviderTransport):replay_encrypted_reasoning=replay_encrypted_reasoning,is_xai_responses=is_xai_responses, is_github_responses=is_github_responses,))+ # agent.text_verbosity -> top-level ``text.verbosity`` (#20203). Unset sends nothing;+ # xAI's /responses rejects unknown top-level fields, same as service_tier below.+ text_verbosity = params.get("text_verbosity")+ if text_verbosity and not is_xai_responses:+ kwargs["text"] = {"verbosity": text_verbosity}if request_overrides:kwargs.update(request_overrides)kwargs["model"] = wire_modeldiff --git a/hermes_cli/config_defaults.py b/hermes_cli/config_defaults.pyindex 5f0970c3936..ae169aba278 100644--- a/hermes_cli/config_defaults.py+++ b/hermes_cli/config_defaults.py@@ -120,6 +120,9 @@ DEFAULT_CONFIG = {# turn), "cold" (first turn of a session only)."service_tier": "","fast_auto_seconds": 60,+ # Responses API final-answer length (`text.verbosity`): "" = not sent (provider default),+ # or low | medium | high. Responses-family transports only; chat_completions never sends it.+ "text_verbosity": "",# System-prompt guidance telling the model to call tools instead of describing actions.# "auto" = gpt/codex models; true/false = force for all models; or a list of model-name# substrings (e.g. ["gpt", "codex", "gemini", "qwen"]).diff --git a/website/docs/user-guide/configuration.md b/website/docs/user-guide/configuration.mdindex 4c8e471466a..e5221cf395b 100644--- a/website/docs/user-guide/configuration.md+++ b/website/docs/user-guide/configuration.md@@ -1766,6 +1766,17 @@ agent:When unset (default), reasoning effort defaults to "medium" — a balanced level that works well for most tasks. Setting a value overrides it — higher reasoning effort gives better results on complex tasks at the cost of more tokens and latency.+### Answer length (`text_verbosity`)++Responses-API models (OpenAI GPT-5 family and later, direct OpenAI, ChatGPT Codex and Azure routes) also accept a separate knob for how long the final natural-language answer is, independent of reasoning depth:++```yaml+agent:+ text_verbosity: "" # empty = not sent (provider default). Options: low, medium, high+```++Hermes sends it as the top-level Responses `text: {verbosity: ...}` field only on Responses-family routes; it is never sent on `chat_completions`, Anthropic or xAI requests, and an empty or unknown value sends nothing. Structured-output (`text.format`) set through `request_overrides` is passed through unchanged.+:::note Adaptive-thinking models (Claude 4.6+, Fable/Mythos-class) over OpenRouterThese models use *adaptive* thinking and don't accept the usual `reasoning.effort`field — OpenRouter ignores it for them. Hermes transparently routes your