Arena manifest models

The agilerl-arena package is where the training manifest schema lives: the Pydantic models under agilerl.arena.models describe every algorithm, network, and training section, with no dependency on torch. They are the same classes LocalTrainer trains from; agilerl.models re-exports them and adds only what a local run needs (see Models).

Training manifest

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.

property context_defaulted: bool

Whether network.max_context_length is the default Arena filled in.

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

Raises:

ValueError – When the manifest sets a field in RESOLVED_MEMORY_FIELDS.

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].

model_post_init(context: Any, /) → None

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

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]

Algorithm registry

One registry maps algorithm names to their spec classes, and every consumer – the local trainer, the manifest, Arena submission – reads it.

agilerl.arena.models.MANIFEST_REGISTRY = <agilerl.arena.models.registry.AlgorithmRegistry object>

Maps the manifest’s algorithm.name to the spec class that validates it.