Skip to content

Commit bdd51a5

Browse files
jeremyederclaude
andcommitted
fix(runner): add thinking config to allowed forwarded props
Address CodeRabbit review feedback on PR #985: add the new `thinking` config (adaptive/enabled/disabled) to ALLOWED_FORWARDED_PROPS so clients can use the preferred API alongside the legacy `max_thinking_tokens` option. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0b76c72 commit bdd51a5

2 files changed

Lines changed: 20 additions & 13 deletions

File tree

components/runners/ambient-runner/ag_ui_claude_sdk/adapter.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class ClaudeAgentAdapter:
137137
Forwarded Props Support:
138138
Per-run overrides for execution control without changing agent identity.
139139
Whitelisted keys include: resume, fork_session, model, temperature, max_tokens,
140-
max_thinking_tokens, max_turns, max_budget_usd, output_format, etc.
140+
thinking, max_thinking_tokens, max_turns, max_budget_usd, output_format, etc.
141141
142142
Example:
143143
RunAgentInput(
@@ -770,12 +770,16 @@ def flush_pending_msg():
770770
current_reasoning_id = str(uuid.uuid4())
771771
ts = now_ms()
772772
yield ReasoningStartEvent(
773-
threadId=thread_id, runId=run_id,
774-
messageId=current_reasoning_id, timestamp=ts,
773+
threadId=thread_id,
774+
runId=run_id,
775+
messageId=current_reasoning_id,
776+
timestamp=ts,
775777
)
776778
yield ReasoningMessageStartEvent(
777-
threadId=thread_id, runId=run_id,
778-
messageId=current_reasoning_id, timestamp=ts,
779+
threadId=thread_id,
780+
runId=run_id,
781+
messageId=current_reasoning_id,
782+
timestamp=ts,
779783
)
780784
elif block_type == "tool_use":
781785
# Tool call starting - emit TOOL_CALL_START
@@ -807,12 +811,16 @@ def flush_pending_msg():
807811
in_thinking_block = False
808812
ts = now_ms()
809813
yield ReasoningMessageEndEvent(
810-
threadId=thread_id, runId=run_id,
811-
messageId=current_reasoning_id, timestamp=ts,
814+
threadId=thread_id,
815+
runId=run_id,
816+
messageId=current_reasoning_id,
817+
timestamp=ts,
812818
)
813819
yield ReasoningEndEvent(
814-
threadId=thread_id, runId=run_id,
815-
messageId=current_reasoning_id, timestamp=ts,
820+
threadId=thread_id,
821+
runId=run_id,
822+
messageId=current_reasoning_id,
823+
timestamp=ts,
816824
)
817825

818826
# Persist thinking content as ReasoningMessage per AG-UI spec.
@@ -1126,9 +1134,7 @@ def flush_pending_msg():
11261134
yield ReasoningMessageEndEvent(
11271135
threadId=thread_id, runId=run_id, timestamp=ts
11281136
)
1129-
yield ReasoningEndEvent(
1130-
threadId=thread_id, runId=run_id, timestamp=ts
1131-
)
1137+
yield ReasoningEndEvent(threadId=thread_id, runId=run_id, timestamp=ts)
11321138
in_thinking_block = False
11331139

11341140
if has_streamed_text and current_message_id:

components/runners/ambient-runner/ag_ui_claude_sdk/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"fallback_model", # Fallback if primary fails
1717
"temperature", # Sampling temperature
1818
"max_tokens", # Response length limit
19-
"max_thinking_tokens", # Reasoning depth limit
19+
"max_thinking_tokens", # Reasoning depth limit (legacy, prefer thinking)
20+
"thinking", # Thinking config: {"type": "adaptive"} | {"type": "enabled", "budget_tokens": N} | {"type": "disabled"}
2021
"max_turns", # Conversation turn limit
2122
"max_budget_usd", # Cost limit per run
2223
# Output control

0 commit comments

Comments
 (0)