mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
[eval]: disable MCP for SWE-Bench evaluation (#8574)
Co-authored-by: openhands <openhands@all-hands.dev> Co-authored-by: Engel Nyst <enyst@users.noreply.github.com> Co-authored-by: Engel Nyst <engel.nyst@gmail.com>
This commit is contained in:
parent
0b26174d60
commit
2ecc39ffcc
@ -261,6 +261,7 @@ def get_config(
|
||||
enable_jupyter=False,
|
||||
enable_browsing=RUN_WITH_BROWSING,
|
||||
enable_llm_editor=False,
|
||||
enable_mcp=False,
|
||||
condenser=metadata.condenser_config,
|
||||
enable_prompt_extensions=False,
|
||||
)
|
||||
|
||||
@ -251,7 +251,8 @@ async def run_session(
|
||||
)
|
||||
|
||||
# Add MCP tools to the agent
|
||||
await add_mcp_tools_to_agent(agent, runtime, memory, config.mcp)
|
||||
if agent.config.enable_mcp:
|
||||
await add_mcp_tools_to_agent(agent, runtime, memory, config.mcp)
|
||||
|
||||
# Clear loading animation
|
||||
is_loaded.set()
|
||||
|
||||
@ -28,6 +28,8 @@ class AgentConfig(BaseModel):
|
||||
"""Whether to enable finish tool"""
|
||||
enable_prompt_extensions: bool = Field(default=True)
|
||||
"""Whether to enable prompt extensions"""
|
||||
enable_mcp: bool = Field(default=True)
|
||||
"""Whether to enable MCP tools"""
|
||||
disabled_microagents: list[str] = Field(default_factory=list)
|
||||
"""A list of microagents to disable (by name, without .py extension, e.g. ["github", "lint"]). Default is None."""
|
||||
enable_history_truncation: bool = Field(default=True)
|
||||
|
||||
@ -129,7 +129,8 @@ async def run_controller(
|
||||
)
|
||||
|
||||
# Add MCP tools to the agent
|
||||
await add_mcp_tools_to_agent(agent, runtime, memory, config.mcp)
|
||||
if agent.config.enable_mcp:
|
||||
await add_mcp_tools_to_agent(agent, runtime, memory, config.mcp)
|
||||
|
||||
replay_events: list[Event] | None = None
|
||||
if config.replay_trajectory_path:
|
||||
|
||||
@ -149,7 +149,7 @@ class AgentSession:
|
||||
|
||||
# NOTE: this needs to happen before controller is created
|
||||
# so MCP tools can be included into the SystemMessageAction
|
||||
if self.runtime and runtime_connected:
|
||||
if self.runtime and runtime_connected and agent.config.enable_mcp:
|
||||
await add_mcp_tools_to_agent(agent, self.runtime, self.memory, config.mcp)
|
||||
|
||||
if replay_json:
|
||||
|
||||
@ -57,6 +57,10 @@ def mock_agent():
|
||||
agent.llm.metrics = Metrics()
|
||||
agent.llm.config = AppConfig().get_llm_config()
|
||||
|
||||
# Add config with enable_mcp attribute
|
||||
agent.config = MagicMock(spec=AgentConfig)
|
||||
agent.config.enable_mcp = True
|
||||
|
||||
# Add a proper system message mock
|
||||
system_message = SystemMessageAction(
|
||||
content='Test system message', tools=['test_tool']
|
||||
|
||||
@ -35,6 +35,7 @@ def mock_agent():
|
||||
|
||||
# Configure the agent config
|
||||
agent_config.disabled_microagents = []
|
||||
agent_config.enable_mcp = True
|
||||
|
||||
# Set up the chain of mocks
|
||||
llm.metrics = metrics
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user