diff --git a/openhands/controller/agent_controller.py b/openhands/controller/agent_controller.py index d4f872ed54be..216f9d6022ff 100644 --- a/openhands/controller/agent_controller.py +++ b/openhands/controller/agent_controller.py @@ -89,7 +89,6 @@ def __init__( is_delegate: bool = False, headless_mode: bool = True, status_callback: Callable | None = None, - max_input_tokens: int | None = None, ): """Initializes a new instance of the AgentController class. @@ -112,10 +111,6 @@ def __init__( self.agent = agent self.headless_mode = headless_mode - # Set max input tokens if provided - if max_input_tokens is not None: - self.agent.llm.config.max_input_tokens = max_input_tokens - # subscribe to the event stream self.event_stream = event_stream self.event_stream.subscribe( diff --git a/tests/unit/test_truncation.py b/tests/unit/test_truncation.py index c1f0f8ee2985..5535d520b3be 100644 --- a/tests/unit/test_truncation.py +++ b/tests/unit/test_truncation.py @@ -190,8 +190,11 @@ def test_history_restoration_after_truncation(self, mock_event_stream, mock_agen def test_context_window_parameter_truncation(self, mock_event_stream, mock_agent): # Configure mock agent's LLM to return specific token counts mock_agent.llm.get_token_count.return_value = 100 + + # Set max_input_tokens in LLM config + mock_agent.llm.config.max_input_tokens = 80 - # Create controller with context window of 80 tokens + # Create controller controller = AgentController( agent=mock_agent, event_stream=mock_event_stream, @@ -199,7 +202,6 @@ def test_context_window_parameter_truncation(self, mock_event_stream, mock_agent sid='test_truncation', confirmation_mode=False, headless_mode=True, - max_input_tokens=80, ) # Create initial events