Add a sanity test for load_app_config and get_agent_config_arg (#6723)

This commit is contained in:
Boxuan Li 2025-02-14 21:01:42 -08:00 committed by GitHub
parent 63565982aa
commit efbff2e655
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,6 +11,7 @@ from openhands.core.config import (
finalize_config,
get_agent_config_arg,
get_llm_config_arg,
load_app_config,
load_from_env,
load_from_toml,
)
@ -811,3 +812,29 @@ memory_max_threads = 10
assert not agent_config2.memory_enabled
assert agent_config2.enable_prompt_extensions
assert agent_config2.memory_max_threads == 10
def test_agent_config_custom_group_name(temp_toml_file):
temp_toml = """
[core]
max_iterations = 99
[agent.group1]
memory_enabled = true
[agent.group2]
memory_enabled = false
"""
with open(temp_toml_file, 'w') as f:
f.write(temp_toml)
# just a sanity check that load app config wouldn't fail
app_config = load_app_config(config_file=temp_toml_file)
assert app_config.max_iterations == 99
# run_infer in evaluation can use `get_agent_config_arg` to load custom
# agent configs with any group name (not just agent name)
agent_config1 = get_agent_config_arg('group1', temp_toml_file)
assert agent_config1.memory_enabled
agent_config2 = get_agent_config_arg('group2', temp_toml_file)
assert not agent_config2.memory_enabled