Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion eval_protocol/pytest/default_agent_rollout_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,21 @@ def _format_tool_message_content(
class AgentRolloutProcessor(RolloutProcessor):
"""Agent rollout processor for tool-calling agents."""

def __init__(self, mcp_config_path: Optional[str] = None):
"""Initialize the agent rollout processor.

Args:
mcp_config_path: Path to MCP configuration file. If provided, this takes
precedence over config.mcp_config_path in __call__.
"""
self.mcp_config_path = mcp_config_path

def __call__(self, rows: List[EvaluationRow], config: RolloutProcessorConfig) -> List[asyncio.Task[EvaluationRow]]:
"""Create agent rollout tasks and return them for external handling."""

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

async def process_row(row: EvaluationRow) -> EvaluationRow:
"""Process a single row with agent rollout."""
Expand All @@ -246,7 +257,7 @@ async def process_row(row: EvaluationRow) -> EvaluationRow:
agent = Agent(
model=row.input_metadata.completion_params["model"],
row=row,
config_path=config.mcp_config_path,
config_path=mcp_config_path,
logger=config.logger,
)
try:
Expand Down
3 changes: 1 addition & 2 deletions tests/pytest/test_pytest_mcp_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
]
]
],
rollout_processor=AgentRolloutProcessor(),
rollout_processor=AgentRolloutProcessor(mcp_config_path="tests/pytest/mcp_configurations/docs_mcp_config.json"),
completion_params=[{"model": "fireworks_ai/accounts/fireworks/models/kimi-k2-instruct"}],
mode="pointwise",
mcp_config_path="tests/pytest/mcp_configurations/docs_mcp_config.json",
)
def test_pytest_mcp_url(row: EvaluationRow) -> EvaluationRow:
"""Run math evaluation on sample dataset using pytest interface."""
Expand Down
Loading