haive.games.monopoly.game_agent¶

Fixed Monopoly game agent implementation.

This module provides the corrected main game agent for orchestrating a Monopoly game, with proper handling of BaseModel objects from LangGraph instead of dictionaries.

Classes¶

MonopolyGameAgent

Main game agent for orchestrating Monopoly.

MonopolyGameAgentConfig

Configuration for monopoly game agent.

Module Contents¶

class haive.games.monopoly.game_agent.MonopolyGameAgent(config)[source]¶

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

Main game agent for orchestrating Monopoly.

Initialize the game agent.

Parameters:

config (MonopolyGameAgentConfig)

check_doubles(state)[source]¶

Check if doubles were rolled and handle accordingly.

Parameters:

state (haive.games.monopoly.state.MonopolyState | pydantic.BaseModel | dict[str, Any])

Return type:

langgraph.types.Command

check_game_end_node(state)[source]¶

Check if the game should end.

Parameters:

state (haive.games.monopoly.state.MonopolyState | pydantic.BaseModel | dict[str, Any])

Return type:

langgraph.types.Command

end_turn(state)[source]¶

End the current player’s turn.

Parameters:

state (haive.games.monopoly.state.MonopolyState | pydantic.BaseModel | dict[str, Any])

Return type:

langgraph.types.Command

handle_jail_turn(state)[source]¶

Handle a turn when player is in jail.

Parameters:

state (haive.games.monopoly.state.MonopolyState)

Return type:

langgraph.types.Command

handle_landing(state)[source]¶

Handle the player landing on a space.

Parameters:

state (haive.games.monopoly.state.MonopolyState | pydantic.BaseModel | dict[str, Any])

Return type:

langgraph.types.Command

handle_property_space(state, property_name)[source]¶

Handle landing on a property space.

Parameters:
  • state (haive.games.monopoly.state.MonopolyState)

  • property_name (str)

Return type:

langgraph.types.Command

handle_special_space(state, space_name)[source]¶

Handle landing on special spaces like GO, Jail, etc.

Parameters:
  • state (haive.games.monopoly.state.MonopolyState)

  • space_name (str)

Return type:

langgraph.types.Command

move_player_node(state)[source]¶

Move the current player based on dice roll.

Parameters:

state (haive.games.monopoly.state.MonopolyState | pydantic.BaseModel | dict[str, Any])

Return type:

langgraph.types.Command

offer_property_purchase(state, property_obj)[source]¶

Offer property purchase to current player.

Parameters:

state (haive.games.monopoly.state.MonopolyState)

Return type:

langgraph.types.Command

pay_rent(state, property_obj)[source]¶

Handle rent payment.

Parameters:

state (haive.games.monopoly.state.MonopolyState)

Return type:

langgraph.types.Command

roll_dice_node(state)[source]¶

Roll dice for the current player.

Parameters:

state (haive.games.monopoly.state.MonopolyState | pydantic.BaseModel | dict[str, Any])

Return type:

langgraph.types.Command

route_after_doubles(state)[source]¶

Route based on doubles status.

Parameters:

state (haive.games.monopoly.state.MonopolyState | pydantic.BaseModel | dict[str, Any])

Return type:

str

route_game_end(state)[source]¶

Route based on game end status.

Parameters:

state (haive.games.monopoly.state.MonopolyState | pydantic.BaseModel | dict[str, Any])

Return type:

str

setup_workflow()[source]¶

Set up the main game workflow.

Return type:

None

start_turn(state)[source]¶

Start a player’s turn.

Parameters:

state (haive.games.monopoly.state.MonopolyState | pydantic.BaseModel | dict[str, Any])

Return type:

langgraph.types.Command

class haive.games.monopoly.game_agent.MonopolyGameAgentConfig[source]¶

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

Configuration for monopoly game agent.