Training Manifest

TrainingManifest is TrainingManifest. The YAML schema is defined once in agilerl-arena; the framework does not subclass it.

Building a gym from an environment spec, or a replay buffer from a buffer spec, is not part of that schema. Those helpers live beside the models, and in LocalTrainer. from_trainer_specs() builds a manifest from the objects a trainer already holds.

class agilerl.arena.models.TrainingManifest(*, api_version: str = 'agilerl.com/v1', algorithm: ~types.Annotated[~agilerl.arena.models.algorithms.base.SingleAgentAlgorithmSpec | ~agilerl.arena.models.algorithms.base.MultiAgentAlgorithmSpec | ~agilerl.arena.models.algorithms.base.LLMAlgorithmSpec, ~pydantic.functional_validators.BeforeValidator(func=~agilerl.arena.models.manifest._resolve_algorithm, json_schema_input_type=PydanticUndefined), ~pydantic.functional_serializers.PlainSerializer(func=~agilerl.arena.models.manifest._serialize_algorithm, return_type=dict[str, ~typing.Any], when_used=always)], environment: ~agilerl.arena.models.env.GymEnvSpec | ~agilerl.arena.models.env.OfflineEnvSpec | ~agilerl.arena.models.env.BanditEnvSpec | ~agilerl.arena.models.env.LLMEnvSpec, training: ~agilerl.arena.models.training.TrainingSpec = <factory>, network: ~types.Annotated[~agilerl.arena.models.networks.FinetuningNetworkSpec | ~agilerl.arena.models.networks.NetworkSpec | ~agilerl.arena.models.manifest.DeferredNetworkSpec, ~pydantic.functional_validators.BeforeValidator(func=~agilerl.arena.models.manifest.normalize_network_section, json_schema_input_type=PydanticUndefined)] | None = None, mutation: ~agilerl.arena.models.hpo.MutationSpec | None = None, replay_buffer: ~types.Annotated[~agilerl.arena.models.training.ReplayBufferSpec | ~agilerl.arena.models.training.LLMRolloutBufferSpec, ~pydantic.functional_validators.BeforeValidator(func=~agilerl.arena.models.training._parse_buffer_section, json_schema_input_type=PydanticUndefined)] | None = None, selection_strategy: ~types.Annotated[~agilerl.arena.models.hpo.TournamentSelectionSpec | ~agilerl.arena.models.hpo.MultiFrequencySelectionSpec, FieldInfo(annotation=NoneType, required=True, discriminator='strategy'), ~pydantic.functional_validators.BeforeValidator(func=~agilerl.arena.models.manifest._default_selection_strategy, json_schema_input_type=PydanticUndefined)] | None = None)

A whole training run, described once.

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

Validate a manifest and return it as a payload dict or a model.

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

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

Returns:

The submission payload or the validated manifest.

Return type:

dict[str, Any] | TrainingManifest

static load(source: str | Path | dict[str, Any]) → dict[str, Any]

Read a YAML/JSON manifest into a dict, or pass a dict through.

Parameters:

source (str | Path | dict[str, Any]) – Path to a YAML/JSON file, or an already-parsed manifest.

Returns:

The raw manifest document.

Return type:

dict[str, Any]

model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}

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

property network_arch_is_resolvable: bool

Whether the encoder architecture is declared rather than inferred.

to_payload() → dict[str, Any]

Serialize to the JSON submission payload.

Returns:

A JSON-safe manifest document.

Return type:

dict[str, Any]

agilerl.models.manifest.from_trainer_specs(*, algorithm: SingleAgentAlgorithmSpec | MultiAgentAlgorithmSpec | LLMAlgorithmSpec, environment: BaseModel, training: TrainingSpec | BaseModel, mutation: MutationSpec | None = None, replay_buffer: ReplayBufferSpec | LLMRolloutBufferSpec | None = None, selection_strategy: Annotated[TournamentSelectionSpec | MultiFrequencySelectionSpec, FieldInfo(annotation=NoneType, required=True, discriminator='strategy')] | None = None, **kwargs: Any) → TrainingManifest

Build a validated manifest from the trainer’s component specs.

Parameters:
  • algorithm (AlgoSpec) – Framework algorithm spec.

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

  • training (TrainingSpec | BaseModel) – Training loop parameters; a model that is not already TrainingSpec is dumped so the manifest can validate it.

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

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

  • selection_strategy (SelectionStrategySpec | None) – Tournament or multi-frequency selection.

  • kwargs – Accepts the deprecated tournament_selection alias.

Returns:

A validated TrainingManifest.

Return type:

TrainingManifest