Problem
ReActReasoning currently triggers two separate LLM completions per agent step:
A "planning" pass to generate a thought.
An "execution" pass to translate that thought into a tool call.
This "Reasoning Tax" doubles latency and increases token costs significantly for every simulation step.
Proposed Optimization
Refactor aplan() to use a single agenerate call with native tool_choice="auto". This allows the model to provide reasoning in the message content and the action in the tool calls simultaneously.
Verification Results
I have verified this optimization with a benchmark script (tests/verify_tax.py):
Current: 2 LLM calls per step.
Refactored: 1 LLM call per step.
Latency Reduction: ~50%.
I have a fix ready and will submit a PR immediately.
Problem
ReActReasoningcurrently triggers two separate LLM completions per agent step:A "planning" pass to generate a thought.
An "execution" pass to translate that thought into a tool call.
This "Reasoning Tax" doubles latency and increases token costs significantly for every simulation step.
Proposed Optimization
Refactor
aplan()to use a singleageneratecall with nativetool_choice="auto". This allows the model to provide reasoning in the message content and the action in the tool calls simultaneously.Verification Results
I have verified this optimization with a benchmark script (
tests/verify_tax.py):Current: 2 LLM calls per step.
Refactored: 1 LLM call per step.
Latency Reduction: ~50%.
I have a fix ready and will submit a PR immediately.