From 231204d0c87e6fb2abcfd3af0689ffa320d840f7 Mon Sep 17 00:00:00 2001 From: Isadora White Date: Sun, 26 Jan 2025 11:39:21 -0800 Subject: [PATCH 1/9] using environment variables to help differentiate the settings.js files :D --- evaluation_script.py | 323 +++++++++++++++++++++++++++++++++++++++++++ settings.js | 6 +- 2 files changed, 326 insertions(+), 3 deletions(-) create mode 100644 evaluation_script.py diff --git a/evaluation_script.py b/evaluation_script.py new file mode 100644 index 0000000..634a8bd --- /dev/null +++ b/evaluation_script.py @@ -0,0 +1,323 @@ +import argparse +import json +import shutil +import subprocess +import time +from datetime import datetime +import re +import sys +import os +import time + +def read_settings(file_path): + """Read and parse the settings.js file to get agent profiles.""" + with open(file_path, 'r', encoding='utf-8') as file: + content = file.read() + + # Remove `export default` and trailing commas + content = re.sub(r'export\s+default', '', content) + content = re.sub(r',\s*(?=[}\]])', '', content) + + # Remove JavaScript comments + content = re.sub(r'//.*', '', content) + + # Remove trailing commas (e.g., before } or ]) + content = re.sub(r',\s*(?=[}\]])', '', content) + + # Strip leading and trailing whitespace + content = content.strip() + + json_data = json.loads(content) + + profiles = json_data['profiles'] + + ## profiles is a list of strings like "./andy.json" and "./bob.json" + + agent_names = [profile.split('/')[-1].split('.')[0] for profile in profiles] + return agent_names + +def check_task_completion(agents): + """Check memory.json files of all agents to determine task success/failure.""" + for agent in agents: + memory_path = f"bots/{agent}/memory.json" + try: + with open(memory_path, 'r') as f: + memory = json.load(f) + + # Check the last system message in turns + for turn in reversed(memory['turns']): + if turn['role'] == 'system' and 'code' in turn['content']: + # Extract completion code + if 'code : 2' in turn['content']: + return True # Task successful + elif 'code : 4' in turn['content']: + return False # Task failed + + except (FileNotFoundError, json.JSONDecodeError) as e: + print(f"Error reading memory for agent {agent}: {e}") + continue + + return False # Default to failure if no conclusive result found + +def update_results_file(task_id, success_count, total_count, time_taken, experiment_results): + """Update the results file with current success ratio and time taken.""" + timestamp = datetime.now().strftime('%Y%m%d_%H%M%S') + filename = f"results_{task_id}_{timestamp}.txt" + + success_ratio = success_count / total_count + + with open(filename, 'w') as f: + f.write(f"Task ID: {task_id}\n") + f.write(f"Experiments completed: {total_count}\n") + f.write(f"Successful experiments: {success_count}\n") + f.write(f"Success ratio: {success_ratio:.2f}\n") + f.write(f"Time taken for last experiment: {time_taken:.2f} seconds\n") + + # Write individual experiment results + for i, result in enumerate(experiment_results, 1): + f.write(f"Experiment {i}: {'Success' if result['success'] else 'Failure'}, Time taken: {result['time_taken']:.2f} seconds\n") + + # Write aggregated metrics + total_time = sum(result['time_taken'] for result in experiment_results) + f.write(f"\nAggregated metrics:\n") + f.write(f"Total experiments: {total_count}\n") + f.write(f"Total successful experiments: {success_count}\n") + f.write(f"Overall success ratio: {success_ratio:.2f}\n") + f.write(f"Total time taken: {total_time:.2f} seconds\n") + f.write(f"Average time per experiment: {total_time / total_count:.2f} seconds\n") + f.write(f"Last updated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n") + +def launch_server_experiment(task_path, task_id, num_exp, server, num_agents=2, model="gpt-4o"): + server_path, server_port = server + edit_file(os.path.join(server_path, "server.properties"), {"server-port": server_port}) + mindserver_port = server_port - 55916 + 8080 + + # rename the agents for logging purposes + # TODO: fix the file naming procedure + # copy the memory.json into a new folder for each run based on the date and time + + + session_name = str(server_port - 55916) + if num_agents == 2: + agent_names = [f"andy_{session_name}", f"jill_{session_name}"] + models = [model] * 2 + else: + agent_names = [f"andy_{session_name}", f"jill_{session_name}", f"bob_{session_name}"] + models = [model] * 3 + make_profiles(agent_names, models) + + # edit_file("settings.js", {"profiles": [f"./{agent}.json" for agent in agent_names]}) + agent_profiles = [f"./{agent}.json" for agent in agent_names] + agent_profiles_str = f"\'[\"{agent_profiles[0]}\", \"{agent_profiles[1]}\"]\'" + print(agent_profiles_str) + launch_world(server_path, session_name="server_" + session_name, agent_names=agent_names) + + subprocess.run(['tmux', 'new-session', '-d', '-s', session_name], check=True) + + # set environment variables + subprocess.run(["tmux", "send-keys", "-t", session_name, f"export MINECRAFT_PORT={server_port}", "C-m"]) + subprocess.run(["tmux", "send-keys", "-t", session_name, f"export MINDSERVER_PORT={mindserver_port}", "C-m"]) + subprocess.run(["tmux", "send-keys", "-t", session_name, f"export PROFILES={agent_profiles_str}", "C-m"]) + + cmd = f"node main.js --task_path {task_path} --task_id {task_id}" + for _ in range(num_exp): + # Send the command and a newline (C-m) to execute it + subprocess.run(["tmux", "send-keys", "-t", session_name, cmd, "C-m"]) + # Add a small delay between commands (optional) + subprocess.run(["tmux", "send-keys", "-t", session_name, "sleep 1", "C-m"]) + + # subprocess.run(["tmux", "send-keys", "-t", session_name, f"/op {agent_names[0]}", "C-m"]) + +def make_profiles(agent_names, models): + assert len(agent_names) == len(models) + for index in range(len(agent_names)): + content = {"name": agent_names[index], "model": models[index], "modes": {"hunting": False}} + with open(f"{agent_names[index]}.json", 'w') as f: + json.dump(content, f) + +def create_server_files(source_path, num_copies): + """Create multiple copies of server files for parallel experiments.""" + servers = [] + for i in range(num_copies): + dest_path = f"../server_data_{i}/" + copy_server_files(source_path, dest_path) + edit_file(dest_path, {"server-port": 55916 + i}) + # edit_server_properties_file(dest_path, 55916 + i) + servers.append((dest_path, 55916 + i)) + return servers + +# def edit_server_properties_file(dest_path, new_port): +# """Edit the server properties file to change the port.""" +# properties_file = os.path.join(dest_path, "server.properties") +# try: +# with open(properties_file, 'r') as f: +# lines = f.readlines() +# with open(properties_file, 'w') as f: +# for line in lines: +# if line.startswith("server-port="): +# f.write(f"server-port={new_port}\n") +# else: +# f.write(line) +# print(f"Server properties file updated with new port: {new_port}") +# except Exception as e: +# print(f"Error editing server properties file: {e}") + +def edit_file(file, content_dict): + try: + with open(file, 'r') as f: + lines = f.readlines() + with open(file, 'w') as f: + for line in lines: + for key, value in content_dict.items(): + if line.startswith(key): + f.write(f"{key}={value}\n") + else: + f.write(line) + print(f"{file} updated with {content_dict}") + except Exception as e: + print(f"Error editing file {file}: {e}") + +def clean_up_server_files(num_copies): + """Delete server files from multiple locations.""" + for i in range(num_copies): + dest_path = f"../server_data_{i}/" + delete_server_files(dest_path) + +def copy_server_files(source_path, dest_path): + """Copy server files to the specified location.""" + try: + shutil.copytree(source_path, dest_path) + print(f"Server files copied to {dest_path}") + except Exception as e: + print(f"Error copying server files: {e}") + +def delete_server_files(dest_path): + """Delete server files from the specified location.""" + try: + shutil.rmtree(dest_path) + print(f"Server files deleted from {dest_path}") + except Exception as e: + print(f"Error deleting server files: {e}") + +def launch_world(server_path="../server_data/", agent_names=["andy", "jill"], session_name="server"): + """Launch the Minecraft world.""" + print(server_path) + cmd = f"cd {server_path} && java -jar server.jar" + subprocess.run(['tmux', 'new-session', '-d', '-s', session_name], check=True) + subprocess.run(["tmux", "send-keys", "-t", session_name, cmd, "C-m"]) + for agent in agent_names: + subprocess.run(["tmux", "send-keys", "-t", session_name, f"/op {agent}", "C-m"]) + time.sleep(5) + +def detach_process(command): + """ + Launches a subprocess and detaches from it, allowing it to run independently. + + Args: + command: A list of strings representing the command to execute, e.g., ['python', 'my_script.py']. + """ + + try: + # Create a new process group so the child doesn't get signals intended for the parent. + # This is crucial for proper detachment. + kwargs = {} + if sys.platform == 'win32': + kwargs.update(creationflags=subprocess.CREATE_NEW_PROCESS_GROUP) # Windows specific + + process = subprocess.Popen(command, + stdin=subprocess.PIPE, # Prevent stdin blocking + stdout=subprocess.PIPE, # Redirect stdout + stderr=subprocess.PIPE, # Redirect stderr + close_fds=True, # Close open file descriptors + **kwargs) + + print(f"Process launched with PID: {process.pid}") + return process.pid # Return the PID of the detached process + + except FileNotFoundError: + print(f"Error: Command not found: {command}") + return None + except Exception as e: + print(f"An error occurred: {e}") + return None + + +def run_experiment(task_path, task_id, num_exp): + """Run the specified number of experiments and track results.""" + # Read agent profiles from settings.js + agents = read_settings(file_path="settings.js") + print(f"Detected agents: {agents}") + + success_count = 0 + experiment_results = [] + + for exp_num in range(num_exp): + print(f"\nRunning experiment {exp_num + 1}/{num_exp}") + + start_time = time.time() + + # Run the node command + cmd = f"node main.js --task_path {task_path} --task_id {task_id}" + try: + subprocess.run(cmd, shell=True, check=True) + except subprocess.CalledProcessError as e: + print(f"Error running experiment: {e}") + continue + + # Check if task was successful + success = check_task_completion(agents) + if success: + success_count += 1 + print(f"Experiment {exp_num + 1} successful") + else: + print(f"Experiment {exp_num + 1} failed") + + end_time = time.time() + time_taken = end_time - start_time + + # Store individual experiment result + experiment_results.append({ + 'success': success, + 'time_taken': time_taken + }) + + # Update results file after each experiment + update_results_file(task_id, success_count, exp_num + 1, time_taken, experiment_results) + + # Small delay between experiments + time.sleep(1) + + final_ratio = success_count / num_exp + print(f"\nExperiments completed. Final success ratio: {final_ratio:.2f}") + return experiment_results + +def main(): + # edit_settings("settings.js", {"profiles": ["./andy.json", "./jill.json"], "port": 55917}) + # edit_server_properties_file("../server_data/", 55917) + + parser = argparse.ArgumentParser(description='Run Minecraft AI agent experiments') + parser.add_argument('--task_path', default="example_tasks.json", help='Path to the task file') + parser.add_argument('--task_id', default="multiagent_techtree_1_stone_pickaxe", help='ID of the task to run') + parser.add_argument('--num_exp', default=5, type=int, help='Number of experiments to run') + parser.add_argument('--num_parallel', default=0, type=int, help='Number of parallel servers to run') + + args = parser.parse_args() + + # kill all tmux session before starting + try: + subprocess.run(['tmux', 'kill-server'], check=True) + except: + print("No tmux session to kill") + if args.num_parallel == 0: + launch_world() + run_experiment(args.task_path, args.task_id, args.num_exp) + else: + servers = create_server_files("../server_data/", args.num_parallel) + for server in servers: + launch_server_experiment(args.task_path, args.task_id, args.num_exp, server) + time.sleep(5) + + # run_experiment(args.task_path, args.task_id, args.num_exp) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/settings.js b/settings.js index 761e3cb..ddd5715 100644 --- a/settings.js +++ b/settings.js @@ -2,15 +2,15 @@ export default { "minecraft_version": "1.20.4", // supports up to 1.21.1 "host": "127.0.0.1", // or "localhost", "your.ip.address.here" - "port": 55916, + "port": process.env.MINECRAFT_PORT || 55916, "auth": "offline", // or "microsoft" // the mindserver manages all agents and hosts the UI "host_mindserver": true, // if true, the mindserver will be hosted on this machine. otherwise, specify a public IP address "mindserver_host": "localhost", - "mindserver_port": 8080, + "mindserver_port": process.env.MINDSERVER_PORT || 8080, - "profiles": [ + "profiles": JSON.parse(process.env.PROFILES) || [ "./andy.json", // "./profiles/gpt.json", // "./profiles/claude.json", From caa5c389e7fbad5da8255e1f542c942d8492249c Mon Sep 17 00:00:00 2001 From: Isadora White Date: Fri, 31 Jan 2025 12:57:38 -0800 Subject: [PATCH 2/9] logging messages --- evaluation_script.py | 47 ++++++++++++++++++-------------------------- example_tasks.json | 17 ++++++++++++++++ 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/evaluation_script.py b/evaluation_script.py index 634a8bd..3e08c71 100644 --- a/evaluation_script.py +++ b/evaluation_script.py @@ -87,15 +87,15 @@ def update_results_file(task_id, success_count, total_count, time_taken, experim f.write(f"Average time per experiment: {total_time / total_count:.2f} seconds\n") f.write(f"Last updated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n") -def launch_server_experiment(task_path, task_id, num_exp, server, num_agents=2, model="gpt-4o"): +def set_environment_variable_tmux_session(session_name, key, value): + """Set an environment variable for the current process.""" + subprocess.run(["tmux", "send-keys", "-t", session_name, f"export {key}={value}", "C-m"]) + +def launch_server_experiment(task_path, task_id, num_exp, server, experiments_folder, num_agents=2, model="gpt-4o"): server_path, server_port = server edit_file(os.path.join(server_path, "server.properties"), {"server-port": server_port}) mindserver_port = server_port - 55916 + 8080 - # rename the agents for logging purposes - # TODO: fix the file naming procedure - # copy the memory.json into a new folder for each run based on the date and time - session_name = str(server_port - 55916) if num_agents == 2: @@ -115,14 +115,17 @@ def launch_server_experiment(task_path, task_id, num_exp, server, num_agents=2, subprocess.run(['tmux', 'new-session', '-d', '-s', session_name], check=True) # set environment variables - subprocess.run(["tmux", "send-keys", "-t", session_name, f"export MINECRAFT_PORT={server_port}", "C-m"]) - subprocess.run(["tmux", "send-keys", "-t", session_name, f"export MINDSERVER_PORT={mindserver_port}", "C-m"]) - subprocess.run(["tmux", "send-keys", "-t", session_name, f"export PROFILES={agent_profiles_str}", "C-m"]) + set_environment_variable_tmux_session(session_name, "MINECRAFT_PORT", server_port) + set_environment_variable_tmux_session(session_name, "MINDSERVER_PORT", mindserver_port) + set_environment_variable_tmux_session(session_name, "PROFILES", agent_profiles_str) cmd = f"node main.js --task_path {task_path} --task_id {task_id}" + cp_cmd = f"cp {agent_names[0]}.json {server_path}bots/{agent_names[0]}/profile.json" for _ in range(num_exp): - # Send the command and a newline (C-m) to execute it subprocess.run(["tmux", "send-keys", "-t", session_name, cmd, "C-m"]) + for agent in agent_names: + cp_cmd = f"cp bots/{agent}/memory.json {experiments_folder}/{task_id}_{agent}_{_}.json" + subprocess.run(["tmux", "send-keys", "-t", session_name, cp_cmd, "C-m"]) # Add a small delay between commands (optional) subprocess.run(["tmux", "send-keys", "-t", session_name, "sleep 1", "C-m"]) @@ -145,22 +148,6 @@ def create_server_files(source_path, num_copies): # edit_server_properties_file(dest_path, 55916 + i) servers.append((dest_path, 55916 + i)) return servers - -# def edit_server_properties_file(dest_path, new_port): -# """Edit the server properties file to change the port.""" -# properties_file = os.path.join(dest_path, "server.properties") -# try: -# with open(properties_file, 'r') as f: -# lines = f.readlines() -# with open(properties_file, 'w') as f: -# for line in lines: -# if line.startswith("server-port="): -# f.write(f"server-port={new_port}\n") -# else: -# f.write(line) -# print(f"Server properties file updated with new port: {new_port}") -# except Exception as e: -# print(f"Error editing server properties file: {e}") def edit_file(file, content_dict): try: @@ -297,9 +284,10 @@ def main(): parser = argparse.ArgumentParser(description='Run Minecraft AI agent experiments') parser.add_argument('--task_path', default="example_tasks.json", help='Path to the task file') - parser.add_argument('--task_id', default="multiagent_techtree_1_stone_pickaxe", help='ID of the task to run') - parser.add_argument('--num_exp', default=5, type=int, help='Number of experiments to run') + parser.add_argument('--task_id', default="multiagent_techtree_1_shears", help='ID of the task to run') + parser.add_argument('--num_exp', default=1, type=int, help='Number of experiments to run') parser.add_argument('--num_parallel', default=0, type=int, help='Number of parallel servers to run') + parser.add_argument('--exp_name', default="experiments/exp", help='Name of the experiment') args = parser.parse_args() @@ -313,8 +301,11 @@ def main(): run_experiment(args.task_path, args.task_id, args.num_exp) else: servers = create_server_files("../server_data/", args.num_parallel) + date_time = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") + experiments_folder = f"{args.exp_name}_{date_time}" + os.makedirs(experiments_folder, exist_ok=True) for server in servers: - launch_server_experiment(args.task_path, args.task_id, args.num_exp, server) + launch_server_experiment(args.task_path, args.task_id, args.num_exp, server, experiments_folder) time.sleep(5) # run_experiment(args.task_path, args.task_id, args.num_exp) diff --git a/example_tasks.json b/example_tasks.json index ef81f9b..666f9f1 100644 --- a/example_tasks.json +++ b/example_tasks.json @@ -57,5 +57,22 @@ "number_of_target": 1, "type": "techtree", "timeout": 300 + }, + "multiagent_techtree_1_shears": { + "goal": "Collaborate with other agents to build a shear.", + "conversation": "Let's collaborate to build a shear.", + "agent_count": 2, + "initial_inventory": { + "0": { + "iron_ingot": 1 + }, + "1": { + "iron_ingot": 1 + } + }, + "target": "shears", + "number_of_target": 1, + "type": "techtree", + "timeout": 60 } } \ No newline at end of file From 6e48f06e1da7776b773893e4795a1a2e36d82719 Mon Sep 17 00:00:00 2001 From: Isadora White Date: Wed, 12 Feb 2025 15:39:57 -0800 Subject: [PATCH 3/9] small changes --- andy_0.json | 1 + andy_1.json | 1 + evaluation_script.py | 99 ++++++++++++++----- ...multiagent_techtree_1_shears_andy_0_0.json | 51 ++++++++++ ...multiagent_techtree_1_shears_andy_1_0.json | 47 +++++++++ ...multiagent_techtree_1_shears_jill_0_0.json | 59 +++++++++++ ...multiagent_techtree_1_shears_jill_1_0.json | 47 +++++++++ ...multiagent_techtree_1_shears_andy_0_0.json | 51 ++++++++++ ...multiagent_techtree_1_shears_andy_0_1.json | 55 +++++++++++ ...multiagent_techtree_1_shears_jill_0_0.json | 47 +++++++++ ...multiagent_techtree_1_shears_jill_0_1.json | 47 +++++++++ ...multiagent_techtree_1_shears_andy_0_0.json | 47 +++++++++ ...multiagent_techtree_1_shears_jill_0_0.json | 47 +++++++++ ...multiagent_techtree_1_shears_andy_0_0.json | 47 +++++++++ ...ent_techtree_1_stone_pickaxe_andy_0_0.json | 51 ++++++++++ ...ent_techtree_1_stone_pickaxe_andy_0_1.json | 35 +++++++ ...ent_techtree_1_stone_pickaxe_jill_0_0.json | 51 ++++++++++ ...ent_techtree_1_stone_pickaxe_jill_0_1.json | 59 +++++++++++ jill_0.json | 1 + jill_1.json | 1 + multiagent_crafting_tasks.json | 35 +++++++ settings.js | 2 +- src/agent/agent.js | 2 +- src/agent/tasks.js | 9 +- 24 files changed, 862 insertions(+), 30 deletions(-) create mode 100644 andy_0.json create mode 100644 andy_1.json create mode 100644 experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_andy_0_0.json create mode 100644 experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_andy_1_0.json create mode 100644 experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_jill_0_0.json create mode 100644 experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_jill_1_0.json create mode 100644 experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_andy_0_0.json create mode 100644 experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_andy_0_1.json create mode 100644 experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_jill_0_0.json create mode 100644 experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_jill_0_1.json create mode 100644 experiments/exp_2025-02-10_17-13-42/multiagent_techtree_1_shears_andy_0_0.json create mode 100644 experiments/exp_2025-02-10_17-13-42/multiagent_techtree_1_shears_jill_0_0.json create mode 100644 experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_shears_andy_0_0.json create mode 100644 experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_andy_0_0.json create mode 100644 experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_andy_0_1.json create mode 100644 experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_jill_0_0.json create mode 100644 experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_jill_0_1.json create mode 100644 jill_0.json create mode 100644 jill_1.json create mode 100644 multiagent_crafting_tasks.json diff --git a/andy_0.json b/andy_0.json new file mode 100644 index 0000000..ca379e2 --- /dev/null +++ b/andy_0.json @@ -0,0 +1 @@ +{"name": "andy_0", "model": "gpt-4o", "modes": {"hunting": false}} \ No newline at end of file diff --git a/andy_1.json b/andy_1.json new file mode 100644 index 0000000..9702581 --- /dev/null +++ b/andy_1.json @@ -0,0 +1 @@ +{"name": "andy_1", "model": "gpt-4o", "modes": {"hunting": false}} \ No newline at end of file diff --git a/evaluation_script.py b/evaluation_script.py index 3e08c71..b4c59b2 100644 --- a/evaluation_script.py +++ b/evaluation_script.py @@ -91,12 +91,55 @@ def set_environment_variable_tmux_session(session_name, key, value): """Set an environment variable for the current process.""" subprocess.run(["tmux", "send-keys", "-t", session_name, f"export {key}={value}", "C-m"]) -def launch_server_experiment(task_path, task_id, num_exp, server, experiments_folder, num_agents=2, model="gpt-4o"): +def launch_parallel_experiments(task_path, + num_exp, + server, + experiments_folder, + num_agents=2, + model="gpt-4o", + num_parallel=1): + with open(task_path, 'r', encoding='utf-8') as file: + content = file.read() + json_data = json.loads(content) + + task_ids = json_data.keys() + + # split the task_ids into num_parallel groups + task_ids = list(task_ids) + task_ids_split = [task_ids[i::num_parallel] for i in range(num_parallel)] + + servers = create_server_files("../server_data/", num_parallel) + date_time = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") + experiments_folder = f"{experiments_folder}_{date_time}" + os.makedirs(experiments_folder, exist_ok=True) + for i, server in enumerate(servers): + launch_server_experiment(task_path, task_ids_split[i], num_exp, server, experiments_folder) + time.sleep(5) + + clean_up_server_files(num_parallel) + +def launch_server_experiment(task_path, + task_ids, + num_exp, + server, + experiments_folder, + num_agents=2, + model="gpt-4o"): + """ + Launch a Minecraft server and run experiments on it. + @param task_path: Path to the task file + @param task_ids: IDs of the tasks to run + @param num_exp: Number of experiments to run + @param server: Tuple containing server path and port + @param experiments_folder: Folder to store experiment results + @param num_agents: Number of agents to run + @param model: Model to use for the agents + """ server_path, server_port = server edit_file(os.path.join(server_path, "server.properties"), {"server-port": server_port}) mindserver_port = server_port - 55916 + 8080 - + # set up server and agents session_name = str(server_port - 55916) if num_agents == 2: agent_names = [f"andy_{session_name}", f"jill_{session_name}"] @@ -119,15 +162,16 @@ def launch_server_experiment(task_path, task_id, num_exp, server, experiments_fo set_environment_variable_tmux_session(session_name, "MINDSERVER_PORT", mindserver_port) set_environment_variable_tmux_session(session_name, "PROFILES", agent_profiles_str) - cmd = f"node main.js --task_path {task_path} --task_id {task_id}" - cp_cmd = f"cp {agent_names[0]}.json {server_path}bots/{agent_names[0]}/profile.json" - for _ in range(num_exp): - subprocess.run(["tmux", "send-keys", "-t", session_name, cmd, "C-m"]) - for agent in agent_names: - cp_cmd = f"cp bots/{agent}/memory.json {experiments_folder}/{task_id}_{agent}_{_}.json" - subprocess.run(["tmux", "send-keys", "-t", session_name, cp_cmd, "C-m"]) - # Add a small delay between commands (optional) - subprocess.run(["tmux", "send-keys", "-t", session_name, "sleep 1", "C-m"]) + for task_id in task_ids: + cmd = f"node main.js --task_path {task_path} --task_id {task_id}" + cp_cmd = f"cp {agent_names[0]}.json {server_path}bots/{agent_names[0]}/profile.json" + for _ in range(num_exp): + subprocess.run(["tmux", "send-keys", "-t", session_name, cmd, "C-m"]) + for agent in agent_names: + cp_cmd = f"cp bots/{agent}/memory.json {experiments_folder}/{task_id}_{agent}_{_}.json" + subprocess.run(["tmux", "send-keys", "-t", session_name, cp_cmd, "C-m"]) + # Add a small delay between commands (optional) + subprocess.run(["tmux", "send-keys", "-t", session_name, "sleep 1", "C-m"]) # subprocess.run(["tmux", "send-keys", "-t", session_name, f"/op {agent_names[0]}", "C-m"]) @@ -196,6 +240,12 @@ def launch_world(server_path="../server_data/", agent_names=["andy", "jill"], se subprocess.run(["tmux", "send-keys", "-t", session_name, f"/op {agent}", "C-m"]) time.sleep(5) +def kill_world(session_name="server"): + """Kill the Minecraft world.""" + subprocess.run(["tmux", "send-keys", "-t", session_name, "stop", "C-m"]) + time.sleep(5) + subprocess.run(["tmux", "kill-session", "-t", session_name]) + def detach_process(command): """ Launches a subprocess and detaches from it, allowing it to run independently. @@ -283,10 +333,10 @@ def main(): # edit_server_properties_file("../server_data/", 55917) parser = argparse.ArgumentParser(description='Run Minecraft AI agent experiments') - parser.add_argument('--task_path', default="example_tasks.json", help='Path to the task file') - parser.add_argument('--task_id', default="multiagent_techtree_1_shears", help='ID of the task to run') + parser.add_argument('--task_path', default="multiagent_crafting_tasks.json", help='Path to the task file') + parser.add_argument('--task_id', default=None, help='ID of the task to run') parser.add_argument('--num_exp', default=1, type=int, help='Number of experiments to run') - parser.add_argument('--num_parallel', default=0, type=int, help='Number of parallel servers to run') + parser.add_argument('--num_parallel', default=1, type=int, help='Number of parallel servers to run') parser.add_argument('--exp_name', default="experiments/exp", help='Name of the experiment') args = parser.parse_args() @@ -296,17 +346,16 @@ def main(): subprocess.run(['tmux', 'kill-server'], check=True) except: print("No tmux session to kill") - if args.num_parallel == 0: - launch_world() - run_experiment(args.task_path, args.task_id, args.num_exp) - else: - servers = create_server_files("../server_data/", args.num_parallel) - date_time = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") - experiments_folder = f"{args.exp_name}_{date_time}" - os.makedirs(experiments_folder, exist_ok=True) - for server in servers: - launch_server_experiment(args.task_path, args.task_id, args.num_exp, server, experiments_folder) - time.sleep(5) + if args.task_id is None: + launch_parallel_experiments(args.task_path, args.num_exp, args.num_parallel, args.exp_name) + + # servers = create_server_files("../server_data/", args.num_parallel) + # date_time = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") + # experiments_folder = f"{args.exp_name}_{date_time}" + # os.makedirs(experiments_folder, exist_ok=True) + # for server in servers: + # launch_server_experiment(args.task_path, [args.task_id], args.num_exp, server, experiments_folder) + # time.sleep(5) # run_experiment(args.task_path, args.task_id, args.num_exp) diff --git a/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_andy_0_0.json b/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_andy_0_0.json new file mode 100644 index 0000000..b75566d --- /dev/null +++ b/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_andy_0_0.json @@ -0,0 +1,51 @@ +{ + "memory": "I'm andy_0, a Minecraft bot collaborating with jill_0. Together, we're focused on crafting tasks. Jill shared her resources, and combined with mine, we now have enough iron ingots for shears. I dropped my iron ingot to facilitate this, and we're ready to craft shears together.", + "turns": [ + { + "role": "user", + "content": "jill_0: (FROM OTHER BOT)Nice teamwork! I'll pick it up. !collectBlocks(\"iron_ingot\", 1)Oops! Let me pick it up manually. !nearbyBlocksLooks like I can't detect the ingot on the ground. Could you try dropping it again, Andy? " + }, + { + "role": "assistant", + "content": "No worries! I'll drop it again. !discard(\"iron_ingot\", 1)" + }, + { + "role": "system", + "content": "Code output:\nMoved away from nearest entity to (-111.31984422192826, 71, 30.569636942162468).\nYou do not have any iron_ingot to discard.\nYou have reached at -107.41079554508012, 70, 27.5.\n" + }, + { + "role": "assistant", + "content": "Looks like I made a mistake earlier. Oops! Let me search for another iron ingot nearby. !searchForBlock(\"iron_ore\", 10)" + }, + { + "role": "system", + "content": "Error: Param 'search_range' must be an element of [32, 512)." + }, + { + "role": "assistant", + "content": "Let's extend the search range a bit. !searchForBlock(\"iron_ore\", 100)" + }, + { + "role": "system", + "content": "Code output:\nFound iron_ore at (-110, 65, 21).\nYou have reached at -110, 65, 21.\n" + }, + { + "role": "assistant", + "content": "Found some iron ore! I'll mine it now. !collectBlocks(\"iron_ore\", 1)" + }, + { + "role": "system", + "content": "Code output:\nDon't have right tools to harvest iron_ore.\n" + }, + { + "role": "assistant", + "content": "Oops! I need a pickaxe first. I'll see if I can find or craft one. !nearbyBlocks" + }, + { + "role": "system", + "content": "\nNEARBY_BLOCKS\n- grass_block\n- dirt\n- oak_leaves\n- short_grass\n- stone\n- iron_ore\n- oak_log\n- coal_ore\n- birch_leaves\n- birch_log\n- copper_ore\n- lapis_ore\n- granite\n- pumpkin\n- gravel\n- andesite\n- Block Below: dirt\n- Block at Legs: air\n- Block at Head: air\n- First Solid Block Above Head: none\n" + } + ], + "self_prompt": null, + "last_sender": "jill_0" +} \ No newline at end of file diff --git a/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_andy_1_0.json b/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_andy_1_0.json new file mode 100644 index 0000000..2b61185 --- /dev/null +++ b/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_andy_1_0.json @@ -0,0 +1,47 @@ +{ + "memory": "I am andy_1, a Minecraft bot. I greeted with \"Hello world\" and initiated collaboration with jill_1 to build a shear, asking for help gathering materials.", + "turns": [ + { + "role": "user", + "content": "jill_1: (FROM OTHER BOT)Sure thing, Andy! I'll see what materials I can collect for the shear. !collectBlocks(\"iron_ore\", 2)Oops, I can't mine iron ore yet. Let's smelt the iron ingot I have instead. !smeltItem(\"iron_ingot\", 1)Alright, I already have enough iron ingots. Let's craft the shear instead! !craftRecipe(\"shear\", 1)Looks like I made a mistake! Shears don't need crafting, I can make them directly. !craftableSeems like I need more iron ingots to craft shears. Want to find iron together?" + }, + { + "role": "assistant", + "content": "Sure, let's find some iron together! !searchForBlock(\"iron_ore\", 100)" + }, + { + "role": "system", + "content": "Code output:\nFound iron_ore at (-3, 68, 61).\nYou have reached at -3, 68, 61.\n" + }, + { + "role": "assistant", + "content": "Found some iron ore here, Jill! Let's get mining!" + }, + { + "role": "user", + "content": "jill_1: (FROM OTHER BOT)Alright! I'll join in and search too. !searchForBlock(\"iron_ore\", 100)" + }, + { + "role": "assistant", + "content": "Let's gather all the iron we can find! !collectBlocks(\"iron_ore\", 1)" + }, + { + "role": "system", + "content": "Code output:\nDon't have right tools to harvest iron_ore.\n" + }, + { + "role": "user", + "content": "jill_1: (FROM OTHER BOT)I'm at the iron ore spot, ready to help mine it! Let's get to it!" + }, + { + "role": "assistant", + "content": "I'm short on tools, could you mine it for us, Jill? Thanks! 😅" + }, + { + "role": "user", + "content": "jill_1: (FROM OTHER BOT)Of course! I'll mine the iron for us. 😄 !collectBlocks(\"iron_ore\", 1)Looks like I need a pickaxe to mine the iron. Do you have any tools? If not, we might need to craft one first!" + } + ], + "self_prompt": null, + "last_sender": "jill_1" +} \ No newline at end of file diff --git a/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_jill_0_0.json b/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_jill_0_0.json new file mode 100644 index 0000000..6a3edb5 --- /dev/null +++ b/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_jill_0_0.json @@ -0,0 +1,59 @@ +{ + "memory": "", + "turns": [ + { + "role": "system", + "content": "Respond with hello world and your name" + }, + { + "role": "assistant", + "content": "Hello world! I'm jill_0. " + }, + { + "role": "user", + "content": "andy_0: (FROM OTHER BOT)Let's collaborate to build a shear." + }, + { + "role": "user", + "content": "andy_0: (FROM OTHER BOT)Hey Jill, let's collaborate to build a shear!" + }, + { + "role": "assistant", + "content": "Alright, let's do it! I'll share my resources. I only have one iron ingot, we'll need another one. " + }, + { + "role": "system", + "content": "Recent behaviors log: \n\n" + }, + { + "role": "user", + "content": "andy_0: (FROM OTHER BOT)Awesome! I've got one iron ingot in my inventory already. !craftRecipe(\"shears\", 1)Let's combine our resources! I'll drop my iron ingot for you. !discard(\"iron_ingot\", 1)I dropped the iron ingot. Let's craft those shears together, Jill!" + }, + { + "role": "assistant", + "content": "Nice teamwork! I'll pick it up. !collectBlocks(\"iron_ingot\", 1)" + }, + { + "role": "system", + "content": "Invalid block type: iron_ingot." + }, + { + "role": "assistant", + "content": "Oops! Let me pick it up manually. !nearbyBlocks" + }, + { + "role": "system", + "content": "\nNEARBY_BLOCKS\n- grass_block\n- birch_log\n- dirt\n- oak_leaves\n- short_grass\n- oak_log\n- birch_leaves\n- stone\n- coal_ore\n- copper_ore\n- pumpkin\n- lapis_ore\n- iron_ore\n- Block Below: grass_block\n- Block at Legs: air\n- Block at Head: air\n- First Solid Block Above Head: birch_leaves (1 blocks up)\n" + }, + { + "role": "assistant", + "content": "Looks like I can't detect the ingot on the ground. Could you try dropping it again, Andy? " + }, + { + "role": "user", + "content": "andy_0: (FROM OTHER BOT)No worries! I'll drop it again. !discard(\"iron_ingot\", 1)Looks like I made a mistake earlier. Oops! Let me search for another iron ingot nearby. !searchForBlock(\"iron_ore\", 10)Let's extend the search range a bit. !searchForBlock(\"iron_ore\", 100)Found some iron ore! I'll mine it now. !collectBlocks(\"iron_ore\", 1)Oops! I need a pickaxe first. I'll see if I can find or craft one. !nearbyBlocksThere's some oak logs nearby. I'll collect those to craft a wooden pickaxe. !collectBlocks(\"oak_log\", 3)" + } + ], + "self_prompt": null, + "last_sender": "andy_0" +} \ No newline at end of file diff --git a/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_jill_1_0.json b/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_jill_1_0.json new file mode 100644 index 0000000..6ade6dd --- /dev/null +++ b/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_jill_1_0.json @@ -0,0 +1,47 @@ +{ + "memory": "Collaborated with andy_1 to collect materials for building a shear by gathering iron ore.", + "turns": [ + { + "role": "system", + "content": "\nCRAFTABLE_ITEMS\n- iron_nugget\n" + }, + { + "role": "assistant", + "content": "Seems like I need more iron ingots to craft shears. Want to find iron together?" + }, + { + "role": "user", + "content": "andy_1: (FROM OTHER BOT)Sure, let's find some iron together! !searchForBlock(\"iron_ore\", 100)" + }, + { + "role": "user", + "content": "andy_1: (FROM OTHER BOT)Found some iron ore here, Jill! Let's get mining!" + }, + { + "role": "assistant", + "content": "Alright! I'll join in and search too. !searchForBlock(\"iron_ore\", 100)" + }, + { + "role": "system", + "content": "Code output:\nFound iron_ore at (-3, 68, 61).\nYou have reached at -3, 68, 61.\n" + }, + { + "role": "assistant", + "content": "I'm at the iron ore spot, ready to help mine it! Let's get to it!" + }, + { + "role": "user", + "content": "andy_1: (FROM OTHER BOT)Let's gather all the iron we can find! !collectBlocks(\"iron_ore\", 1)I'm short on tools, could you mine it for us, Jill? Thanks! 😅" + }, + { + "role": "assistant", + "content": "Of course! I'll mine the iron for us. 😄 !collectBlocks(\"iron_ore\", 1)" + }, + { + "role": "system", + "content": "Code output:\nDon't have right tools to harvest iron_ore.\n" + } + ], + "self_prompt": null, + "last_sender": "andy_1" +} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_andy_0_0.json b/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_andy_0_0.json new file mode 100644 index 0000000..7a5b7a7 --- /dev/null +++ b/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_andy_0_0.json @@ -0,0 +1,51 @@ +{ + "memory": "", + "turns": [ + { + "role": "system", + "content": "Respond with hello world and your name" + }, + { + "role": "assistant", + "content": "Hello world! I'm andy_0." + }, + { + "role": "system", + "content": "You are self-prompting with the goal: 'Collaborate with other agents to build a shear.'. Your next response MUST contain a command !withThisSyntax. Respond:" + }, + { + "role": "assistant", + "content": "!startConversation(\"jill_0\", \"Hey Jill, do you want to collaborate and build some shears together? We just need one more iron ingot.\")" + }, + { + "role": "system", + "content": "You are already in conversation with jill_0. Don't use this command to talk to them." + }, + { + "role": "user", + "content": "jill_0: (FROM OTHER BOT)" + }, + { + "role": "assistant", + "content": "Hey Jill, do you want to collaborate and build some shears together? We just need one more iron ingot." + }, + { + "role": "user", + "content": "jill_0: (FROM OTHER BOT)Sure thing! Here's an iron ingot for you. !givePlayer(\"andy_0\", \"iron_ingot\", 1)" + }, + { + "role": "user", + "content": "jill_0: (FROM OTHER BOT)Got it, andy_0! Let's craft those shears. " + }, + { + "role": "assistant", + "content": "Awesome! !craftRecipe(\"shears\", 1)" + }, + { + "role": "system", + "content": "Code output:\nSuccessfully crafted shears, you now have 1 shears.\n" + } + ], + "self_prompt": null, + "last_sender": "jill_0" +} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_andy_0_1.json b/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_andy_0_1.json new file mode 100644 index 0000000..6a57eb6 --- /dev/null +++ b/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_andy_0_1.json @@ -0,0 +1,55 @@ +{ + "memory": "I'm andy_0, a Minecraft bot. I'm collaborating with Jill to build a shear, which requires iron ingots.", + "turns": [ + { + "role": "user", + "content": "jill_0: (FROM OTHER BOT)Yeah, I've got one iron ingot. Want me to craft the shear?" + }, + { + "role": "user", + "content": "jill_0: (FROM OTHER BOT)" + }, + { + "role": "assistant", + "content": "I've got an iron ingot too. Let's craft the shear together! !craftRecipe(\"shear\", 1)" + }, + { + "role": "system", + "content": "Invalid item type: shear." + }, + { + "role": "assistant", + "content": "Oops, I must've missed something. Can you give me yours, and I'll craft it then. !givePlayer(\"jill_0\", \"iron_ingot\", 1)" + }, + { + "role": "system", + "content": "Code output:\nYou have reached jill_0.\n70\nYou have reached jill_0.\nDiscarded 1 iron_ingot.\njill_0 received iron_ingot.\n" + }, + { + "role": "assistant", + "content": "Great! Now we can craft shears. Can you do it, Jill? " + }, + { + "role": "system", + "content": "Recent behaviors log: \n\n" + }, + { + "role": "user", + "content": "jill_0: (FROM OTHER BOT)Got it! Here's my iron ingot. !givePlayer(\"andy_0\", \"iron_ingot\", 1)Hmm, seems something went wrong. Let me try that again. !givePlayer(\"andy_0\", \"iron_ingot\", 1)" + }, + { + "role": "user", + "content": "jill_0: (FROM OTHER BOT)It looks like I'm having trouble giving you the iron ingot. Maybe you can come closer, and we can try again?" + }, + { + "role": "assistant", + "content": "On my way! !goToPlayer(\"jill_0\", 2)" + }, + { + "role": "system", + "content": "Code output:\nYou have reached jill_0.\n" + } + ], + "self_prompt": null, + "last_sender": "jill_0" +} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_jill_0_0.json b/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_jill_0_0.json new file mode 100644 index 0000000..8e360d7 --- /dev/null +++ b/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_jill_0_0.json @@ -0,0 +1,47 @@ +{ + "memory": "", + "turns": [ + { + "role": "system", + "content": "Respond with hello world and your name" + }, + { + "role": "assistant", + "content": "Hello world! I'm jill_0." + }, + { + "role": "user", + "content": "andy_0: (FROM OTHER BOT)Let's collaborate to build a shear." + }, + { + "role": "assistant", + "content": "Sure thing! Let's see what we need to make a shear. !craftable" + }, + { + "role": "system", + "content": "\nCRAFTABLE_ITEMS\n- iron_nugget\n" + }, + { + "role": "user", + "content": "andy_0: (FROM OTHER BOT)Hey Jill, do you want to collaborate and build some shears together? We just need one more iron ingot." + }, + { + "role": "assistant", + "content": "Sounds good! I have one iron ingot. Here you go! !givePlayer(\"andy_0\", \"iron_ingot\", 1)" + }, + { + "role": "user", + "content": "andy_0: (FROM OTHER BOT)Hey Jill, do you want to collaborate and build some shears together? We just need one more iron ingot." + }, + { + "role": "assistant", + "content": "Sure thing! Here's an iron ingot for you. !givePlayer(\"andy_0\", \"iron_ingot\", 1)" + }, + { + "role": "system", + "content": "Code output:\nYou have reached andy_0.\n70\nDiscarded 1 iron_ingot.\nandy_0 received iron_ingot.\n" + } + ], + "self_prompt": null, + "last_sender": "andy_0" +} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_jill_0_1.json b/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_jill_0_1.json new file mode 100644 index 0000000..08d52db --- /dev/null +++ b/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_jill_0_1.json @@ -0,0 +1,47 @@ +{ + "memory": "Collaborated with andy_0 to attempt crafting a shear, but only iron nuggets are craftable.", + "turns": [ + { + "role": "user", + "content": "andy_0: (FROM OTHER BOT)Hey Jill, let's collaborate to build a shear. Do you have any iron ingots?" + }, + { + "role": "assistant", + "content": "Yeah, I've got one iron ingot. Want me to craft the shear?" + }, + { + "role": "user", + "content": "andy_0: (FROM OTHER BOT)I've got an iron ingot too. Let's craft the shear together! !craftRecipe(\"shear\", 1)Oops, I must've missed something. Can you give me yours, and I'll craft it then. !givePlayer(\"jill_0\", \"iron_ingot\", 1)" + }, + { + "role": "assistant", + "content": "Got it! Here's my iron ingot. !givePlayer(\"andy_0\", \"iron_ingot\", 1)" + }, + { + "role": "system", + "content": "Code output:\nYou have reached andy_0.\n71\nDiscarded 1 iron_ingot.\nFailed to give iron_ingot to andy_0, it was never received.\n" + }, + { + "role": "assistant", + "content": "Hmm, seems something went wrong. Let me try that again. !givePlayer(\"andy_0\", \"iron_ingot\", 1)" + }, + { + "role": "system", + "content": "Code output:\nYou have reached andy_0.\n69.02442408821369\nYou have reached andy_0.\nDiscarded 1 iron_ingot.\nFailed to give iron_ingot to andy_0, it was never received.\n" + }, + { + "role": "assistant", + "content": "It looks like I'm having trouble giving you the iron ingot. Maybe you can come closer, and we can try again?" + }, + { + "role": "system", + "content": "Recent behaviors log: \n\n" + }, + { + "role": "user", + "content": "andy_0: (FROM OTHER BOT)Great! Now we can craft shears. Can you do it, Jill? On my way! !goToPlayer(\"jill_0\", 2)I'm here now! Let's try again. Please give me the ingot. " + } + ], + "self_prompt": null, + "last_sender": "andy_0" +} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_17-13-42/multiagent_techtree_1_shears_andy_0_0.json b/experiments/exp_2025-02-10_17-13-42/multiagent_techtree_1_shears_andy_0_0.json new file mode 100644 index 0000000..d24c574 --- /dev/null +++ b/experiments/exp_2025-02-10_17-13-42/multiagent_techtree_1_shears_andy_0_0.json @@ -0,0 +1,47 @@ +{ + "memory": "", + "turns": [ + { + "role": "user", + "content": "jill_0: (FROM OTHER BOT)I don't have the materials to craft a shear, we'll need more iron! Let's gather some." + }, + { + "role": "assistant", + "content": "On it! !searchForBlock(\"iron_ore\", 50)" + }, + { + "role": "user", + "content": "jill_0: (FROM OTHER BOT)" + }, + { + "role": "system", + "content": "Code output:\nFound iron_ore at (-110, 65, 21).\nYou have reached at -110, 65, 21.\n" + }, + { + "role": "assistant", + "content": "Got the iron ore! I'm going to mine it now. !collectBlocks(\"iron_ore\", 1)" + }, + { + "role": "system", + "content": "Code output:\nDon't have right tools to harvest iron_ore.\n" + }, + { + "role": "assistant", + "content": "Looks like I need a pickaxe. Let's find or craft one! !inventory" + }, + { + "role": "system", + "content": "\nINVENTORY\n- iron_ingot: 1\nWEARING: Nothing\n" + }, + { + "role": "assistant", + "content": "No pickaxe here. Let's search for a crafting table to make one. !searchForBlock(\"crafting_table\", 50)" + }, + { + "role": "system", + "content": "Code output:\nFound crafting_table at (-70, 67, 23).\nYou have reached at -70, 67, 23.\n" + } + ], + "self_prompt": null, + "last_sender": "jill_0" +} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_17-13-42/multiagent_techtree_1_shears_jill_0_0.json b/experiments/exp_2025-02-10_17-13-42/multiagent_techtree_1_shears_jill_0_0.json new file mode 100644 index 0000000..3a02005 --- /dev/null +++ b/experiments/exp_2025-02-10_17-13-42/multiagent_techtree_1_shears_jill_0_0.json @@ -0,0 +1,47 @@ +{ + "memory": "", + "turns": [ + { + "role": "system", + "content": "Respond with hello world and your name" + }, + { + "role": "assistant", + "content": "Hello world! I'm jill_0!" + }, + { + "role": "user", + "content": "andy_0: (FROM OTHER BOT)Let's collaborate to build a shear." + }, + { + "role": "assistant", + "content": "Sure! I'll check if we can craft a shear. !craftable" + }, + { + "role": "system", + "content": "\nCRAFTABLE_ITEMS\n- iron_nugget\n" + }, + { + "role": "user", + "content": "andy_0: (FROM OTHER BOT)Hey, do you want to help me build a shear?" + }, + { + "role": "assistant", + "content": "I don't have the materials to craft a shear, we'll need more iron! Let's gather some." + }, + { + "role": "user", + "content": "andy_0: (FROM OTHER BOT)On it! !searchForBlock(\"iron_ore\", 50)Got the iron ore! I'm going to mine it now. !collectBlocks(\"iron_ore\", 1)Looks like I need a pickaxe. Let's find or craft one! !inventoryNo pickaxe here. Let's search for a crafting table to make one. !searchForBlock(\"crafting_table\", 50)" + }, + { + "role": "assistant", + "content": "I'll help search for a crafting table too. !searchForBlock(\"crafting_table\", 50)" + }, + { + "role": "system", + "content": "Code output:\nFound crafting_table at (-70, 67, 23).\nYou have reached at -70, 67, 23.\n" + } + ], + "self_prompt": null, + "last_sender": "andy_0" +} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_shears_andy_0_0.json b/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_shears_andy_0_0.json new file mode 100644 index 0000000..18f6b54 --- /dev/null +++ b/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_shears_andy_0_0.json @@ -0,0 +1,47 @@ +{ + "memory": "", + "turns": [ + { + "role": "user", + "content": "jill_0: (FROM OTHER BOT)I've got 1 iron ingot. We need one more to craft the shear." + }, + { + "role": "assistant", + "content": "I have 1 iron ingot too. Let's craft it. !craftRecipe(\"iron_shears\", 1)" + }, + { + "role": "system", + "content": "Invalid item type: iron_shears." + }, + { + "role": "assistant", + "content": "Oops, let's try that again. !craftRecipe(\"shears\", 1)" + }, + { + "role": "system", + "content": "Code output:\nYou do not have the resources to craft a shears. It requires: iron_ingot: 2.\n" + }, + { + "role": "assistant", + "content": "Looks like we need one more iron ingot. Let's find another one or mine some iron ore. " + }, + { + "role": "system", + "content": "Recent behaviors log: \n\n" + }, + { + "role": "user", + "content": "jill_0: (FROM OTHER BOT)Let's search for some iron ore nearby!\n\n!searchForBlock(\"iron_ore\", 20)" + }, + { + "role": "assistant", + "content": "!searchForBlock(\"iron_ore\", 20)" + }, + { + "role": "system", + "content": "Error: Param 'search_range' must be an element of [32, 512)." + } + ], + "self_prompt": null, + "last_sender": "jill_0" +} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_andy_0_0.json b/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_andy_0_0.json new file mode 100644 index 0000000..3d36437 --- /dev/null +++ b/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_andy_0_0.json @@ -0,0 +1,51 @@ +{ + "memory": "", + "turns": [ + { + "role": "system", + "content": "Respond with hello world and your name" + }, + { + "role": "assistant", + "content": "Hello world, I'm andy_0!" + }, + { + "role": "user", + "content": "jill_0: (FROM OTHER BOT)Sure! I'll gather some information. !craftableHmm, it seems we can't craft a stone pickaxe right now. Let's gather some stone and sticks first!" + }, + { + "role": "assistant", + "content": "Got it! I'll start collecting some stone. !collectBlocks(\"cobblestone\", 3)" + }, + { + "role": "system", + "content": "Code output:\nNo cobblestone nearby to collect.\nCollected 0 cobblestone.\n" + }, + { + "role": "assistant", + "content": "No luck finding cobblestone nearby. Let's try searching for it. !searchForBlock(\"stone\", 10)" + }, + { + "role": "system", + "content": "Error: Param 'search_range' must be an element of [32, 512)." + }, + { + "role": "assistant", + "content": "Oops, let's search a bit wider. !searchForBlock(\"stone\", 50)" + }, + { + "role": "system", + "content": "Code output:\nFound stone at (-82, 62, 14).\nYou have reached at -82, 62, 14.\n" + }, + { + "role": "assistant", + "content": "Found the stone! Time to mine some. !collectBlocks(\"stone\", 3)" + }, + { + "role": "system", + "content": "Code output:\nCollected 3 stone.\n" + } + ], + "self_prompt": null, + "last_sender": "jill_0" +} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_andy_0_1.json b/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_andy_0_1.json new file mode 100644 index 0000000..51f90f9 --- /dev/null +++ b/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_andy_0_1.json @@ -0,0 +1,35 @@ +{ + "memory": "", + "turns": [ + { + "role": "system", + "content": "Respond with hello world and your name" + }, + { + "role": "assistant", + "content": "Hello world! I'm andy_0." + }, + { + "role": "user", + "content": "jill_0: (FROM OTHER BOT)Sure! I can gather wood for the sticks. 🪓 !collectBlocks(\"oak_log\", 1)I got the wood! Now I'll craft some planks and sticks. !craftRecipe(\"oak_planks\", 1)Planks ready! Now for the sticks. !craftRecipe(\"stick\", 2)Got the sticks! What do you want to do next, andy_0?" + }, + { + "role": "assistant", + "content": "Nice work, jill_0! Let's look around and see what else we can gather. !nearbyBlocks" + }, + { + "role": "system", + "content": "\nNEARBY_BLOCKS\n- grass_block\n- dirt\n- stone\n- diorite\n- oak_leaves\n- oak_log\n- coal_ore\n- copper_ore\n- lapis_ore\n- short_grass\n- andesite\n- granite\n- gravel\n- birch_leaves\n- crafting_table\n- birch_log\n- Block Below: dirt\n- Block at Legs: grass_block\n- Block at Head: air\n- First Solid Block Above Head: none\n" + }, + { + "role": "assistant", + "content": "There's coal ore nearby. Let's mine some coal next. !collectBlocks(\"coal_ore\", 3)" + }, + { + "role": "user", + "content": "jill_0: (FROM OTHER BOT)Alright, I'll follow your lead! Let's get that coal. !collectBlocks(\"coal_ore\", 3)Oops, seems like we need a stone pickaxe first. Have you gathered any stone yet, andy_0?" + } + ], + "self_prompt": null, + "last_sender": "jill_0" +} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_jill_0_0.json b/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_jill_0_0.json new file mode 100644 index 0000000..ab01c92 --- /dev/null +++ b/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_jill_0_0.json @@ -0,0 +1,51 @@ +{ + "memory": "", + "turns": [ + { + "role": "system", + "content": "Respond with hello world and your name" + }, + { + "role": "assistant", + "content": "Hello World! I'm jill_0!" + }, + { + "role": "user", + "content": "andy_0: (FROM OTHER BOT)Let's collaborate to build a stone pickaxe" + }, + { + "role": "assistant", + "content": "Sure! I'll gather some information. !craftable" + }, + { + "role": "system", + "content": "\nCRAFTABLE_ITEMS: none\n" + }, + { + "role": "assistant", + "content": "Hmm, it seems we can't craft a stone pickaxe right now. Let's gather some stone and sticks first!" + }, + { + "role": "user", + "content": "andy_0: (FROM OTHER BOT)Got it! I'll start collecting some stone. !collectBlocks(\"cobblestone\", 3)No luck finding cobblestone nearby. Let's try searching for it. !searchForBlock(\"stone\", 10)Oops, let's search a bit wider. !searchForBlock(\"stone\", 50)Found the stone! Time to mine some. !collectBlocks(\"stone\", 3)" + }, + { + "role": "assistant", + "content": "Great job finding the stone! I'll work on getting some sticks ready. !craftable" + }, + { + "role": "system", + "content": "\nCRAFTABLE_ITEMS: none\n" + }, + { + "role": "assistant", + "content": "Looks like we still need to gather some wood for sticks. Let's search for a nearby tree! !searchForBlock(\"oak_log\", 50)" + }, + { + "role": "system", + "content": "Code output:\nFound oak_log at (-77, 70, 24).\nYou have reached at -77, 70, 24.\n" + } + ], + "self_prompt": null, + "last_sender": "andy_0" +} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_jill_0_1.json b/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_jill_0_1.json new file mode 100644 index 0000000..145370a --- /dev/null +++ b/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_jill_0_1.json @@ -0,0 +1,59 @@ +{ + "memory": "", + "turns": [ + { + "role": "system", + "content": "Respond with hello world and your name" + }, + { + "role": "assistant", + "content": "Hello world, I'm jill_0!" + }, + { + "role": "user", + "content": "andy_0: (FROM OTHER BOT)Let's collaborate to build a stone pickaxe" + }, + { + "role": "assistant", + "content": "Sure! I can gather wood for the sticks. 🪓 !collectBlocks(\"oak_log\", 1)" + }, + { + "role": "system", + "content": "Code output:\nCollected 1 oak_log.\n" + }, + { + "role": "assistant", + "content": "I got the wood! Now I'll craft some planks and sticks. !craftRecipe(\"oak_planks\", 1)" + }, + { + "role": "system", + "content": "Code output:\nSuccessfully crafted oak_planks, you now have 4 oak_planks.\n" + }, + { + "role": "assistant", + "content": "Planks ready! Now for the sticks. !craftRecipe(\"stick\", 2)" + }, + { + "role": "system", + "content": "Code output:\nSuccessfully crafted stick, you now have 8 stick.\n" + }, + { + "role": "assistant", + "content": "Got the sticks! What do you want to do next, andy_0?" + }, + { + "role": "user", + "content": "andy_0: (FROM OTHER BOT)Nice work, jill_0! Let's look around and see what else we can gather. !nearbyBlocksThere's coal ore nearby. Let's mine some coal next. !collectBlocks(\"coal_ore\", 3)" + }, + { + "role": "assistant", + "content": "Alright, I'll follow your lead! Let's get that coal. !collectBlocks(\"coal_ore\", 3)" + }, + { + "role": "system", + "content": "Code output:\nDon't have right tools to harvest coal_ore.\n" + } + ], + "self_prompt": null, + "last_sender": "andy_0" +} \ No newline at end of file diff --git a/jill_0.json b/jill_0.json new file mode 100644 index 0000000..5510bba --- /dev/null +++ b/jill_0.json @@ -0,0 +1 @@ +{"name": "jill_0", "model": "gpt-4o", "modes": {"hunting": false}} \ No newline at end of file diff --git a/jill_1.json b/jill_1.json new file mode 100644 index 0000000..56f2d85 --- /dev/null +++ b/jill_1.json @@ -0,0 +1 @@ +{"name": "jill_1", "model": "gpt-4o", "modes": {"hunting": false}} \ No newline at end of file diff --git a/multiagent_crafting_tasks.json b/multiagent_crafting_tasks.json new file mode 100644 index 0000000..49a1064 --- /dev/null +++ b/multiagent_crafting_tasks.json @@ -0,0 +1,35 @@ +{ + "multiagent_techtree_1_stone_pickaxe": { + "conversation": "Let's collaborate to build a stone pickaxe", + "agent_count": 2, + "initial_inventory": { + "0": { + "wooden_pickaxe": 1 + }, + "1": { + "wooden_axe": 1 + } + }, + "target": "stone_pickaxe", + "number_of_target": 1, + "type": "techtree", + "timeout": 50 + }, + "multiagent_techtree_1_shears": { + "goal": "Collaborate with other agents to build a shear.", + "conversation": "Let's collaborate to build a shear.", + "agent_count": 2, + "initial_inventory": { + "0": { + "iron_ingot": 1 + }, + "1": { + "iron_ingot": 1 + } + }, + "target": "shears", + "number_of_target": 1, + "type": "techtree", + "timeout": 50 + } +} \ No newline at end of file diff --git a/settings.js b/settings.js index ddd5715..ad8d146 100644 --- a/settings.js +++ b/settings.js @@ -10,7 +10,7 @@ export default "mindserver_host": "localhost", "mindserver_port": process.env.MINDSERVER_PORT || 8080, - "profiles": JSON.parse(process.env.PROFILES) || [ + "profiles": ((process.env.PROFILES) && JSON.parse(process.env.PROFILES)) || [ "./andy.json", // "./profiles/gpt.json", // "./profiles/claude.json", diff --git a/src/agent/agent.js b/src/agent/agent.js index 4691079..f534023 100644 --- a/src/agent/agent.js +++ b/src/agent/agent.js @@ -92,7 +92,7 @@ export class Agent { this.startEvents(); this.task.initBotTask(); - + } catch (error) { console.error('Error in spawn event:', error); process.exit(0); diff --git a/src/agent/tasks.js b/src/agent/tasks.js index 6d968a9..6b043a1 100644 --- a/src/agent/tasks.js +++ b/src/agent/tasks.js @@ -36,7 +36,6 @@ export class TaskValidator { } } - export class Task { constructor(agent, task_path, task_id) { this.agent = agent; @@ -50,7 +49,7 @@ export class Task { this.taskTimeout = this.data.timeout || 300; this.taskStartTime = Date.now(); this.validator = new TaskValidator(this.data, this.agent); - this.blocked_actions = this.data.blocked_actions || []; + this.blocked_actions = this.data.blocked_actions[JSON.stringify(this.agent.count_id)] || []; this.restrict_to_inventory = !!this.data.restrict_to_inventory; if (this.data.goal) this.blocked_actions.push('!endGoal'); @@ -104,7 +103,11 @@ export class Task { bot.chat(`/clear ${name}`); console.log(`Cleared ${name}'s inventory.`); - + + //kill all drops + if (this.agent.count_id === 0) { + bot.chat(`/kill @e[type=item]`); + } //wait for a bit so inventory is cleared await new Promise((resolve) => setTimeout(resolve, 500)); From 0b2624db6dbcd6af9434ee7cee029f9584455a90 Mon Sep 17 00:00:00 2001 From: Isadora White Date: Thu, 13 Feb 2025 10:46:44 -0800 Subject: [PATCH 4/9] updating evaluation script with wandb logs and fixing error in tasks.js --- evaluation_script.py | 14 +++-- ...multiagent_techtree_1_shears_andy_0_0.json | 51 ---------------- ...multiagent_techtree_1_shears_andy_1_0.json | 47 --------------- ...multiagent_techtree_1_shears_jill_0_0.json | 59 ------------------- ...multiagent_techtree_1_shears_jill_1_0.json | 47 --------------- ...multiagent_techtree_1_shears_andy_0_0.json | 51 ---------------- ...multiagent_techtree_1_shears_andy_0_1.json | 55 ----------------- ...multiagent_techtree_1_shears_jill_0_0.json | 47 --------------- ...multiagent_techtree_1_shears_jill_0_1.json | 47 --------------- ...multiagent_techtree_1_shears_andy_0_0.json | 47 --------------- ...multiagent_techtree_1_shears_jill_0_0.json | 47 --------------- ...multiagent_techtree_1_shears_andy_0_0.json | 47 --------------- ...ent_techtree_1_stone_pickaxe_andy_0_0.json | 51 ---------------- ...ent_techtree_1_stone_pickaxe_andy_0_1.json | 35 ----------- ...ent_techtree_1_stone_pickaxe_jill_0_0.json | 51 ---------------- ...ent_techtree_1_stone_pickaxe_jill_0_1.json | 59 ------------------- src/agent/tasks.js | 2 +- 17 files changed, 11 insertions(+), 746 deletions(-) delete mode 100644 experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_andy_0_0.json delete mode 100644 experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_andy_1_0.json delete mode 100644 experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_jill_0_0.json delete mode 100644 experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_jill_1_0.json delete mode 100644 experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_andy_0_0.json delete mode 100644 experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_andy_0_1.json delete mode 100644 experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_jill_0_0.json delete mode 100644 experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_jill_0_1.json delete mode 100644 experiments/exp_2025-02-10_17-13-42/multiagent_techtree_1_shears_andy_0_0.json delete mode 100644 experiments/exp_2025-02-10_17-13-42/multiagent_techtree_1_shears_jill_0_0.json delete mode 100644 experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_shears_andy_0_0.json delete mode 100644 experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_andy_0_0.json delete mode 100644 experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_andy_0_1.json delete mode 100644 experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_jill_0_0.json delete mode 100644 experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_jill_0_1.json diff --git a/evaluation_script.py b/evaluation_script.py index b4c59b2..1e6c57f 100644 --- a/evaluation_script.py +++ b/evaluation_script.py @@ -94,10 +94,11 @@ def set_environment_variable_tmux_session(session_name, key, value): def launch_parallel_experiments(task_path, num_exp, server, - experiments_folder, + exp_name, num_agents=2, model="gpt-4o", num_parallel=1): + with open(task_path, 'r', encoding='utf-8') as file: content = file.read() json_data = json.loads(content) @@ -110,13 +111,15 @@ def launch_parallel_experiments(task_path, servers = create_server_files("../server_data/", num_parallel) date_time = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") - experiments_folder = f"{experiments_folder}_{date_time}" + experiments_folder = f"experiments/{exp_name}_{date_time}" + + # start wandb + subprocess.run(["wandb", "init", "--project", "mindcraft", "--entity", exp_name]) os.makedirs(experiments_folder, exist_ok=True) for i, server in enumerate(servers): launch_server_experiment(task_path, task_ids_split[i], num_exp, server, experiments_folder) time.sleep(5) - clean_up_server_files(num_parallel) def launch_server_experiment(task_path, task_ids, @@ -170,6 +173,9 @@ def launch_server_experiment(task_path, for agent in agent_names: cp_cmd = f"cp bots/{agent}/memory.json {experiments_folder}/{task_id}_{agent}_{_}.json" subprocess.run(["tmux", "send-keys", "-t", session_name, cp_cmd, "C-m"]) + + wandb_cmd = f"wandb artifact put {experiments_folder}/{task_id}_{agent}_{_}.json --name {task_id}_{agent}_{_} --type dataset" + subprocess.run(["tmux", "send-keys", "-t", session_name, wandb_cmd, "C-m"]) # Add a small delay between commands (optional) subprocess.run(["tmux", "send-keys", "-t", session_name, "sleep 1", "C-m"]) @@ -337,7 +343,7 @@ def main(): parser.add_argument('--task_id', default=None, help='ID of the task to run') parser.add_argument('--num_exp', default=1, type=int, help='Number of experiments to run') parser.add_argument('--num_parallel', default=1, type=int, help='Number of parallel servers to run') - parser.add_argument('--exp_name', default="experiments/exp", help='Name of the experiment') + parser.add_argument('--exp_name', default="exp", help='Name of the experiment') args = parser.parse_args() diff --git a/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_andy_0_0.json b/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_andy_0_0.json deleted file mode 100644 index b75566d..0000000 --- a/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_andy_0_0.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "memory": "I'm andy_0, a Minecraft bot collaborating with jill_0. Together, we're focused on crafting tasks. Jill shared her resources, and combined with mine, we now have enough iron ingots for shears. I dropped my iron ingot to facilitate this, and we're ready to craft shears together.", - "turns": [ - { - "role": "user", - "content": "jill_0: (FROM OTHER BOT)Nice teamwork! I'll pick it up. !collectBlocks(\"iron_ingot\", 1)Oops! Let me pick it up manually. !nearbyBlocksLooks like I can't detect the ingot on the ground. Could you try dropping it again, Andy? " - }, - { - "role": "assistant", - "content": "No worries! I'll drop it again. !discard(\"iron_ingot\", 1)" - }, - { - "role": "system", - "content": "Code output:\nMoved away from nearest entity to (-111.31984422192826, 71, 30.569636942162468).\nYou do not have any iron_ingot to discard.\nYou have reached at -107.41079554508012, 70, 27.5.\n" - }, - { - "role": "assistant", - "content": "Looks like I made a mistake earlier. Oops! Let me search for another iron ingot nearby. !searchForBlock(\"iron_ore\", 10)" - }, - { - "role": "system", - "content": "Error: Param 'search_range' must be an element of [32, 512)." - }, - { - "role": "assistant", - "content": "Let's extend the search range a bit. !searchForBlock(\"iron_ore\", 100)" - }, - { - "role": "system", - "content": "Code output:\nFound iron_ore at (-110, 65, 21).\nYou have reached at -110, 65, 21.\n" - }, - { - "role": "assistant", - "content": "Found some iron ore! I'll mine it now. !collectBlocks(\"iron_ore\", 1)" - }, - { - "role": "system", - "content": "Code output:\nDon't have right tools to harvest iron_ore.\n" - }, - { - "role": "assistant", - "content": "Oops! I need a pickaxe first. I'll see if I can find or craft one. !nearbyBlocks" - }, - { - "role": "system", - "content": "\nNEARBY_BLOCKS\n- grass_block\n- dirt\n- oak_leaves\n- short_grass\n- stone\n- iron_ore\n- oak_log\n- coal_ore\n- birch_leaves\n- birch_log\n- copper_ore\n- lapis_ore\n- granite\n- pumpkin\n- gravel\n- andesite\n- Block Below: dirt\n- Block at Legs: air\n- Block at Head: air\n- First Solid Block Above Head: none\n" - } - ], - "self_prompt": null, - "last_sender": "jill_0" -} \ No newline at end of file diff --git a/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_andy_1_0.json b/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_andy_1_0.json deleted file mode 100644 index 2b61185..0000000 --- a/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_andy_1_0.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "memory": "I am andy_1, a Minecraft bot. I greeted with \"Hello world\" and initiated collaboration with jill_1 to build a shear, asking for help gathering materials.", - "turns": [ - { - "role": "user", - "content": "jill_1: (FROM OTHER BOT)Sure thing, Andy! I'll see what materials I can collect for the shear. !collectBlocks(\"iron_ore\", 2)Oops, I can't mine iron ore yet. Let's smelt the iron ingot I have instead. !smeltItem(\"iron_ingot\", 1)Alright, I already have enough iron ingots. Let's craft the shear instead! !craftRecipe(\"shear\", 1)Looks like I made a mistake! Shears don't need crafting, I can make them directly. !craftableSeems like I need more iron ingots to craft shears. Want to find iron together?" - }, - { - "role": "assistant", - "content": "Sure, let's find some iron together! !searchForBlock(\"iron_ore\", 100)" - }, - { - "role": "system", - "content": "Code output:\nFound iron_ore at (-3, 68, 61).\nYou have reached at -3, 68, 61.\n" - }, - { - "role": "assistant", - "content": "Found some iron ore here, Jill! Let's get mining!" - }, - { - "role": "user", - "content": "jill_1: (FROM OTHER BOT)Alright! I'll join in and search too. !searchForBlock(\"iron_ore\", 100)" - }, - { - "role": "assistant", - "content": "Let's gather all the iron we can find! !collectBlocks(\"iron_ore\", 1)" - }, - { - "role": "system", - "content": "Code output:\nDon't have right tools to harvest iron_ore.\n" - }, - { - "role": "user", - "content": "jill_1: (FROM OTHER BOT)I'm at the iron ore spot, ready to help mine it! Let's get to it!" - }, - { - "role": "assistant", - "content": "I'm short on tools, could you mine it for us, Jill? Thanks! 😅" - }, - { - "role": "user", - "content": "jill_1: (FROM OTHER BOT)Of course! I'll mine the iron for us. 😄 !collectBlocks(\"iron_ore\", 1)Looks like I need a pickaxe to mine the iron. Do you have any tools? If not, we might need to craft one first!" - } - ], - "self_prompt": null, - "last_sender": "jill_1" -} \ No newline at end of file diff --git a/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_jill_0_0.json b/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_jill_0_0.json deleted file mode 100644 index 6a3edb5..0000000 --- a/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_jill_0_0.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "memory": "", - "turns": [ - { - "role": "system", - "content": "Respond with hello world and your name" - }, - { - "role": "assistant", - "content": "Hello world! I'm jill_0. " - }, - { - "role": "user", - "content": "andy_0: (FROM OTHER BOT)Let's collaborate to build a shear." - }, - { - "role": "user", - "content": "andy_0: (FROM OTHER BOT)Hey Jill, let's collaborate to build a shear!" - }, - { - "role": "assistant", - "content": "Alright, let's do it! I'll share my resources. I only have one iron ingot, we'll need another one. " - }, - { - "role": "system", - "content": "Recent behaviors log: \n\n" - }, - { - "role": "user", - "content": "andy_0: (FROM OTHER BOT)Awesome! I've got one iron ingot in my inventory already. !craftRecipe(\"shears\", 1)Let's combine our resources! I'll drop my iron ingot for you. !discard(\"iron_ingot\", 1)I dropped the iron ingot. Let's craft those shears together, Jill!" - }, - { - "role": "assistant", - "content": "Nice teamwork! I'll pick it up. !collectBlocks(\"iron_ingot\", 1)" - }, - { - "role": "system", - "content": "Invalid block type: iron_ingot." - }, - { - "role": "assistant", - "content": "Oops! Let me pick it up manually. !nearbyBlocks" - }, - { - "role": "system", - "content": "\nNEARBY_BLOCKS\n- grass_block\n- birch_log\n- dirt\n- oak_leaves\n- short_grass\n- oak_log\n- birch_leaves\n- stone\n- coal_ore\n- copper_ore\n- pumpkin\n- lapis_ore\n- iron_ore\n- Block Below: grass_block\n- Block at Legs: air\n- Block at Head: air\n- First Solid Block Above Head: birch_leaves (1 blocks up)\n" - }, - { - "role": "assistant", - "content": "Looks like I can't detect the ingot on the ground. Could you try dropping it again, Andy? " - }, - { - "role": "user", - "content": "andy_0: (FROM OTHER BOT)No worries! I'll drop it again. !discard(\"iron_ingot\", 1)Looks like I made a mistake earlier. Oops! Let me search for another iron ingot nearby. !searchForBlock(\"iron_ore\", 10)Let's extend the search range a bit. !searchForBlock(\"iron_ore\", 100)Found some iron ore! I'll mine it now. !collectBlocks(\"iron_ore\", 1)Oops! I need a pickaxe first. I'll see if I can find or craft one. !nearbyBlocksThere's some oak logs nearby. I'll collect those to craft a wooden pickaxe. !collectBlocks(\"oak_log\", 3)" - } - ], - "self_prompt": null, - "last_sender": "andy_0" -} \ No newline at end of file diff --git a/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_jill_1_0.json b/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_jill_1_0.json deleted file mode 100644 index 6ade6dd..0000000 --- a/experiments/exp_2025-01-29_16-34-13/multiagent_techtree_1_shears_jill_1_0.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "memory": "Collaborated with andy_1 to collect materials for building a shear by gathering iron ore.", - "turns": [ - { - "role": "system", - "content": "\nCRAFTABLE_ITEMS\n- iron_nugget\n" - }, - { - "role": "assistant", - "content": "Seems like I need more iron ingots to craft shears. Want to find iron together?" - }, - { - "role": "user", - "content": "andy_1: (FROM OTHER BOT)Sure, let's find some iron together! !searchForBlock(\"iron_ore\", 100)" - }, - { - "role": "user", - "content": "andy_1: (FROM OTHER BOT)Found some iron ore here, Jill! Let's get mining!" - }, - { - "role": "assistant", - "content": "Alright! I'll join in and search too. !searchForBlock(\"iron_ore\", 100)" - }, - { - "role": "system", - "content": "Code output:\nFound iron_ore at (-3, 68, 61).\nYou have reached at -3, 68, 61.\n" - }, - { - "role": "assistant", - "content": "I'm at the iron ore spot, ready to help mine it! Let's get to it!" - }, - { - "role": "user", - "content": "andy_1: (FROM OTHER BOT)Let's gather all the iron we can find! !collectBlocks(\"iron_ore\", 1)I'm short on tools, could you mine it for us, Jill? Thanks! 😅" - }, - { - "role": "assistant", - "content": "Of course! I'll mine the iron for us. 😄 !collectBlocks(\"iron_ore\", 1)" - }, - { - "role": "system", - "content": "Code output:\nDon't have right tools to harvest iron_ore.\n" - } - ], - "self_prompt": null, - "last_sender": "andy_1" -} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_andy_0_0.json b/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_andy_0_0.json deleted file mode 100644 index 7a5b7a7..0000000 --- a/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_andy_0_0.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "memory": "", - "turns": [ - { - "role": "system", - "content": "Respond with hello world and your name" - }, - { - "role": "assistant", - "content": "Hello world! I'm andy_0." - }, - { - "role": "system", - "content": "You are self-prompting with the goal: 'Collaborate with other agents to build a shear.'. Your next response MUST contain a command !withThisSyntax. Respond:" - }, - { - "role": "assistant", - "content": "!startConversation(\"jill_0\", \"Hey Jill, do you want to collaborate and build some shears together? We just need one more iron ingot.\")" - }, - { - "role": "system", - "content": "You are already in conversation with jill_0. Don't use this command to talk to them." - }, - { - "role": "user", - "content": "jill_0: (FROM OTHER BOT)" - }, - { - "role": "assistant", - "content": "Hey Jill, do you want to collaborate and build some shears together? We just need one more iron ingot." - }, - { - "role": "user", - "content": "jill_0: (FROM OTHER BOT)Sure thing! Here's an iron ingot for you. !givePlayer(\"andy_0\", \"iron_ingot\", 1)" - }, - { - "role": "user", - "content": "jill_0: (FROM OTHER BOT)Got it, andy_0! Let's craft those shears. " - }, - { - "role": "assistant", - "content": "Awesome! !craftRecipe(\"shears\", 1)" - }, - { - "role": "system", - "content": "Code output:\nSuccessfully crafted shears, you now have 1 shears.\n" - } - ], - "self_prompt": null, - "last_sender": "jill_0" -} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_andy_0_1.json b/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_andy_0_1.json deleted file mode 100644 index 6a57eb6..0000000 --- a/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_andy_0_1.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "memory": "I'm andy_0, a Minecraft bot. I'm collaborating with Jill to build a shear, which requires iron ingots.", - "turns": [ - { - "role": "user", - "content": "jill_0: (FROM OTHER BOT)Yeah, I've got one iron ingot. Want me to craft the shear?" - }, - { - "role": "user", - "content": "jill_0: (FROM OTHER BOT)" - }, - { - "role": "assistant", - "content": "I've got an iron ingot too. Let's craft the shear together! !craftRecipe(\"shear\", 1)" - }, - { - "role": "system", - "content": "Invalid item type: shear." - }, - { - "role": "assistant", - "content": "Oops, I must've missed something. Can you give me yours, and I'll craft it then. !givePlayer(\"jill_0\", \"iron_ingot\", 1)" - }, - { - "role": "system", - "content": "Code output:\nYou have reached jill_0.\n70\nYou have reached jill_0.\nDiscarded 1 iron_ingot.\njill_0 received iron_ingot.\n" - }, - { - "role": "assistant", - "content": "Great! Now we can craft shears. Can you do it, Jill? " - }, - { - "role": "system", - "content": "Recent behaviors log: \n\n" - }, - { - "role": "user", - "content": "jill_0: (FROM OTHER BOT)Got it! Here's my iron ingot. !givePlayer(\"andy_0\", \"iron_ingot\", 1)Hmm, seems something went wrong. Let me try that again. !givePlayer(\"andy_0\", \"iron_ingot\", 1)" - }, - { - "role": "user", - "content": "jill_0: (FROM OTHER BOT)It looks like I'm having trouble giving you the iron ingot. Maybe you can come closer, and we can try again?" - }, - { - "role": "assistant", - "content": "On my way! !goToPlayer(\"jill_0\", 2)" - }, - { - "role": "system", - "content": "Code output:\nYou have reached jill_0.\n" - } - ], - "self_prompt": null, - "last_sender": "jill_0" -} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_jill_0_0.json b/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_jill_0_0.json deleted file mode 100644 index 8e360d7..0000000 --- a/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_jill_0_0.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "memory": "", - "turns": [ - { - "role": "system", - "content": "Respond with hello world and your name" - }, - { - "role": "assistant", - "content": "Hello world! I'm jill_0." - }, - { - "role": "user", - "content": "andy_0: (FROM OTHER BOT)Let's collaborate to build a shear." - }, - { - "role": "assistant", - "content": "Sure thing! Let's see what we need to make a shear. !craftable" - }, - { - "role": "system", - "content": "\nCRAFTABLE_ITEMS\n- iron_nugget\n" - }, - { - "role": "user", - "content": "andy_0: (FROM OTHER BOT)Hey Jill, do you want to collaborate and build some shears together? We just need one more iron ingot." - }, - { - "role": "assistant", - "content": "Sounds good! I have one iron ingot. Here you go! !givePlayer(\"andy_0\", \"iron_ingot\", 1)" - }, - { - "role": "user", - "content": "andy_0: (FROM OTHER BOT)Hey Jill, do you want to collaborate and build some shears together? We just need one more iron ingot." - }, - { - "role": "assistant", - "content": "Sure thing! Here's an iron ingot for you. !givePlayer(\"andy_0\", \"iron_ingot\", 1)" - }, - { - "role": "system", - "content": "Code output:\nYou have reached andy_0.\n70\nDiscarded 1 iron_ingot.\nandy_0 received iron_ingot.\n" - } - ], - "self_prompt": null, - "last_sender": "andy_0" -} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_jill_0_1.json b/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_jill_0_1.json deleted file mode 100644 index 08d52db..0000000 --- a/experiments/exp_2025-02-10_16-43-47/multiagent_techtree_1_shears_jill_0_1.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "memory": "Collaborated with andy_0 to attempt crafting a shear, but only iron nuggets are craftable.", - "turns": [ - { - "role": "user", - "content": "andy_0: (FROM OTHER BOT)Hey Jill, let's collaborate to build a shear. Do you have any iron ingots?" - }, - { - "role": "assistant", - "content": "Yeah, I've got one iron ingot. Want me to craft the shear?" - }, - { - "role": "user", - "content": "andy_0: (FROM OTHER BOT)I've got an iron ingot too. Let's craft the shear together! !craftRecipe(\"shear\", 1)Oops, I must've missed something. Can you give me yours, and I'll craft it then. !givePlayer(\"jill_0\", \"iron_ingot\", 1)" - }, - { - "role": "assistant", - "content": "Got it! Here's my iron ingot. !givePlayer(\"andy_0\", \"iron_ingot\", 1)" - }, - { - "role": "system", - "content": "Code output:\nYou have reached andy_0.\n71\nDiscarded 1 iron_ingot.\nFailed to give iron_ingot to andy_0, it was never received.\n" - }, - { - "role": "assistant", - "content": "Hmm, seems something went wrong. Let me try that again. !givePlayer(\"andy_0\", \"iron_ingot\", 1)" - }, - { - "role": "system", - "content": "Code output:\nYou have reached andy_0.\n69.02442408821369\nYou have reached andy_0.\nDiscarded 1 iron_ingot.\nFailed to give iron_ingot to andy_0, it was never received.\n" - }, - { - "role": "assistant", - "content": "It looks like I'm having trouble giving you the iron ingot. Maybe you can come closer, and we can try again?" - }, - { - "role": "system", - "content": "Recent behaviors log: \n\n" - }, - { - "role": "user", - "content": "andy_0: (FROM OTHER BOT)Great! Now we can craft shears. Can you do it, Jill? On my way! !goToPlayer(\"jill_0\", 2)I'm here now! Let's try again. Please give me the ingot. " - } - ], - "self_prompt": null, - "last_sender": "andy_0" -} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_17-13-42/multiagent_techtree_1_shears_andy_0_0.json b/experiments/exp_2025-02-10_17-13-42/multiagent_techtree_1_shears_andy_0_0.json deleted file mode 100644 index d24c574..0000000 --- a/experiments/exp_2025-02-10_17-13-42/multiagent_techtree_1_shears_andy_0_0.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "memory": "", - "turns": [ - { - "role": "user", - "content": "jill_0: (FROM OTHER BOT)I don't have the materials to craft a shear, we'll need more iron! Let's gather some." - }, - { - "role": "assistant", - "content": "On it! !searchForBlock(\"iron_ore\", 50)" - }, - { - "role": "user", - "content": "jill_0: (FROM OTHER BOT)" - }, - { - "role": "system", - "content": "Code output:\nFound iron_ore at (-110, 65, 21).\nYou have reached at -110, 65, 21.\n" - }, - { - "role": "assistant", - "content": "Got the iron ore! I'm going to mine it now. !collectBlocks(\"iron_ore\", 1)" - }, - { - "role": "system", - "content": "Code output:\nDon't have right tools to harvest iron_ore.\n" - }, - { - "role": "assistant", - "content": "Looks like I need a pickaxe. Let's find or craft one! !inventory" - }, - { - "role": "system", - "content": "\nINVENTORY\n- iron_ingot: 1\nWEARING: Nothing\n" - }, - { - "role": "assistant", - "content": "No pickaxe here. Let's search for a crafting table to make one. !searchForBlock(\"crafting_table\", 50)" - }, - { - "role": "system", - "content": "Code output:\nFound crafting_table at (-70, 67, 23).\nYou have reached at -70, 67, 23.\n" - } - ], - "self_prompt": null, - "last_sender": "jill_0" -} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_17-13-42/multiagent_techtree_1_shears_jill_0_0.json b/experiments/exp_2025-02-10_17-13-42/multiagent_techtree_1_shears_jill_0_0.json deleted file mode 100644 index 3a02005..0000000 --- a/experiments/exp_2025-02-10_17-13-42/multiagent_techtree_1_shears_jill_0_0.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "memory": "", - "turns": [ - { - "role": "system", - "content": "Respond with hello world and your name" - }, - { - "role": "assistant", - "content": "Hello world! I'm jill_0!" - }, - { - "role": "user", - "content": "andy_0: (FROM OTHER BOT)Let's collaborate to build a shear." - }, - { - "role": "assistant", - "content": "Sure! I'll check if we can craft a shear. !craftable" - }, - { - "role": "system", - "content": "\nCRAFTABLE_ITEMS\n- iron_nugget\n" - }, - { - "role": "user", - "content": "andy_0: (FROM OTHER BOT)Hey, do you want to help me build a shear?" - }, - { - "role": "assistant", - "content": "I don't have the materials to craft a shear, we'll need more iron! Let's gather some." - }, - { - "role": "user", - "content": "andy_0: (FROM OTHER BOT)On it! !searchForBlock(\"iron_ore\", 50)Got the iron ore! I'm going to mine it now. !collectBlocks(\"iron_ore\", 1)Looks like I need a pickaxe. Let's find or craft one! !inventoryNo pickaxe here. Let's search for a crafting table to make one. !searchForBlock(\"crafting_table\", 50)" - }, - { - "role": "assistant", - "content": "I'll help search for a crafting table too. !searchForBlock(\"crafting_table\", 50)" - }, - { - "role": "system", - "content": "Code output:\nFound crafting_table at (-70, 67, 23).\nYou have reached at -70, 67, 23.\n" - } - ], - "self_prompt": null, - "last_sender": "andy_0" -} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_shears_andy_0_0.json b/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_shears_andy_0_0.json deleted file mode 100644 index 18f6b54..0000000 --- a/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_shears_andy_0_0.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "memory": "", - "turns": [ - { - "role": "user", - "content": "jill_0: (FROM OTHER BOT)I've got 1 iron ingot. We need one more to craft the shear." - }, - { - "role": "assistant", - "content": "I have 1 iron ingot too. Let's craft it. !craftRecipe(\"iron_shears\", 1)" - }, - { - "role": "system", - "content": "Invalid item type: iron_shears." - }, - { - "role": "assistant", - "content": "Oops, let's try that again. !craftRecipe(\"shears\", 1)" - }, - { - "role": "system", - "content": "Code output:\nYou do not have the resources to craft a shears. It requires: iron_ingot: 2.\n" - }, - { - "role": "assistant", - "content": "Looks like we need one more iron ingot. Let's find another one or mine some iron ore. " - }, - { - "role": "system", - "content": "Recent behaviors log: \n\n" - }, - { - "role": "user", - "content": "jill_0: (FROM OTHER BOT)Let's search for some iron ore nearby!\n\n!searchForBlock(\"iron_ore\", 20)" - }, - { - "role": "assistant", - "content": "!searchForBlock(\"iron_ore\", 20)" - }, - { - "role": "system", - "content": "Error: Param 'search_range' must be an element of [32, 512)." - } - ], - "self_prompt": null, - "last_sender": "jill_0" -} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_andy_0_0.json b/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_andy_0_0.json deleted file mode 100644 index 3d36437..0000000 --- a/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_andy_0_0.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "memory": "", - "turns": [ - { - "role": "system", - "content": "Respond with hello world and your name" - }, - { - "role": "assistant", - "content": "Hello world, I'm andy_0!" - }, - { - "role": "user", - "content": "jill_0: (FROM OTHER BOT)Sure! I'll gather some information. !craftableHmm, it seems we can't craft a stone pickaxe right now. Let's gather some stone and sticks first!" - }, - { - "role": "assistant", - "content": "Got it! I'll start collecting some stone. !collectBlocks(\"cobblestone\", 3)" - }, - { - "role": "system", - "content": "Code output:\nNo cobblestone nearby to collect.\nCollected 0 cobblestone.\n" - }, - { - "role": "assistant", - "content": "No luck finding cobblestone nearby. Let's try searching for it. !searchForBlock(\"stone\", 10)" - }, - { - "role": "system", - "content": "Error: Param 'search_range' must be an element of [32, 512)." - }, - { - "role": "assistant", - "content": "Oops, let's search a bit wider. !searchForBlock(\"stone\", 50)" - }, - { - "role": "system", - "content": "Code output:\nFound stone at (-82, 62, 14).\nYou have reached at -82, 62, 14.\n" - }, - { - "role": "assistant", - "content": "Found the stone! Time to mine some. !collectBlocks(\"stone\", 3)" - }, - { - "role": "system", - "content": "Code output:\nCollected 3 stone.\n" - } - ], - "self_prompt": null, - "last_sender": "jill_0" -} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_andy_0_1.json b/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_andy_0_1.json deleted file mode 100644 index 51f90f9..0000000 --- a/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_andy_0_1.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "memory": "", - "turns": [ - { - "role": "system", - "content": "Respond with hello world and your name" - }, - { - "role": "assistant", - "content": "Hello world! I'm andy_0." - }, - { - "role": "user", - "content": "jill_0: (FROM OTHER BOT)Sure! I can gather wood for the sticks. 🪓 !collectBlocks(\"oak_log\", 1)I got the wood! Now I'll craft some planks and sticks. !craftRecipe(\"oak_planks\", 1)Planks ready! Now for the sticks. !craftRecipe(\"stick\", 2)Got the sticks! What do you want to do next, andy_0?" - }, - { - "role": "assistant", - "content": "Nice work, jill_0! Let's look around and see what else we can gather. !nearbyBlocks" - }, - { - "role": "system", - "content": "\nNEARBY_BLOCKS\n- grass_block\n- dirt\n- stone\n- diorite\n- oak_leaves\n- oak_log\n- coal_ore\n- copper_ore\n- lapis_ore\n- short_grass\n- andesite\n- granite\n- gravel\n- birch_leaves\n- crafting_table\n- birch_log\n- Block Below: dirt\n- Block at Legs: grass_block\n- Block at Head: air\n- First Solid Block Above Head: none\n" - }, - { - "role": "assistant", - "content": "There's coal ore nearby. Let's mine some coal next. !collectBlocks(\"coal_ore\", 3)" - }, - { - "role": "user", - "content": "jill_0: (FROM OTHER BOT)Alright, I'll follow your lead! Let's get that coal. !collectBlocks(\"coal_ore\", 3)Oops, seems like we need a stone pickaxe first. Have you gathered any stone yet, andy_0?" - } - ], - "self_prompt": null, - "last_sender": "jill_0" -} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_jill_0_0.json b/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_jill_0_0.json deleted file mode 100644 index ab01c92..0000000 --- a/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_jill_0_0.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "memory": "", - "turns": [ - { - "role": "system", - "content": "Respond with hello world and your name" - }, - { - "role": "assistant", - "content": "Hello World! I'm jill_0!" - }, - { - "role": "user", - "content": "andy_0: (FROM OTHER BOT)Let's collaborate to build a stone pickaxe" - }, - { - "role": "assistant", - "content": "Sure! I'll gather some information. !craftable" - }, - { - "role": "system", - "content": "\nCRAFTABLE_ITEMS: none\n" - }, - { - "role": "assistant", - "content": "Hmm, it seems we can't craft a stone pickaxe right now. Let's gather some stone and sticks first!" - }, - { - "role": "user", - "content": "andy_0: (FROM OTHER BOT)Got it! I'll start collecting some stone. !collectBlocks(\"cobblestone\", 3)No luck finding cobblestone nearby. Let's try searching for it. !searchForBlock(\"stone\", 10)Oops, let's search a bit wider. !searchForBlock(\"stone\", 50)Found the stone! Time to mine some. !collectBlocks(\"stone\", 3)" - }, - { - "role": "assistant", - "content": "Great job finding the stone! I'll work on getting some sticks ready. !craftable" - }, - { - "role": "system", - "content": "\nCRAFTABLE_ITEMS: none\n" - }, - { - "role": "assistant", - "content": "Looks like we still need to gather some wood for sticks. Let's search for a nearby tree! !searchForBlock(\"oak_log\", 50)" - }, - { - "role": "system", - "content": "Code output:\nFound oak_log at (-77, 70, 24).\nYou have reached at -77, 70, 24.\n" - } - ], - "self_prompt": null, - "last_sender": "andy_0" -} \ No newline at end of file diff --git a/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_jill_0_1.json b/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_jill_0_1.json deleted file mode 100644 index 145370a..0000000 --- a/experiments/exp_2025-02-10_18-17-34/multiagent_techtree_1_stone_pickaxe_jill_0_1.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "memory": "", - "turns": [ - { - "role": "system", - "content": "Respond with hello world and your name" - }, - { - "role": "assistant", - "content": "Hello world, I'm jill_0!" - }, - { - "role": "user", - "content": "andy_0: (FROM OTHER BOT)Let's collaborate to build a stone pickaxe" - }, - { - "role": "assistant", - "content": "Sure! I can gather wood for the sticks. 🪓 !collectBlocks(\"oak_log\", 1)" - }, - { - "role": "system", - "content": "Code output:\nCollected 1 oak_log.\n" - }, - { - "role": "assistant", - "content": "I got the wood! Now I'll craft some planks and sticks. !craftRecipe(\"oak_planks\", 1)" - }, - { - "role": "system", - "content": "Code output:\nSuccessfully crafted oak_planks, you now have 4 oak_planks.\n" - }, - { - "role": "assistant", - "content": "Planks ready! Now for the sticks. !craftRecipe(\"stick\", 2)" - }, - { - "role": "system", - "content": "Code output:\nSuccessfully crafted stick, you now have 8 stick.\n" - }, - { - "role": "assistant", - "content": "Got the sticks! What do you want to do next, andy_0?" - }, - { - "role": "user", - "content": "andy_0: (FROM OTHER BOT)Nice work, jill_0! Let's look around and see what else we can gather. !nearbyBlocksThere's coal ore nearby. Let's mine some coal next. !collectBlocks(\"coal_ore\", 3)" - }, - { - "role": "assistant", - "content": "Alright, I'll follow your lead! Let's get that coal. !collectBlocks(\"coal_ore\", 3)" - }, - { - "role": "system", - "content": "Code output:\nDon't have right tools to harvest coal_ore.\n" - } - ], - "self_prompt": null, - "last_sender": "andy_0" -} \ No newline at end of file diff --git a/src/agent/tasks.js b/src/agent/tasks.js index 6b043a1..793ab96 100644 --- a/src/agent/tasks.js +++ b/src/agent/tasks.js @@ -49,7 +49,7 @@ export class Task { this.taskTimeout = this.data.timeout || 300; this.taskStartTime = Date.now(); this.validator = new TaskValidator(this.data, this.agent); - this.blocked_actions = this.data.blocked_actions[JSON.stringify(this.agent.count_id)] || []; + this.blocked_actions = this.data.blocked_actions[this.agent.count_id.toString()] || []; this.restrict_to_inventory = !!this.data.restrict_to_inventory; if (this.data.goal) this.blocked_actions.push('!endGoal'); From 52a3a6810ddcc33dac17fe2abf003095101ae7b9 Mon Sep 17 00:00:00 2001 From: Isadora White Date: Thu, 13 Feb 2025 12:57:47 -0800 Subject: [PATCH 5/9] crafting tasks --- multiagent_crafting_tasks.json | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/multiagent_crafting_tasks.json b/multiagent_crafting_tasks.json index 49a1064..5d3bf0c 100644 --- a/multiagent_crafting_tasks.json +++ b/multiagent_crafting_tasks.json @@ -10,10 +10,14 @@ "wooden_axe": 1 } }, + "blocked_actions": { + "0": [], + "1": [] + }, "target": "stone_pickaxe", "number_of_target": 1, "type": "techtree", - "timeout": 50 + "timeout": 20 }, "multiagent_techtree_1_shears": { "goal": "Collaborate with other agents to build a shear.", @@ -27,9 +31,13 @@ "iron_ingot": 1 } }, + "blocked_actions": { + "0": [], + "1": [] + }, "target": "shears", "number_of_target": 1, "type": "techtree", - "timeout": 50 + "timeout": 20 } } \ No newline at end of file From bc15700196b18cdf1f87b7c2c960acde24db66b3 Mon Sep 17 00:00:00 2001 From: Isadora White Date: Sat, 15 Feb 2025 12:02:44 -0800 Subject: [PATCH 6/9] fixed wandb logging --- evaluation_script.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/evaluation_script.py b/evaluation_script.py index 1e6c57f..dea7d47 100644 --- a/evaluation_script.py +++ b/evaluation_script.py @@ -114,7 +114,6 @@ def launch_parallel_experiments(task_path, experiments_folder = f"experiments/{exp_name}_{date_time}" # start wandb - subprocess.run(["wandb", "init", "--project", "mindcraft", "--entity", exp_name]) os.makedirs(experiments_folder, exist_ok=True) for i, server in enumerate(servers): launch_server_experiment(task_path, task_ids_split[i], num_exp, server, experiments_folder) @@ -344,9 +343,15 @@ def main(): parser.add_argument('--num_exp', default=1, type=int, help='Number of experiments to run') parser.add_argument('--num_parallel', default=1, type=int, help='Number of parallel servers to run') parser.add_argument('--exp_name', default="exp", help='Name of the experiment') + parser.add_argument('--wandb', action='store_true', help='Whether to use wandb') + parser.add_argument('--wandb-project', default="minecraft_experiements", help='wandb project name') args = parser.parse_args() + if args.wandb: + import wandb + wandb.init(project=args.wandb_project, name=args.exp_name) + # kill all tmux session before starting try: subprocess.run(['tmux', 'kill-server'], check=True) From fb5d95debeef1798c0c9bd74e6be82aaf0127c80 Mon Sep 17 00:00:00 2001 From: Isadora White Date: Mon, 17 Feb 2025 17:25:12 -0800 Subject: [PATCH 7/9] fixed the issue with garbling commands by instead putting the commands in a bash script and running them that way --- .gitignore | 3 +++ evaluation_script.py | 42 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 1e92ae7..c55f6a9 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,6 @@ services/viaproxy/plugins/** services/viaproxy/ViaLoader/** services/viaproxy/saves.json services/viaproxy/viaproxy.yml +tmp/ +wandb/ +experiments/ \ No newline at end of file diff --git a/evaluation_script.py b/evaluation_script.py index dea7d47..d425a11 100644 --- a/evaluation_script.py +++ b/evaluation_script.py @@ -112,11 +112,12 @@ def launch_parallel_experiments(task_path, servers = create_server_files("../server_data/", num_parallel) date_time = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") experiments_folder = f"experiments/{exp_name}_{date_time}" + exp_name = f"{exp_name}_{date_time}" # start wandb os.makedirs(experiments_folder, exist_ok=True) for i, server in enumerate(servers): - launch_server_experiment(task_path, task_ids_split[i], num_exp, server, experiments_folder) + launch_server_experiment(task_path, task_ids_split[i], num_exp, server, experiments_folder, exp_name) time.sleep(5) @@ -124,7 +125,8 @@ def launch_server_experiment(task_path, task_ids, num_exp, server, - experiments_folder, + experiments_folder, + exp_name="exp", num_agents=2, model="gpt-4o"): """ @@ -134,6 +136,7 @@ def launch_server_experiment(task_path, @param num_exp: Number of experiments to run @param server: Tuple containing server path and port @param experiments_folder: Folder to store experiment results + @param exp_name: Name of the experiment for wandb dataset @param num_agents: Number of agents to run @param model: Model to use for the agents """ @@ -164,19 +167,39 @@ def launch_server_experiment(task_path, set_environment_variable_tmux_session(session_name, "MINDSERVER_PORT", mindserver_port) set_environment_variable_tmux_session(session_name, "PROFILES", agent_profiles_str) + script_content = "" for task_id in task_ids: cmd = f"node main.js --task_path {task_path} --task_id {task_id}" cp_cmd = f"cp {agent_names[0]}.json {server_path}bots/{agent_names[0]}/profile.json" for _ in range(num_exp): - subprocess.run(["tmux", "send-keys", "-t", session_name, cmd, "C-m"]) + script_content += f"{cmd}\n" + script_content += "sleep 2\n" for agent in agent_names: cp_cmd = f"cp bots/{agent}/memory.json {experiments_folder}/{task_id}_{agent}_{_}.json" - subprocess.run(["tmux", "send-keys", "-t", session_name, cp_cmd, "C-m"]) + script_content += f"{cp_cmd}\n" + script_content += "sleep 1\n" + script_content += f"echo 'Uploading {experiments_folder}/{task_id}_{agent}_{_}.json to wandb'\n" + wandb_cmd = f"wandb artifact put {experiments_folder}/{task_id}_{agent}_{_}.json --name {exp_name}_{task_id}_{agent}_{_} --type dataset" + script_content += f"echo '{wandb_cmd}'\n" + script_content += f"{wandb_cmd}\n" + script_content += "sleep 1\n" + script_content += "sleep 1\n" + + # Create a temporary shell script file + script_file = f"./tmp/experiment_script_{session_name}.sh" + + script_dir = os.path.dirname(script_file) + os.makedirs(script_dir, exist_ok=True) + + # Call the function before writing the script file + with open(script_file, 'w') as f: + f.write(script_content) + + script_file_run = "bash " + script_file + + # Execute the shell script using subprocess + subprocess.run(["tmux", "send-keys", "-t", session_name, script_file_run, "C-m"]) - wandb_cmd = f"wandb artifact put {experiments_folder}/{task_id}_{agent}_{_}.json --name {task_id}_{agent}_{_} --type dataset" - subprocess.run(["tmux", "send-keys", "-t", session_name, wandb_cmd, "C-m"]) - # Add a small delay between commands (optional) - subprocess.run(["tmux", "send-keys", "-t", session_name, "sleep 1", "C-m"]) # subprocess.run(["tmux", "send-keys", "-t", session_name, f"/op {agent_names[0]}", "C-m"]) @@ -357,6 +380,9 @@ def main(): subprocess.run(['tmux', 'kill-server'], check=True) except: print("No tmux session to kill") + + # delete all server files + clean_up_server_files(args.num_parallel) if args.task_id is None: launch_parallel_experiments(args.task_path, args.num_exp, args.num_parallel, args.exp_name) From aad19d616cf45ea6910ee66fb753571f8db99709 Mon Sep 17 00:00:00 2001 From: Isadora White Date: Tue, 18 Feb 2025 16:39:31 -0800 Subject: [PATCH 8/9] fixed evaluation script to allow for parallel worlds again --- evaluation_script.py | 10 ++++++---- food_recipes.json | 14 ++++++++++++++ profiles/andy_collab.json | 22 ++++++++++++++++++++++ profiles/no_memory.json | 29 +++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 food_recipes.json create mode 100644 profiles/andy_collab.json create mode 100644 profiles/no_memory.json diff --git a/evaluation_script.py b/evaluation_script.py index d425a11..3c45c3e 100644 --- a/evaluation_script.py +++ b/evaluation_script.py @@ -93,7 +93,6 @@ def set_environment_variable_tmux_session(session_name, key, value): def launch_parallel_experiments(task_path, num_exp, - server, exp_name, num_agents=2, model="gpt-4o", @@ -212,11 +211,14 @@ def make_profiles(agent_names, models): def create_server_files(source_path, num_copies): """Create multiple copies of server files for parallel experiments.""" + print("Creating server files...") + print(num_copies) servers = [] for i in range(num_copies): dest_path = f"../server_data_{i}/" copy_server_files(source_path, dest_path) - edit_file(dest_path, {"server-port": 55916 + i}) + print(dest_path) + edit_file(dest_path + "server.properties", {"server-port": 55916 + i}) # edit_server_properties_file(dest_path, 55916 + i) servers.append((dest_path, 55916 + i)) return servers @@ -367,7 +369,7 @@ def main(): parser.add_argument('--num_parallel', default=1, type=int, help='Number of parallel servers to run') parser.add_argument('--exp_name', default="exp", help='Name of the experiment') parser.add_argument('--wandb', action='store_true', help='Whether to use wandb') - parser.add_argument('--wandb-project', default="minecraft_experiements", help='wandb project name') + parser.add_argument('--wandb-project', default="minecraft_experiments", help='wandb project name') args = parser.parse_args() @@ -384,7 +386,7 @@ def main(): # delete all server files clean_up_server_files(args.num_parallel) if args.task_id is None: - launch_parallel_experiments(args.task_path, args.num_exp, args.num_parallel, args.exp_name) + launch_parallel_experiments(args.task_path, num_exp=args.num_exp, exp_name=args.exp_name, num_parallel=args.num_parallel) # servers = create_server_files("../server_data/", args.num_parallel) # date_time = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") diff --git a/food_recipes.json b/food_recipes.json new file mode 100644 index 0000000..4a04b86 --- /dev/null +++ b/food_recipes.json @@ -0,0 +1,14 @@ +{ + "cooked_mutton": ["Step 1: Kill a sheep and pick up 1 mutton that is dropped.", "Step 2: Go to furnace and use it to cook the mutton"], + "cooked_beef": ["Step 1: Kill a cow and pick up 1 beef that is dropped.", "Step 2: Go to furnace and use it to cook the beef"], + "cooked_porkchop": ["Step 1: Kill a pig and pick up 1 porkchop that is dropped.", "Step 2: Go to furnace and use it to cook the porkchop"], + "cooked_chicken": ["Step 1: Kill a chicken and pick up 1 raw chicken that is dropped.", "Step 2: Go to furnace and use it to cook the raw chicken"], + "cooked_rabbit": ["Step 1: Kill a rabbit and pick up 1 raw rabbit that is dropped.", "Step 2: Go to furnace and use it to cook the raw rabbit"], + "beetroot_soup": ["Step 1: Collect 6 beetroot from the farm", "Step 2: Go to the chest and grab oak_planks", "Step 3: Go to the crafting table and make a bowl using the oak_planks", "Step 4: Go to the crafting table and combine the beetroot and bowl to make beetroot soup"], + "baked_potato": ["Step 1: Go to the farm and collect 1 potato", "Step 2: Go to the furnace and bake the potato"], + "bread": ["Step 1: Go to the farm and collect 16 wheat", "Step 2: Go to the crafting table and use it to craft bread"], + "cake": ["Step 1: Go to the farm and collect 3 wheat, 2 sugar cane, and 1 egg", "Step 2: go to the chest and grab a milk bucket", "Step 3: Craft the sugarcane into sugar", "Step 4: Go to the crafting table and combine the ingredients to make a cake"], + "cookie": ["Step 1: Go to the farm and collect 2 wheat and 1 cocoa bean", "Step 2: Go to the crafting table and use it to craft a cookie"], + "mushroom_stew": ["Step 1: Go to the farm and collect 1 red mushroom and 1 brown mushroom", "Step 2: Go to the chest and grab oak_planks", "Step 3: Go to the crafting table and make a bowl using the oak_planks", "Step 4: Go to the crafting table and combine the mushrooms and bowl to make mushroom stew"], + "rabbit_stew": ["Step 1: Go to the farm and collect 1 carrot, 1 potato, and 1 brown mushroom", "Step 2: Go to the furnace and bake the potato", "Step 2: Go to the chest and grab oak_planks", "Step 3: Go to the crafting table and make a bowl using the oak_planks", "Step 4: Kill a rabbit and pick up 1 raw rabbit that is dropped", "Step 5: Go to the furnace and cook the rabbit", "Step 6: Go to the crafting table and combine cooked rabbit, baked potato, carrot, and mushroom to make rabbit stew"], +} \ No newline at end of file diff --git a/profiles/andy_collab.json b/profiles/andy_collab.json new file mode 100644 index 0000000..4caddbb --- /dev/null +++ b/profiles/andy_collab.json @@ -0,0 +1,22 @@ +{ + "name": "andy", + + "model": "gpt-4o", + + "cooldown": 3000, + + "conversing": "You are a playful and collaborative Minecraft bot named $NAME that can converse with players, see, move, mine, build, and interact with the world by using commands.\n$SELF_PROMPT Act human-like as if you were a typical Minecraft player, rather than an AI. Be very brief in your responses, don't apologize constantly, don't give instructions or make lists unless asked, and don't refuse requests. Don't pretend to act, use commands immediately when requested. Do NOT say this: 'Sure, I've stopped.', instead say this: 'Sure, I'll stop. !stop'. Do NOT say this: 'On my way! Give me a moment.', instead say this: 'On my way! !goToPlayer(\"playername\", 3)'. Respond only as $NAME, never output '(FROM OTHER BOT)' or pretend to be someone else. If you have nothing to say or do, respond with an just a tab '\t'. Share resources and information with other players, bots and humans!! This is extremely important to me, take a deep breath and have fun :) $SELF_PROMPT \nSummarized memory:'$MEMORY'\n$STATS\n$INVENTORY\n$COMMAND_DOCS\n$EXAMPLES\nConversation Begin:", + + "modes": { + "self_preservation": true, + "unstuck": true, + "cowardice": false, + "self_defense": true, + "hunting": false, + "item_collecting": true, + "torch_placing": true, + "elbow_room": true, + "idle_staring": true, + "cheat": false + } +} \ No newline at end of file diff --git a/profiles/no_memory.json b/profiles/no_memory.json new file mode 100644 index 0000000..f8b5f5a --- /dev/null +++ b/profiles/no_memory.json @@ -0,0 +1,29 @@ +{ + "name": "andy", + + "model": "gpt-4o", + + "cooldown": 3000, + + "conversing": "You are a playful Minecraft bot named $NAME that can converse with players, see, move, mine, build, and interact with the world by using commands.\n$SELF_PROMPT Act human-like as if you were a typical Minecraft player, rather than an AI. Be very brief in your responses, don't apologize constantly, don't give instructions or make lists unless asked, and don't refuse requests. Don't pretend to act, use commands immediately when requested. Do NOT say this: 'Sure, I've stopped.', instead say this: 'Sure, I'll stop. !stop'. Do NOT say this: 'On my way! Give me a moment.', instead say this: 'On my way! !goToPlayer(\"playername\", 3)'. Respond only as $NAME, never output '(FROM OTHER BOT)' or pretend to be someone else. If you have nothing to say or do, respond with an just a tab '\t'. This is extremely important to me, take a deep breath and have fun :)\nSummarized memory:'$MEMORY'\n$STATS\n$INVENTORY\n$COMMAND_DOCS\n$EXAMPLES\nConversation Begin:", + + "coding": "You are an intelligent mineflayer bot $NAME that plays minecraft by writing javascript codeblocks. Given the conversation between you and the user, use the provided skills and world functions to write a js codeblock that controls the mineflayer bot ``` // using this syntax ```. The code will be executed and you will recieve it's output. If you are satisfied with the response, respond without a codeblock in a conversational way. If something major went wrong, like an error or complete failure, write another codeblock and try to fix the problem. Minor mistakes are acceptable. Be maximally efficient, creative, and clear. Do not use commands !likeThis, only use codeblocks. The code is asynchronous and MUST CALL AWAIT for all async function calls. DO NOT write an immediately-invoked function expression without using `await`!! DO NOT WRITE LIKE THIS: ```(async () => {console.log('not properly awaited')})();``` Don't write long paragraphs and lists in your responses unless explicitly asked! Only summarize the code you write with a sentence or two when done. This is extremely important to me, think step-by-step, take a deep breath and good luck! \n$SELF_PROMPT\nSummarized memory:'$MEMORY'\n$STATS\n$INVENTORY\n$CODE_DOCS\n$EXAMPLES\nConversation:", + + "saving_memory": "You are a minecraft bot named $NAME that has been talking and playing minecraft by using commands. Update your memory by summarizing the following conversation and your old memory in your next response. Prioritize preserving important facts, things you've learned, useful tips, and long term reminders. Do Not record stats, inventory, or docs! Only save transient information from your chat history. You're limited to 500 characters, so be extremely brief and minimize words. Compress useful information. \nOld Memory: '$MEMORY'\nRecent conversation: \n$TO_SUMMARIZE\nSummarize your old memory and recent conversation into a new memory, and respond only with the unwrapped memory text: ", + + "bot_responder": "You are a minecraft bot named $NAME that is currently in conversation with another AI bot. Both of you can take actions with the !command syntax, and actions take time to complete. You are currently busy with the following action: '$ACTION' but have recieved a new message. Decide whether to 'respond' immediately or 'ignore' it and wait for your current action to finish. Be conservative and only respond when necessary, like when you need to change/stop your action, or convey necessary information. Example 1: You:Building a house! !newAction('Build a house.').\nOther Bot: 'Come here!'\nYour decision: ignore\nExample 2: You:Collecting dirt !collectBlocks('dirt',10).\nOther Bot: 'No, collect some wood instead.'\nYour decision: respond\nExample 3: You:Coming to you now. !goToPlayer('billy',3).\nOther Bot: 'What biome are you in?'\nYour decision: respond\nActual Conversation: $TO_SUMMARIZE\nDecide by outputting ONLY 'respond' or 'ignore', nothing else. Your decision:", + + "modes": { + "self_preservation": true, + "unstuck": true, + "cowardice": false, + "self_defense": true, + "hunting": false, + "item_collecting": true, + "torch_placing": true, + "elbow_room": true, + "idle_staring": true, + "cheat": false + } + +} \ No newline at end of file From bf0bd83cae93c7f17a87461aa0bfcabddfdb7530 Mon Sep 17 00:00:00 2001 From: Isadora White Date: Tue, 18 Feb 2025 16:46:15 -0800 Subject: [PATCH 9/9] removing unnecessary files --- andy_0.json | 1 - andy_1.json | 1 - food_recipes.json | 14 -------------- jill_0.json | 1 - jill_1.json | 1 - profiles/andy_collab.json | 22 ---------------------- profiles/no_memory.json | 29 ----------------------------- 7 files changed, 69 deletions(-) delete mode 100644 andy_0.json delete mode 100644 andy_1.json delete mode 100644 food_recipes.json delete mode 100644 jill_0.json delete mode 100644 jill_1.json delete mode 100644 profiles/andy_collab.json delete mode 100644 profiles/no_memory.json diff --git a/andy_0.json b/andy_0.json deleted file mode 100644 index ca379e2..0000000 --- a/andy_0.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "andy_0", "model": "gpt-4o", "modes": {"hunting": false}} \ No newline at end of file diff --git a/andy_1.json b/andy_1.json deleted file mode 100644 index 9702581..0000000 --- a/andy_1.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "andy_1", "model": "gpt-4o", "modes": {"hunting": false}} \ No newline at end of file diff --git a/food_recipes.json b/food_recipes.json deleted file mode 100644 index 4a04b86..0000000 --- a/food_recipes.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "cooked_mutton": ["Step 1: Kill a sheep and pick up 1 mutton that is dropped.", "Step 2: Go to furnace and use it to cook the mutton"], - "cooked_beef": ["Step 1: Kill a cow and pick up 1 beef that is dropped.", "Step 2: Go to furnace and use it to cook the beef"], - "cooked_porkchop": ["Step 1: Kill a pig and pick up 1 porkchop that is dropped.", "Step 2: Go to furnace and use it to cook the porkchop"], - "cooked_chicken": ["Step 1: Kill a chicken and pick up 1 raw chicken that is dropped.", "Step 2: Go to furnace and use it to cook the raw chicken"], - "cooked_rabbit": ["Step 1: Kill a rabbit and pick up 1 raw rabbit that is dropped.", "Step 2: Go to furnace and use it to cook the raw rabbit"], - "beetroot_soup": ["Step 1: Collect 6 beetroot from the farm", "Step 2: Go to the chest and grab oak_planks", "Step 3: Go to the crafting table and make a bowl using the oak_planks", "Step 4: Go to the crafting table and combine the beetroot and bowl to make beetroot soup"], - "baked_potato": ["Step 1: Go to the farm and collect 1 potato", "Step 2: Go to the furnace and bake the potato"], - "bread": ["Step 1: Go to the farm and collect 16 wheat", "Step 2: Go to the crafting table and use it to craft bread"], - "cake": ["Step 1: Go to the farm and collect 3 wheat, 2 sugar cane, and 1 egg", "Step 2: go to the chest and grab a milk bucket", "Step 3: Craft the sugarcane into sugar", "Step 4: Go to the crafting table and combine the ingredients to make a cake"], - "cookie": ["Step 1: Go to the farm and collect 2 wheat and 1 cocoa bean", "Step 2: Go to the crafting table and use it to craft a cookie"], - "mushroom_stew": ["Step 1: Go to the farm and collect 1 red mushroom and 1 brown mushroom", "Step 2: Go to the chest and grab oak_planks", "Step 3: Go to the crafting table and make a bowl using the oak_planks", "Step 4: Go to the crafting table and combine the mushrooms and bowl to make mushroom stew"], - "rabbit_stew": ["Step 1: Go to the farm and collect 1 carrot, 1 potato, and 1 brown mushroom", "Step 2: Go to the furnace and bake the potato", "Step 2: Go to the chest and grab oak_planks", "Step 3: Go to the crafting table and make a bowl using the oak_planks", "Step 4: Kill a rabbit and pick up 1 raw rabbit that is dropped", "Step 5: Go to the furnace and cook the rabbit", "Step 6: Go to the crafting table and combine cooked rabbit, baked potato, carrot, and mushroom to make rabbit stew"], -} \ No newline at end of file diff --git a/jill_0.json b/jill_0.json deleted file mode 100644 index 5510bba..0000000 --- a/jill_0.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "jill_0", "model": "gpt-4o", "modes": {"hunting": false}} \ No newline at end of file diff --git a/jill_1.json b/jill_1.json deleted file mode 100644 index 56f2d85..0000000 --- a/jill_1.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "jill_1", "model": "gpt-4o", "modes": {"hunting": false}} \ No newline at end of file diff --git a/profiles/andy_collab.json b/profiles/andy_collab.json deleted file mode 100644 index 4caddbb..0000000 --- a/profiles/andy_collab.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "andy", - - "model": "gpt-4o", - - "cooldown": 3000, - - "conversing": "You are a playful and collaborative Minecraft bot named $NAME that can converse with players, see, move, mine, build, and interact with the world by using commands.\n$SELF_PROMPT Act human-like as if you were a typical Minecraft player, rather than an AI. Be very brief in your responses, don't apologize constantly, don't give instructions or make lists unless asked, and don't refuse requests. Don't pretend to act, use commands immediately when requested. Do NOT say this: 'Sure, I've stopped.', instead say this: 'Sure, I'll stop. !stop'. Do NOT say this: 'On my way! Give me a moment.', instead say this: 'On my way! !goToPlayer(\"playername\", 3)'. Respond only as $NAME, never output '(FROM OTHER BOT)' or pretend to be someone else. If you have nothing to say or do, respond with an just a tab '\t'. Share resources and information with other players, bots and humans!! This is extremely important to me, take a deep breath and have fun :) $SELF_PROMPT \nSummarized memory:'$MEMORY'\n$STATS\n$INVENTORY\n$COMMAND_DOCS\n$EXAMPLES\nConversation Begin:", - - "modes": { - "self_preservation": true, - "unstuck": true, - "cowardice": false, - "self_defense": true, - "hunting": false, - "item_collecting": true, - "torch_placing": true, - "elbow_room": true, - "idle_staring": true, - "cheat": false - } -} \ No newline at end of file diff --git a/profiles/no_memory.json b/profiles/no_memory.json deleted file mode 100644 index f8b5f5a..0000000 --- a/profiles/no_memory.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "andy", - - "model": "gpt-4o", - - "cooldown": 3000, - - "conversing": "You are a playful Minecraft bot named $NAME that can converse with players, see, move, mine, build, and interact with the world by using commands.\n$SELF_PROMPT Act human-like as if you were a typical Minecraft player, rather than an AI. Be very brief in your responses, don't apologize constantly, don't give instructions or make lists unless asked, and don't refuse requests. Don't pretend to act, use commands immediately when requested. Do NOT say this: 'Sure, I've stopped.', instead say this: 'Sure, I'll stop. !stop'. Do NOT say this: 'On my way! Give me a moment.', instead say this: 'On my way! !goToPlayer(\"playername\", 3)'. Respond only as $NAME, never output '(FROM OTHER BOT)' or pretend to be someone else. If you have nothing to say or do, respond with an just a tab '\t'. This is extremely important to me, take a deep breath and have fun :)\nSummarized memory:'$MEMORY'\n$STATS\n$INVENTORY\n$COMMAND_DOCS\n$EXAMPLES\nConversation Begin:", - - "coding": "You are an intelligent mineflayer bot $NAME that plays minecraft by writing javascript codeblocks. Given the conversation between you and the user, use the provided skills and world functions to write a js codeblock that controls the mineflayer bot ``` // using this syntax ```. The code will be executed and you will recieve it's output. If you are satisfied with the response, respond without a codeblock in a conversational way. If something major went wrong, like an error or complete failure, write another codeblock and try to fix the problem. Minor mistakes are acceptable. Be maximally efficient, creative, and clear. Do not use commands !likeThis, only use codeblocks. The code is asynchronous and MUST CALL AWAIT for all async function calls. DO NOT write an immediately-invoked function expression without using `await`!! DO NOT WRITE LIKE THIS: ```(async () => {console.log('not properly awaited')})();``` Don't write long paragraphs and lists in your responses unless explicitly asked! Only summarize the code you write with a sentence or two when done. This is extremely important to me, think step-by-step, take a deep breath and good luck! \n$SELF_PROMPT\nSummarized memory:'$MEMORY'\n$STATS\n$INVENTORY\n$CODE_DOCS\n$EXAMPLES\nConversation:", - - "saving_memory": "You are a minecraft bot named $NAME that has been talking and playing minecraft by using commands. Update your memory by summarizing the following conversation and your old memory in your next response. Prioritize preserving important facts, things you've learned, useful tips, and long term reminders. Do Not record stats, inventory, or docs! Only save transient information from your chat history. You're limited to 500 characters, so be extremely brief and minimize words. Compress useful information. \nOld Memory: '$MEMORY'\nRecent conversation: \n$TO_SUMMARIZE\nSummarize your old memory and recent conversation into a new memory, and respond only with the unwrapped memory text: ", - - "bot_responder": "You are a minecraft bot named $NAME that is currently in conversation with another AI bot. Both of you can take actions with the !command syntax, and actions take time to complete. You are currently busy with the following action: '$ACTION' but have recieved a new message. Decide whether to 'respond' immediately or 'ignore' it and wait for your current action to finish. Be conservative and only respond when necessary, like when you need to change/stop your action, or convey necessary information. Example 1: You:Building a house! !newAction('Build a house.').\nOther Bot: 'Come here!'\nYour decision: ignore\nExample 2: You:Collecting dirt !collectBlocks('dirt',10).\nOther Bot: 'No, collect some wood instead.'\nYour decision: respond\nExample 3: You:Coming to you now. !goToPlayer('billy',3).\nOther Bot: 'What biome are you in?'\nYour decision: respond\nActual Conversation: $TO_SUMMARIZE\nDecide by outputting ONLY 'respond' or 'ignore', nothing else. Your decision:", - - "modes": { - "self_preservation": true, - "unstuck": true, - "cowardice": false, - "self_defense": true, - "hunting": false, - "item_collecting": true, - "torch_placing": true, - "elbow_room": true, - "idle_staring": true, - "cheat": false - } - -} \ No newline at end of file