def test_finalize_config_no_agents_defined():
    """
    Test that finalize_config runs without error if no agents are defined in the config,
    even when runtime is 'cli'.
    """
    app_config = OpenHandsConfig()
    app_config.runtime = 'cli'
    # No agents are added to app_config.agents

    try:
        finalize_config(app_config)
    except Exception as e:
        pytest.fail(f'finalize_config raised an exception with no agents defined: {e}')

    Test that finalize_config runs without error if no agents are defined in the config,
    even when runtime is 'cli'.
    
tests/unit/core/config/test_config_utils.py