mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-08-01 04:45:40 +02:00
small changes
This commit is contained in:
parent
caa5c389e7
commit
6e48f06e1d
24 changed files with 862 additions and 30 deletions
1
andy_0.json
Normal file
1
andy_0.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"name": "andy_0", "model": "gpt-4o", "modes": {"hunting": false}}
|
1
andy_1.json
Normal file
1
andy_1.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"name": "andy_1", "model": "gpt-4o", "modes": {"hunting": false}}
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
1
jill_0.json
Normal file
1
jill_0.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"name": "jill_0", "model": "gpt-4o", "modes": {"hunting": false}}
|
1
jill_1.json
Normal file
1
jill_1.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"name": "jill_1", "model": "gpt-4o", "modes": {"hunting": false}}
|
35
multiagent_crafting_tasks.json
Normal file
35
multiagent_crafting_tasks.json
Normal file
|
@ -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
|
||||
}
|
||||
}
|
|
@ -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",
|
||||
|
|
|
@ -92,7 +92,7 @@ export class Agent {
|
|||
this.startEvents();
|
||||
|
||||
this.task.initBotTask();
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error in spawn event:', error);
|
||||
process.exit(0);
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue