Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(reasoning): clarify which routes consume the thinking budget

Steven Enamakel39fa0139922a
diff --git a/crates/openhuman-core/src/agent/tinyagents/reasoning.rs b/crates/openhuman-core/src/agent/tinyagents/reasoning.rs
index 398eed7b71..b4f1a471f6 100644
--- a/crates/openhuman-core/src/agent/tinyagents/reasoning.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/reasoning.rs
@@ -121,8 +121,10 @@ pub(crate) fn turn_reasoning(
/// `finish_reason = length` with no tool call (#6951).
const REASONING_BUDGET_PERCENT: u32 = 55;
-/// Smallest thinking budget worth sending. Anthropic rejects
-/// `budget_tokens < 1024`; below it the effort level alone is sent.
+/// Smallest thinking budget worth sending. Anthropic models (reached through
+/// OpenRouter or the managed backend, which pass `reasoning.max_tokens` on as
+/// a thinking budget) reject budgets under 1024; below it the effort level
+/// alone is sent.
const MIN_REASONING_BUDGET_TOKENS: u32 = 1024;
/// Adds a thinking budget of [`REASONING_BUDGET_PERCENT`] of the turn's output
@@ -131,10 +133,11 @@ const MIN_REASONING_BUDGET_TOKENS: u32 = 1024;
/// Left unchanged: reasoning switched off (`effort = none`), no effort chosen
/// (a bare budget would turn reasoning on where the provider default is off),
/// an uncapped turn, a config that already names a budget, and a cap too small
-/// for [`MIN_REASONING_BUDGET_TOKENS`]. Routes that cannot express a budget
-/// (plain OpenAI-compatible endpoints, the Responses API) drop it on the wire
-/// and keep the effort; OpenRouter and the managed backend send it as
-/// `reasoning.max_tokens`.
+/// for [`MIN_REASONING_BUDGET_TOKENS`]. Only OpenRouter and the managed
+/// backend consume the budget, sending it as `reasoning.max_tokens`. Every
+/// other route sends what it sent before: native Anthropic keeps adaptive
+/// thinking with the effort (the budget applies there only with no effort),
+/// and plain OpenAI-compatible endpoints and the Responses API drop it.
pub(crate) fn with_output_room(
mut reasoning: ReasoningConfig,
max_output_tokens: Option<u32>,
diff --git a/crates/openhuman-core/src/agent/tinyagents/reasoning_tests.rs b/crates/openhuman-core/src/agent/tinyagents/reasoning_tests.rs
index 693770c7dd..f1ae4cc736 100644
--- a/crates/openhuman-core/src/agent/tinyagents/reasoning_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/reasoning_tests.rs
@@ -197,8 +197,8 @@ fn uncapped_turn_keeps_the_effort_only() {
#[test]
fn a_cap_too_small_for_a_provider_minimum_budget_keeps_the_effort_only() {
- // Anthropic rejects a thinking budget under 1024 tokens; below that the
- // effort alone is sent.
+ // Anthropic models behind OpenRouter / the managed backend reject a
+ // thinking budget under 1024 tokens; below that the effort alone is sent.
let mut config = Config::default();
config.runtime.reasoning_effort = Some("low".into());
let ctx = crate::agent::tinyagents::host::OpenHumanRunContext::new();