MCPcopy Create free account
hub / github.com/InternScience/InternAgent / perform_experiments

Function perform_experiments

internagent/experiments_utils_claude.py:307–433  ·  view source on GitHub ↗

Perform multi-round experiments using Claude Code. Args: idea: The idea to implement folder_name: The folder to work in proxy_settings: Optional proxy settings for Claude model: Model name to use gpu_ids: GPU IDs to use (string like "0,1" or None for

(
    idea,
    folder_name,
    proxy_settings=None,
    model='claude-sonnet-4-5-20250929',
    gpu_ids=None,
    max_runs=None,
    log_file=None,
    task_type='auto',
    task_info=None,
    checklist=None,
    sci_scorer_model='gpt-5.1',
    run_timeout=None,
)

Source from the content-addressed store, hash-verified

305
306
307def perform_experiments(
308 idea,
309 folder_name,
310 proxy_settings=None,
311 model='claude-sonnet-4-5-20250929',
312 gpu_ids=None,
313 max_runs=None,
314 log_file=None,
315 task_type='auto',
316 task_info=None,
317 checklist=None,
318 sci_scorer_model='gpt-5.1',
319 run_timeout=None,
320) -> bool:
321 """
322 Perform multi-round experiments using Claude Code.
323
324 Args:
325 idea: The idea to implement
326 folder_name: The folder to work in
327 proxy_settings: Optional proxy settings for Claude
328 model: Model name to use
329 gpu_ids: GPU IDs to use (string like "0,1" or None for CPU)
330 max_runs: Maximum number of runs (default: uses MAX_RUNS constant)
331 log_file: Optional file object to write logs to
332 task_type: 'auto' for standard tasks, 'sci' for paper reproduction tasks
333 task_info: For sci tasks — parsed task_info.json dict (task description, data)
334 checklist: For sci tasks — parsed checklist.json list
335 sci_scorer_model: Model to use for LLM-as-judge scoring of sci tasks
336
337 Returns:
338 True if experiments completed successfully, False otherwise
339 """
340 def log_message(msg):
341 """Write message to both stdout and log file"""
342 print(msg)
343 sys.stdout.flush()
344 if log_file:
345 try:
346 log_file.write(msg + "\n")
347 log_file.flush()
348 except (ValueError, OSError):
349 pass
350
351 # Use provided max_runs or fall back to default
352 if max_runs is None:
353 max_runs = MAX_RUNS
354
355 timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
356 logger.info(f"[{timestamp}] Starting {task_type} experiments for idea in {folder_name}")
357 if gpu_ids:
358 logger.info(f"[{timestamp}] Using GPUs: {gpu_ids}")
359
360 current_iter = 0
361 run = 1
362
363 # Initialize Claude Code runner
364 claude_runner = ClaudeCodeRunner(proxy_settings, model=model)

Callers

nothing calls this directly

Calls 10

runMethod · 0.95
ClaudeCodeRunnerClass · 0.85
_handle_sci_run_scoringFunction · 0.85
writeMethod · 0.80
formatMethod · 0.80
extract_idea_infoFunction · 0.70
log_messageFunction · 0.70
run_experimentFunction · 0.70

Tested by

no test coverage detected