Repository: All-Hands-AI/OpenHands
File: openhands/app_server/app_conversation/live_status_app_conversation_service.py (Python)

Code before:
            if tavily_api_key:
                _logger.info('Adding search engine to MCP config')
                mcp_config['tavily'] = {
                    'url': f'https://mcp.tavily.com/mcp/?tavilyApiKey={tavily_api_key}'
                }
            else:
                _logger.info('No search engine API key found, skipping search engine')

        return llm, mcp_config

    def _create_agent_with_context(
        self,
        llm: LLM,
        agent_type: AgentType,
        system_message_suffix: str | None,
        mcp_config: dict,
        user: UserInfo,
    ) -> Agent:
        """Create an agent with appropriate tools and context based on agent type.

        Args:
            llm: Configured LLM instance
            agent_type: Type of agent to create (PLAN or DEFAULT)
            system_message_suffix: Optional suffix for system messages
            mcp_config: MCP configuration dictionary
            user: User information containing settings like condenser_max_size

        Returns:
            Configured Agent instance with context
        """
        # Create condenser with user's settings
        condenser = self._create_condenser(llm, agent_type, user)

        # Create agent based on type
        if agent_type == AgentType.PLAN:
            agent = Agent(
                llm=llm,
                tools=get_planning_tools(),
                system_prompt_filename='system_prompt_planning.j2',
                system_prompt_kwargs={'plan_structure': format_plan_structure()},
                condenser=condenser,
                security_analyzer=None,
                mcp_config=mcp_config,
            )
        else:
            agent = Agent(
                llm=llm,
                tools=get_default_tools(enable_browser=True),
                system_prompt_kwargs={'cli_mode': False},
                condenser=condenser,
                mcp_config=mcp_config,

Review comment (suggestion):
```suggestion
            settings: Settings like condenser_max_size
```
Totally a nit, but we were really going in the opposite direction here with some PRs (like the org PR), where we consider "user stuff" to be just "stuff". It seems to me now that it's unfortunate that we have a model named `UserInfo` that doesn't really mean user info, it really means `Settings + an optional user id`. IMHO that sounds like... Settings, not user.

I see you were using heavily that model class in the latest PRs... and that's understandable, I'm just thinking out loud that we probably could rethink that model class or its place in OH.

Code after:
            if tavily_api_key:
                _logger.info('Adding search engine to MCP config')
                mcp_config['tavily'] = {
                    'url': f'https://mcp.tavily.com/mcp/?tavilyApiKey={tavily_api_key}'
                }
            else:
                _logger.info('No search engine API key found, skipping search engine')

        return llm, mcp_config

    def _create_agent_with_context(
        self,
        llm: LLM,
        agent_type: AgentType,
        system_message_suffix: str | None,
        mcp_config: dict,
        condenser_max_size: int | None,
    ) -> Agent:
        """Create an agent with appropriate tools and context based on agent type.

        Args:
            llm: Configured LLM instance
            agent_type: Type of agent to create (PLAN or DEFAULT)
            system_message_suffix: Optional suffix for system messages
            mcp_config: MCP configuration dictionary
            condenser_max_size: condenser_max_size setting

        Returns:
            Configured Agent instance with context
        """
        # Create condenser with user's settings
        condenser = self._create_condenser(llm, agent_type, condenser_max_size)

        # Create agent based on type
        if agent_type == AgentType.PLAN:
            agent = Agent(
                llm=llm,
                tools=get_planning_tools(),
                system_prompt_filename='system_prompt_planning.j2',
                system_prompt_kwargs={'plan_structure': format_plan_structure()},
                condenser=condenser,
                security_analyzer=None,
                mcp_config=mcp_config,
            )
        else:
            agent = Agent(
                llm=llm,
                tools=get_default_tools(enable_browser=True),
                system_prompt_kwargs={'cli_mode': False},
                condenser=condenser,
                mcp_config=mcp_config,