Skip to content

Commit 64f10f8

Browse files
cursoragentdhuang
andcommitted
Refactor: Allow MCP config path to be passed to AgentRolloutProcessor
Co-authored-by: dhuang <dhuang@fireworks.ai>
1 parent b4f8a5b commit 64f10f8

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

eval_protocol/pytest/default_agent_rollout_processor.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,21 @@ def _format_tool_message_content(
234234
class AgentRolloutProcessor(RolloutProcessor):
235235
"""Agent rollout processor for tool-calling agents."""
236236

237+
def __init__(self, mcp_config_path: Optional[str] = None):
238+
"""Initialize the agent rollout processor.
239+
240+
Args:
241+
mcp_config_path: Path to MCP configuration file. If provided, this takes
242+
precedence over config.mcp_config_path in __call__.
243+
"""
244+
self.mcp_config_path = mcp_config_path
245+
237246
def __call__(self, rows: List[EvaluationRow], config: RolloutProcessorConfig) -> List[asyncio.Task[EvaluationRow]]:
238247
"""Create agent rollout tasks and return them for external handling."""
239248

240249
semaphore = config.semaphore
250+
# Use instance mcp_config_path if provided, otherwise fall back to config
251+
mcp_config_path = self.mcp_config_path if self.mcp_config_path is not None else config.mcp_config_path
241252

242253
async def process_row(row: EvaluationRow) -> EvaluationRow:
243254
"""Process a single row with agent rollout."""
@@ -246,7 +257,7 @@ async def process_row(row: EvaluationRow) -> EvaluationRow:
246257
agent = Agent(
247258
model=row.input_metadata.completion_params["model"],
248259
row=row,
249-
config_path=config.mcp_config_path,
260+
config_path=mcp_config_path,
250261
logger=config.logger,
251262
)
252263
try:

tests/pytest/test_pytest_mcp_url.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@
2020
]
2121
]
2222
],
23-
rollout_processor=AgentRolloutProcessor(),
23+
rollout_processor=AgentRolloutProcessor(mcp_config_path="tests/pytest/mcp_configurations/docs_mcp_config.json"),
2424
completion_params=[{"model": "fireworks_ai/accounts/fireworks/models/kimi-k2-instruct"}],
2525
mode="pointwise",
26-
mcp_config_path="tests/pytest/mcp_configurations/docs_mcp_config.json",
2726
)
2827
def test_pytest_mcp_url(row: EvaluationRow) -> EvaluationRow:
2928
"""Run math evaluation on sample dataset using pytest interface."""

0 commit comments

Comments
 (0)