def initialize_runtime(
    runtime: Runtime,
    instance: pd.Series,
):
    """Initialize the runtime for the agent.

    This function is called before the runtime is used to run the agent.
    """
    logger.info(f'\n{"-" * 50} BEGIN Runtime Initialization Fn {"-" * 50}\n')
    obs: CmdOutputObservation

    # Set instance id
    action = CmdRunAction(command='mkdir -p /workspace')
    logger.info(action, extra={'msg_type': 'ACTION'})
    obs = runtime.run_action(action)
    assert obs.exit_code == 0

    action = CmdRunAction(command='cd /workspace')
    logger.info(action, extra={'msg_type': 'ACTION'})
    obs = runtime.run_action(action)
    assert obs.exit_code == 0

    with tempfile.TemporaryDirectory() as tmpdir:
        file_path = os.path.join(tmpdir, f'{instance.instance_name}.py')
        with open(file_path, 'w') as f:
            f.write(instance.signature)
        runtime.copy_to(
            file_path,
            '/workspace',
        )
        if USE_UNIT_TESTS:
            file_path = os.path.join(tmpdir, f'{instance.instance_name}_test.py')
            with open(file_path, 'w') as f:
                f.write(instance.test)
            runtime.copy_to(
                file_path,
                '/workspace',
            )
    logger.info(f'\n{"-" * 50} END Runtime Initialization Fn {"-" * 50}\n')
Initialize the runtime for the agent.

    This function is called before the runtime is used to run the agent.
    
evaluation/benchmarks/aider_bench/run_infer.py