games.monopoly.player_agent¶

Monopoly player agent implementation.

This module provides the player agent (subgraph) for making individual player decisions in Monopoly, including:

  • Property purchase decisions

  • Jail decisions

  • Building decisions

  • Trade negotiations

Classes¶

MonopolyGameAgentConfig

Configuration class for monopoly game agents.

MonopolyPlayerAgent

Player agent for making individual decisions in Monopoly.

MonopolyPlayerAgentConfig

Configuration for monopoly player decision agent.

PlayerDecisionState

State for player decision subgraph.

Module Contents¶

class games.monopoly.player_agent.MonopolyGameAgentConfig¶

Bases: haive.core.engine.agent.config.AgentConfig

Configuration class for monopoly game agents.

This class defines the configuration parameters for monopoly agents, including:
  • Game settings (players, turn limits)

  • Player decision configurations

  • Board and game state initialization

state_schema¶

The state schema for the game

Type:

type

player_names¶

Names of players in the game

Type:

List[str]

max_turns¶

Maximum turns before ending game

Type:

int

enable_trading¶

Whether to enable trade negotiations

Type:

bool

enable_building¶

Whether to enable house/hotel building

Type:

bool

class Config¶

Pydantic configuration class.

create_initial_state()¶

Create the initial game state with all required fields and proper. validation.

Return type:

haive.games.monopoly.state.MonopolyState

create_player_agent()¶

Create the player decision agent.

Return type:

Any

setup_player_agent_engines()¶

Set up the engines for the player agent if not already configured.

Return type:

None

class games.monopoly.player_agent.MonopolyPlayerAgent(config)¶

Bases: haive.core.engine.agent.agent.Agent[MonopolyPlayerAgentConfig]

Player agent for making individual decisions in Monopoly.

Initialize the player agent.

Parameters:

config (MonopolyPlayerAgentConfig)

get_decision_route(state)¶

Get the route for the decision.

Parameters:

state (pydantic.BaseModel)

Return type:

str

make_building_decision(state)¶

Make a building decision.

Parameters:

state (pydantic.BaseModel)

Return type:

langgraph.types.Command

make_jail_decision(state)¶

Make a jail-related decision.

Parameters:

state (pydantic.BaseModel)

Return type:

langgraph.types.Command

make_property_decision(state)¶

Make a property purchase decision.

Parameters:

state (pydantic.BaseModel)

Return type:

langgraph.types.Command

make_trade_decision(state)¶

Make a trade decision.

Parameters:

state (pydantic.BaseModel)

Return type:

langgraph.types.Command

route_decision(state)¶

Route to appropriate decision node based on decision type.

Parameters:

state (pydantic.BaseModel)

Return type:

langgraph.types.Command

setup_workflow()¶

Set up the player decision workflow.

Return type:

None

class games.monopoly.player_agent.MonopolyPlayerAgentConfig¶

Bases: haive.core.engine.agent.config.AgentConfig

Configuration for monopoly player decision agent.

class games.monopoly.player_agent.PlayerDecisionState(/, **data)¶

Bases: haive.core.schema.prebuilt.messages_state.MessagesState

State for player decision subgraph.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

property decision: haive.games.monopoly.models.PropertyDecision | haive.games.monopoly.models.JailDecision | haive.games.monopoly.models.BuildingDecision | haive.games.monopoly.models.TradeResponse | str | Any¶

Get the decision.

Return type:

haive.games.monopoly.models.PropertyDecision | haive.games.monopoly.models.JailDecision | haive.games.monopoly.models.BuildingDecision | haive.games.monopoly.models.TradeResponse | str | Any