Training Manifest (local training)

The core TrainingManifest validates a full YAML/JSON training configuration for local runs. It dispatches the algorithm, network, and environment sections to concrete spec classes under agilerl.models and uses ALGO_REGISTRY.

For Arena job submission, use the separate manifest model in agilerl.arena.models instead (see Arena manifest models).

class agilerl.models.manifest.TrainingManifest(*, algorithm: ~types.Annotated[~agilerl.models.algo.RLAlgorithmSpec | ~agilerl.models.algo.MultiAgentRLAlgorithmSpec | ~agilerl.models.algo.LLMAlgorithmSpec, ~pydantic.functional_validators.BeforeValidator(func=~agilerl.models.manifest._resolve_algorithm, json_schema_input_type=PydanticUndefined), ~pydantic.functional_serializers.PlainSerializer(func=~agilerl.models.manifest._serialize_algorithm, return_type=dict[str, ~typing.Any], when_used=always)], environment: ~typing.Annotated[dict[str, ~typing.Any], ~pydantic.functional_validators.BeforeValidator(func=~agilerl.models.manifest._coerce_environment, json_schema_input_type=PydanticUndefined)], training: ~agilerl.models.training.TrainingSpec = <factory>, network: ~typing.Annotated[dict[str, ~typing.Any], ~pydantic.functional_validators.BeforeValidator(func=~agilerl.models.manifest._resolve_network, json_schema_input_type=PydanticUndefined)] | None = None, mutation: ~agilerl.models.hpo.MutationSpec | None = None, replay_buffer: ~agilerl.models.training.ReplayBufferSpec | None = None, tournament_selection: ~agilerl.models.hpo.TournamentSelectionSpec | None = None)

Pydantic model that validates a full training manifest.

Handles discriminated parsing of the algorithm section via ALGO_REGISTRY and pre-processes the network section so the encoder discriminator works correctly.

The environment section is stored as a raw dict. Callers may pass either a plain dict or an environment spec (any BaseModel subclass such as ArenaEnvSpec); spec objects are automatically serialized to dicts on validation.

classmethod from_trainer_specs(*, algorithm: RLAlgorithmSpec | MultiAgentRLAlgorithmSpec | LLMAlgorithmSpec, environment: BaseModel, training: TrainingSpec, mutation: MutationSpec | None = None, replay_buffer: ReplayBufferSpec | None = None, tournament_selection: TournamentSelectionSpec | None = None) TrainingManifest

Build a validated core manifest from trainer component specs.

Parameters:
  • algorithm (AlgoSpecT) – Core algorithm spec or registered algorithm name dict.

  • environment (BaseModel) – Environment spec instance held on the trainer.

  • training (TrainingSpec) – Training loop parameters.

  • mutation (MutationSpec | None) – Optional mutation spec.

  • replay_buffer (ReplayBufferSpec | None) – Optional replay-buffer spec.

  • tournament_selection (TournamentSelectionSpec | None) – Optional tournament-selection spec.

Returns:

A validated TrainingManifest.

Return type:

TrainingManifest

classmethod get_validated(manifest: str | Path | dict[str, Any], *, mode: Literal['json', 'python'] = 'json') dict[str, Any] | TrainingManifest

Validate a YAML file and return a JSON-serializable dict or TrainingManifest.

Parameters:
  • manifest (str | Path | dict[str, Any]) – Path to a YAML/JSON file, or a raw dict.

  • mode (Literal["json", "python"]) – The mode to validate the manifest in.

Returns:

A JSON-serializable dict or TrainingManifest.

Return type:

dict[str, Any] | TrainingManifest

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

classmethod to_arena_manifest(manifest: str | Path | dict[str, Any] | TrainingManifest, *, mode: Literal['json', 'python'] = 'json') dict[str, Any]

Validate a manifest for Arena submission.

Accepts a core TrainingManifest, a raw manifest dict, or a YAML/JSON path.

Parameters:
  • manifest (str | Path | dict[str, Any] | TrainingManifest) – Manifest source to validate for the Arena platform.

  • mode (Literal["json", "python"]) – "json" for the submission payload, "python" for the validated arena manifest model.

Returns:

Arena submission dict or validated arena manifest model.

Return type:

dict[str, Any] | Any

Raises:

ImportError – If agilerl-arena is not installed.