haive.games.chess.config¶

Chess agent configuration module.

from typing import Any This module provides configuration classes for chess agents, including:

  • Core game parameters

  • LLM engine settings

  • Analysis options

  • Visualization settings

  • State schema definition

The configuration system uses Pydantic for validation and default values, making it easy to create and customize chess agent instances.

Classes¶

ChessConfig

Configuration class for chess game agents.

Module Contents¶

class haive.games.chess.config.ChessConfig¶

Bases: haive.games.core.config.BaseGameConfig

Configuration class for chess game agents.

This class defines all configuration parameters for a chess agent, including state schema, LLM engines, game settings, and visualization options.

state_schema¶

The state schema for the game.

Type:

Type[ChessState]

white_player_name¶

Name of the white player.

Type:

str

black_player_name¶

Name of the black player.

Type:

str

enable_analysis¶

Whether to enable position analysis during gameplay.

Type:

bool

should_visualize_graph¶

Whether to visualize the game workflow graph.

Type:

bool

max_moves¶

Maximum number of moves before forcing a draw.

Type:

int

engines¶

LLM configurations for players and analyzers.

Type:

Dict[str, AugLLMConfig]

runnable_config¶

Runtime configuration for the agent.

Type:

Dict[str, Any]

Examples

>>> # Create a basic configuration
>>> config = ChessConfig()
>>>
>>> # Create a configuration with analysis disabled
>>> config = ChessConfig(enable_analysis=False)
>>>
>>> # Create a configuration with custom LLM engines
>>> from haive.core.engine.aug_llm import build_aug_llm
>>> engines = {
...     "white_player": build_aug_llm("openai", "gpt-4"),
...     "black_player": build_aug_llm("anthropic", "claude-3-opus-20240229"),
... }
>>> config = ChessConfig(engines=engines)
class Config¶

Pydantic configuration.

This inner class configures Pydantic behavior for the ChessAgentConfig.

arbitrary_types_allowed¶

Whether to allow arbitrary types in the model.

Type:

bool

build_legacy_engines()¶

Build legacy hardcoded engines.

Return type:

list[Any]

create_engines_from_player_configs(player_configs)¶

Create engines from player configurations.

Parameters:

player_configs (dict[str, haive.games.core.agent.player_agent.PlayerAgentConfig])

Return type:

list[Any]

create_simple_player_configs()¶

Create player configs from simple model strings.

Return type:

dict[str, haive.games.core.agent.player_agent.PlayerAgentConfig]

finalize_config()¶

Finalize configuration after engine setup.

Return type:

ChessConfig

get_example_configs()¶

Define example chess configurations.

Return type:

dict[str, dict[str, Any]]

get_role_definitions()¶

Define chess player roles.

Return type:

dict[str, haive.games.core.config.GamePlayerRole]