return action
Rock, Paper, Scissors#
We can now run a simulation of a multi-agent rock, paper, scissors game using the PettingZooAgent.
from pettingzoo.classic import rps_v2
env = rps_v2.env(max_cycles=3, render_mode="human")
agents = {name: PettingZooAgent(name=name, model=ChatOpenAI(temperature=1), env=env) for name in env.possible_agents}
main(agents, env)
Observation: 3
Reward: 0
Termination: False
Truncation: False
Return: 0
        
Action: 1
Observation: 3
Reward: 0
Termination: False
Truncation: False
Return: 0
        
Action: 1
Observation: 1
Reward: 0
Termination: False
Truncation: False
Return: 0
        
Action: 2
Observation: 1
Reward: 0
Termination: False
Truncation: False
Return: 0
        
Action: 1
Observation: 1
Reward: 1
Termination: False
Truncation: False
Return: 1
        
Action: 0
Observation: 2
Reward: -1
Termination: False
Truncation: False
Return: -1
        
Action: 0
Observation: 0
Reward: 0
Termination: False
Truncation: True
Return: 1
        
Action: None
Observation: 0
Reward: 0
Termination: False
Truncation: True
Return: -1
        
Action: None
ActionMaskAgent#
rtdocs_stable/api.python.langchain.com/en/stable/use_cases/agent_simulations/petting_zoo.html