ArenaClient

The main client for interacting with the Arena platform. Handles authentication, environment management, experiment submission, and agent deployment.

class agilerl.arena.client.ArenaClient(*, api_key: str | None = None, org_key: str | None = None, external_user_id: str | None = None, request_timeout: int = 30, upload_timeout: int = 300, verbose: bool = True)

Client for the Arena RLOps platform.

Handles authentication, environment management, and training job submission.

Authentication is resolved in priority order:

  1. org_key plus external_user_id (constructor or ARENA_ORG_KEY / ARENA_EXTERNAL_USER_ID). Sends Authorization: Bearer <org key> and X-External-User-Id.

  2. api_key constructor argument

  3. ARENA_API_KEY environment variable

  4. Stored OAuth credentials from ~/.arena/credentials.json

  5. Interactive login() (device authorization flow)

For PAT / OAuth credentials, the value is sent as Authorization: Bearer <value>. Use a personal access token from your Arena account profile (arena_pat_<uuid>_<secret>) to skip OAuth device login. You can also pass a Keycloak access token in the same way if you obtain one elsewhere. Organisation keys (arena_org_…) are for partner servers and must be paired with an external user id.

Parameters:
  • api_key (str | None) – Bearer token material (profile PAT or OAuth access token). When set, device login is not required.

  • org_key (str | None) – Organisation API key (arena_org_…). Requires external_user_id.

  • external_user_id (str | None) – Partner user id sent as X-External-User-Id. Requires org_key.

  • request_timeout (int) – Default timeout in seconds for API requests.

  • upload_timeout (int) – Timeout in seconds for file uploads and cluster register.

  • verbose (bool) – Whether to enable verbose logging.

Returns:

None

Return type:

None

BASE_URL: ClassVar[str] = 'https://arena.agilerl.com'
CONFIG_DIR: ClassVar[Path] = PosixPath('/home/docs/.arena')
CONFIG_FILE: ClassVar[Path] = PosixPath('/home/docs/.arena/config.json')
close() → None

Close the underlying HTTP connection pool.

classmethod configure(*, base_url: str | None = None, keycloak_url: str | None = None, realm: str | None = None, client_id: str | None = None) → type[ArenaClient]

Override default URLs for local development or testing.

An explicit base_url / keycloak_url takes precedence over the ARENA_BASE_URL / ARENA_KEYCLOAK_URL environment variables.

Returns the class so calls can be chained with instantiation:

client = ArenaClient.configure(
    base_url="http://localhost:3001",
    keycloak_url="http://localhost:8023",
)()
create_dataset(*, name: str, category: str, column_mapping: str | dict[str, Any] | None = None, description: str | None = None, file: str | PathLike[str] | bytes | None = None, config: str | None = None, hf_dataset_name: str | None = None, hf_config: str | None = None, hf_split: str | None = None) → dict[str, Any]

Create an LLM dataset on Arena.

Upload a local CSV, a parquet file, a Hugging Face parquet folder, import from HuggingFace, or create metadata only. Validation is performed by the Arena API; a local traces file is also checked against the traces spec before upload.

Parameters:
  • name (str) – Dataset name.

  • category (str) – Dataset category (reasoning, preference, sft, traces, tabular, or non-tabular).

  • column_mapping (str | dict[str, Any] | None) – Column mapping as a JSON string or dict. Required except for traces, whose column names are the spec.

  • description (str | None) – Optional description.

  • file (str | os.PathLike[str] | bytes | None) – Local CSV, JSONL or parquet path, a directory of parquet shards, or raw CSV bytes (bytes are uploaded as dataset.csv).

  • config (str | None) – Parquet config name when file is a folder with more than one config (e.g. gsm8k main vs socratic).

  • hf_dataset_name (str | None) – HuggingFace dataset id for import.

  • hf_config (str | None) – HuggingFace dataset config name.

  • hf_split (str | None) – HuggingFace split (required when importing from HF).

Returns:

Created dataset metadata from Arena.

Return type:

dict[str, Any]

Raises:

ArenaValidationError – If a traces file breaks the spec.

create_project(name: str, description: str | None, llm_based: bool) → dict[str, Any]

Create a new project in Arena.

Parameters:
  • name (str) – The name of the project to create.

  • description (str | None) – The description of the project to create.

  • llm_based (bool) – Whether the project is based on an LLM.

Returns:

A dictionary containing the project creation result.

Return type:

dict[str, Any]

dataset_exists(name: str) → dict[str, bool | str]

Check whether a dataset name is registered for the active org.

Parameters:

name (str) – Dataset name.

Returns:

exists, and datasetType when the name is registered.

Return type:

dict[str, bool | str]

delete_dataset(name: str, *, confirm: bool = False) → dict[str, Any] | None

Archive a dataset by name.

Parameters:
  • name (str) – Dataset name.

  • confirm (bool) – When True, skip the interactive confirmation prompt.

Returns:

Archive result, or None if the user declined confirmation.

Return type:

dict[str, Any] | None

delete_environment(*, name: str, version: str | None = None, confirm: bool = False) → dict[str, Any] | None

Delete an environment version (or all versions if version is None).

Parameters:
  • name (str) – Environment name, as specified in Arena.

  • version (str | None) – Environment version. If None, delete all environment versions.

  • confirm (bool) – Whether to confirm the deletion.

delete_inference_deployment(name: str, experiment_name: str | None = None, project_name: str | None = None) → dict[str, Any]

Archive a deployment.

Parameters:
  • name (str) – Deployment name.

  • experiment_name (str | None) – Experiment name when several deployments share name.

  • project_name (str | None) – Project name when several deployments share name.

Returns:

{"success": true} when the deployment is archived.

Return type:

dict[str, Any]

delete_project(name: str) → None

Delete a project in Arena.

Parameters:

name (str) – The name of the project to delete.

delete_secret(name: str) → dict[str, Any]

Delete an organization secret.

Parameters:

name (str) – Secret name.

Returns:

{"deleted": True, "name": name}.

Return type:

dict[str, Any]

deploy_agent(experiment_name: str, checkpoint: str | None = None, memory_scope: Literal['user', 'organization'] | None = None, num_gpus: int | None = None, gpu_type: str | None = None) → dict[str, Any]

Create an inference deployment from an experiment checkpoint.

Without num_gpus or gpu_type, a redeploy keeps the agent’s resources. A new deployment runs on the cluster the agent was trained on if that is your own cluster, else on the cheapest node type that can serve the model. If Arena can’t size the model, it uses its default node type and rejects num_gpus and gpu_type.

Parameters:
  • experiment_name (str) – The name of the experiment to deploy.

  • checkpoint (str | None) – Steps of the checkpoint to deploy, as listed by list_checkpoints() (e.g. "500"). If None, deploy the checkpoint with the most steps.

  • memory_scope (MemoryScope | None) – Who an LLM deployment keeps chat sessions for. "user" gives every caller their own conversations, "organization" shares them across the organisation. A new deployment defaults to "user". Redeploying with None keeps the scope already stored, it does not reset it, and the scope cannot be changed after the deployment exists.

  • num_gpus (int | None) – GPUs on the agent’s node.

  • gpu_type (str | None) – Short GPU name such as h100-80, b200 or l4.

Returns:

A dictionary containing the deployment result.

Return type:

dict[str, Any]

Raises:

ArenaValidationError – When num_gpus is below 1 or memory_scope is unknown.

download_experiment_metrics(experiment_name: str, output_path: str | PathLike[str] | None = None, metrics: list[str] | None = None, project: str | None = None, overwrite: bool = False) → Path

Download experiment metrics to a local file.

Parameters:
  • experiment_name (str) – The name of the experiment to download metrics for.

  • output_path (str | os.PathLike[str] | None) – Destination file path or directory. If a directory, the filename is inferred from the server response. Defaults to {experiment_name}_metrics.csv in the current directory.

  • metrics (list[str] | None) – The metrics to download. If None, download all metrics.

  • project (str | None) – Project name; defaults to the saved default project.

  • overwrite (bool) – Replace the file at the resolved output path if it exists.

Returns:

The path to the written file.

Return type:

Path

Raises:
  • FileExistsError – If the resolved output path is a directory, or is an existing file and overwrite is False.

  • NotADirectoryError – If the parent path exists but is not a directory.

duplicate_environment_version(*, name: str, new_version: str, version: str | None = None) → dict[str, Any]

Duplicate a custom environment version to a new version name.

Parameters:
  • name (str) – Environment name.

  • new_version (str) – New version for the duplicate (e.g. v2).

  • version (str | None) – Source version; when omitted, the latest version is used.

environment_exists(name: str, version: str | None = None) → bool

Check whether an environment name/version is registered.

Parameters:
  • name (str) – Environment name.

  • version (str | None) – Environment version. Defaults to None, which resolves to the latest version.

Returns:

True if the environment exists, False otherwise.

Return type:

bool

get_credit_balance() → dict[str, Any]

Get the active organization’s balance and its accrued, uncharged cost.

Returns:

balance (spendable credits), accrued_cost (run up by running jobs and deployments but not charged yet), balance_after_accrued and accrued, one entry per running item with kind, id, experiment_id, name, since, hourly_cost and accrued_cost.

Return type:

dict[str, Any]

Raises:

ArenaAPIError – With status 404 from an Arena server without accrued cost.

get_credit_ledger(*, job_id: int | None = None, deployment_id: int | None = None, limit: int | None = None) → list[dict[str, Any]]

List the active organization’s charges and credits, newest first.

Parameters:
  • job_id – Only charges for this job.

  • deployment_id – Only charges for this deployment.

  • limit – Most entries to return (the server caps it at 1000).

Returns:

Entries with time, kind, job_id, deployment_id, experiment_id, item, description, amount (negative for charges) and balance (after the entry).

Return type:

list[dict[str, Any]]

Raises:

ArenaAPIError – With status 404 from an Arena server without the ledger.

get_current_user() → dict[str, Any]

Get the authenticated user’s profile details.

Includes account fields such as email and name. When the Arena server exposes them, the payload may also contain entitlement flags (e.g. enterprise / BYOC access) relevant to CLI feature gating.

get_default_project() → str | None

Return the default project name from ~/.arena/config.json, or None if unset.

get_default_run_spec(algorithm: str, *, env_name: str | None = None, env_version: str | None = None, env_entrypoint: str | None = None, dataset_name: str | None = None, field: str | None = None, pretrained_model_name_or_path: str | None = None) → dict[str, Any]

Fetch a default RunSpec for an algorithm.

field returns one section instead of the full spec.

Parameters:
  • algorithm (str) – Catalog algorithm name.

  • env_name (str | None) – Arena environment name.

  • env_version (str | None) – Environment version. Required with env_entrypoint (v1 and 1 are both accepted).

  • env_entrypoint (str | None) – Environment entrypoint.

  • dataset_name (str | None) – Dataset name.

  • field (str | None) – RunSpec section to return (algorithm, environment, mutation, network, replay_buffer, tournament_selection, or training).

  • pretrained_model_name_or_path (str | None) – HuggingFace model name in the catalog.

Returns:

A filled RunSpec, or one section when field is set.

Return type:

dict[str, Any]

Raises:

ArenaValidationError – When algorithm is a classic RL algorithm.

get_experiment_logs(experiment_name: str, *, tail: int | None = None, after: int | None = None, limit: int | None = None, level: Literal['info', 'warning', 'error'] | None = None, project: str | None = None) → dict[str, Any]

Return one page of an experiment’s training logs (the web Log view).

Parameters:
  • experiment_name (str) – Experiment name (latest match in scope).

  • tail (int | None) – Return the newest tail lines (1-1000). Not with after.

  • after (int | None) – Return lines after this line timestamp (Unix microseconds), oldest first. Pass the previous page’s next_after.

  • limit (int | None) – Lines per page when not tailing (1-1000, server default 500).

  • level (Literal["info", "warning", "error"] | None) – Lowest severity to return.

  • project (str | None) – Project, when the experiment name exists in more than one.

Returns:

The status fields of get_experiment_status() plus lines (timestamp, severity, message, event_type), next_after and has_more.

Return type:

dict[str, Any]

get_experiment_status(experiment_name: str, project: str | None = None) → dict[str, Any]

Return an experiment’s status and, when it failed, why.

Parameters:
  • experiment_name (str) – Experiment name (latest match in scope).

  • project (str | None) – Project, when the experiment name exists in more than one.

Returns:

experiment_name, status, failure_reason (None unless the run failed) and last_modified.

Return type:

dict[str, Any]

get_model_info(model_name: str) → dict[str, Any]

Fetch LoRA modules and catalog metadata for a model.

Parameters:

model_name (str) – HuggingFace model id as stored in the catalog.

Returns:

modules, parameters, lora_info, num_params, max_context_length, and lora_ranks.

Return type:

dict[str, Any]

get_user_credits() → None | bool | int | float | str | list[JSONValue] | dict[str, JSONValue]

Get the authenticated user’s credit information.

property is_authenticated: bool

True when the client holds an org key, API key, or access token.

iter_experiment_logs(experiment_name: str, *, tail: int | None = None, follow: bool = False, level: Literal['info', 'warning', 'error'] | None = None, project: str | None = None, poll_interval: float = 5.0) → Iterator[dict[str, Any]]

Yield pages of an experiment’s training logs until there are no more.

With follow, keep polling while the experiment is pending or running, and stop once it has ended and a poll brings no new lines.

Parameters:
  • experiment_name (str) – Experiment name (latest match in scope).

  • tail (int | None) – Start with the newest tail lines instead of the first line.

  • follow (bool) – Keep polling for new lines while the experiment runs.

  • level (Literal["info", "warning", "error"] | None) – Lowest severity to return.

  • project (str | None) – Project, when the experiment name exists in more than one.

  • poll_interval (float) – Seconds between polls when following.

Returns:

Pages as returned by get_experiment_logs(); the last one carries the final status and failure_reason.

Return type:

Iterator[dict[str, Any]]

list_checkpoints(experiment_name: str, project: str | None = None) → list[dict[str, Any]]

List all checkpoints for an experiment.

Parameters:
  • experiment_name (str) – The name of the experiment to list checkpoints for.

  • project (str | None) – Project, when the experiment name exists in more than one.

Returns:

A list of checkpoints.

Return type:

list[dict[str, Any]]

list_datasets(*, search: str | None = None) → list[dict[str, Any]]

List datasets or search HuggingFace datasets.

Parameters:

search (str | None) – HuggingFace dataset search query.

Returns:

List of datasets or search results from Arena.

Return type:

list[dict[str, Any]]

list_environment_entrypoints(name: str, version: str | None = None) → list[str]

List available entrypoints for an environment version.

Parameters:
  • name (str) – Environment name, as specified in Arena.

  • version (str | None) – Environment version. Defaults to None, which resolves to the latest version.

Returns:

A list of entrypoints.

Return type:

list[str]

list_environments(name: str | None = None, include_arena: bool = False) → dict[str, dict[str, dict[str, bool]]]

List environments available to the authenticated user.

Parameters:
  • name (str | None) – Environment name. If None, list all environments.

  • include_arena (bool) – Whether to include the built-in environments available in Arena.

Returns:

A nested dictionary keyed by environment name, then version:

{
    "<name>": {
        "<version>": {
            "validated": True,
            "profiled": True,
        }
    }
}

Return type:

dict[str, dict[str, dict[str, bool]]]

list_experiment_metric_names(experiment_name: str, *, project: str | None = None, details: bool = False) → list[dict[str, Any]] | dict[str, Any]

List metric catalog rows recorded for an experiment (JSON).

For a CSV preview with --metric / --preview-rows-style filters, use preview_experiment_metrics_csv().

Parameters:
  • experiment_name (str) – Experiment name (latest updated match in scope).

  • project (str | None) – Optional exact project name in the current org.

  • details (bool) – When True, the API returns {\"metrics\": […catalog…]}.

Returns:

Catalog rows {display_name, category}, or that object when details is True.

Return type:

list[dict[str, Any]] | dict[str, Any]

list_experiments(project: str | None = None) → list[dict[str, Any]]

List all experiments in a project.

Parameters:

project (str | None) – The name of the project. Falls back to the default project from ~/.arena/config.json if not provided.

Returns:

A list of experiments.

Return type:

list[dict[str, Any]]

list_inference_deployments(*, name: str | None = None, experiment_name: str | None = None, project_name: str | None = None) → list[dict[str, Any]]

List inference deployments available to the user.

Parameters:
  • name (str | None) – The name of the deployment to list.

  • experiment_name (str | None) – The name of the experiment to list deployments for.

  • project_name (str | None) – The name of the project to list deployments for.

Returns:

A list of deployments.

Return type:

list[dict[str, Any]]

list_models() → list[dict[str, Any]]

List HuggingFace models in the Arena catalog.

Returns:

Catalog rows including model_name, num_params, lora_info, max_context_length, lora_ranks, and enabled.

Return type:

list[dict[str, Any]]

list_projects() → list[dict[str, Any]]

List all projects in Arena for the authenticated user.

Returns:

A list of projects.

Return type:

list[dict[str, Any]]

list_resources(algorithm: str | None = None) → dict[str, Any]

List the GPU types and GPU counts a submit accepts.

Each gpuType is a value ArenaClient.submit_experiment accepts as gpu_type, and each of its numGpus a value for num_gpus. An older platform returns resource tiers instead.

Parameters:

algorithm (str | None) – The run’s algorithm.name. Arena then lists only the GPU counts that algorithm trains on: a GRPO-family run generates on its own GPU, so it needs at least two. Without it the list is for LLM training and includes single GPUs.

Returns:

{"gpuTypes": [{"gpuType": str, "gpusPerNode": list[int], "numGpus": list[int], "devOnly": bool}]}.

Return type:

dict[str, Any]

list_secrets() → list[dict[str, Any]]

List your organization’s secrets without their values.

Returns:

One row per secret with name, created_at, updated_at and updated_by.

Return type:

list[dict[str, Any]]

login(timeout: int = 300) → None

Sign in through the browser, then end the previously saved login.

Only one login is kept in ~/.arena/credentials.json, so this is also how to switch user or environment. Organisation-key credentials skip it. An API key stays on this client until the browser sign-in succeeds.

Parameters:

timeout – Maximum seconds to wait for browser authorization.

logout() → None

End the saved login and remove stored credentials.

open_inference_agent(deployment_name: str, *, refresh: bool = False, experiment_name: str | None = None, project_name: str | None = None, timeout: int | None = None) → Agent

Build an Agent for a named deployment.

Attempts to load the deployment from the cache, and if not found, fetches it from the API.

The agent carries this client’s own credential, so run login() or set ARENA_API_KEY before using a deployment that keeps memory per user.

Parameters:
  • deployment_name (str) – The name of the deployment to open.

  • refresh (bool) – Whether to refresh the deployment metadata.

  • experiment_name (str | None) – Experiment name to disambiguate when multiple deployments share the same deployment name.

  • project_name (str | None) – Project name to disambiguate when multiple deployments share the same deployment name.

A redeploy moves the deployment to a new URL, which leaves the cached one answering 404. Rather than make you pass refresh to find that out, a 404 from the cached URL refetches it once and retries.

Parameters:

timeout (int | None) – HTTP timeout in seconds for the returned agent’s inference requests.

Returns:

An Agent instance.

Return type:

Agent

preview_experiment_metrics_csv(experiment_name: str, *, preview_rows: int, metrics: Sequence[str] | None = None, project: str | None = None) → tuple[bytes, str | None, str | None]

Fetch a capped CSV snippet (Arena CLI --metric / --preview-rows).

Uses GET /api/cli/v1/experiments/metrics with preview_rows set. Omit metrics to include all columns.

Parameters:
  • experiment_name (str) – Experiment name (latest match in scope).

  • preview_rows (int) – Maximum number of data rows in the CSV (server-capped).

  • metrics (Sequence[str] | None) – Metric column names to include (repeat query param metric).

  • project (str | None) – Optional exact project name.

Returns:

A tuple of the metrics payload, content type, and disposition.

Return type:

tuple[bytes, str | None, str | None]

quote_experiment(manifest: str | Path | dict[str, Any], *, num_gpus: int | None = None, gpu_type: str | None = None, project: str | None = None, experiment_name: str | None = None, reward_file: str | PathLike[str] | bytes | None = None, completion: str | None = None) → dict[str, Any]

Price an experiment without starting it.

Arena runs the submit checks and picks the class exactly as submit_experiment() would, then stops before creating anything.

Arguments match submit_experiment().

Returns:

resource_id, resource_name, gpu_type, num_gpus, num_nodes, hourly_cost (credits per hour), max_steps, step_seconds, estimated_hours and estimated_cost. The last two are None when Arena has no duration estimate.

Return type:

dict[str, Any]

Raises:

ArenaAPIError – With status 404 from an Arena server that cannot price a run before it starts.

quote_resume(experiment_name: str, max_steps: int | None = None, checkpoint: str | None = None, new_name: str | None = None, project: str | None = None) → dict[str, Any]

Price a resume without starting it.

A resume runs on the experiment’s own hardware. Arguments match resume_experiment().

Returns:

The fields quote_experiment() returns, for the steps left between the checkpoint and max_steps on that hardware.

Return type:

dict[str, Any]

Raises:

ArenaAPIError – With status 404 from an Arena server that cannot price a resume before it starts.

resume_experiment(experiment_name: str, max_steps: int | None = None, checkpoint: str | None = None, new_name: str | None = None, project: str | None = None) → dict[str, Any]

Resume an experiment (a training job).

Parameters:
  • experiment_name (str) – The name of the experiment to resume.

  • max_steps (int | None) – Total training steps, counted from the start of the original run; must be greater than the checkpoint’s step. Omit to keep the stored total.

  • checkpoint (str | None) – Checkpoint to resume from. Omit to use the best checkpoint.

  • new_name (str | None) – Name for the resumed experiment.

  • project (str | None) – Project, when the experiment name exists in more than one.

Returns:

A dictionary containing the resume result.

Return type:

dict[str, Any]

set_default_project(name: str) → None

Validate that name exists and persist it as the default project.

Parameters:

name (str) – The project name to set as default.

Raises:

ArenaConfigError – If the project does not exist.

set_secret(name: str, value: str) → dict[str, Any]

Create or replace an organization secret.

Parameters:
  • name (str) – Secret name, such as ANTHROPIC_API_KEY.

  • value (str) – Secret value. Sent once and never returned.

Returns:

The stored row’s name, created_at, updated_at and updated_by.

Return type:

dict[str, Any]

set_stream_handler(handler: Callable[[StatusEvent | CheckEvent | ErrorEvent | LogEvent], None] | None) → None

Register a callback invoked for each StreamEvent during streaming.

Set to None to clear the handler.

stop_experiment(experiment_name: str, project: str | None = None) → None | bool | int | float | str | list[JSONValue] | dict[str, JSONValue]

Stop a running experiment in Arena.

Parameters:
  • experiment_name (str) – Experiment name to halt.

  • project (str | None) – Project, when the experiment name exists in more than one.

submit_experiment(manifest: str | Path | dict[str, Any], *, num_gpus: int | None = None, gpu_type: str | None = None, project: str | None = None, experiment_name: str | None = None, reward_file: str | PathLike[str] | bytes | None = None, completion: str | None = None, idempotency_key: str | None = None) → dict[str, Any]

Submit an experiment (a training job).

Parameters:
  • manifest (str | Path | dict[str, Any]) – Training manifest as a YAML/JSON file path, raw YAML string, or a pre-parsed dict.

  • num_gpus (int | None) – Total GPUs for the job. Arena uses the fewest nodes that fit the run’s memory estimate.

  • gpu_type (str | None) – Short GPU name such as h100-80, b200 or l4.

  • project (str | None) – The project to submit the experiment to.

  • experiment_name (str | None) – The name of the experiment to submit.

  • reward_file (str | os.PathLike[str] | bytes | None) – Python rubric or reward module scoring a rollout job. When set, the request is sent as multipart/form-data and a rollout manifest without environment.rubric_file_path gets the file’s basename (reward.py for bytes).

  • completion (str | None) – Optional model completion for reward validation. When omitted, the server uses the reference answer from the first dataset row.

  • idempotency_key (str | None) – Reuse this key to replay the same submit instead of starting another job. The key is org-wide.

Raises:

ArenaValidationError – When num_gpus is below 1, the manifest turns on HPO, or the manifest’s rubric path names a different file than reward_file, or a local file when reward_file is unset.

update_inference_deployment(name: str, new_name: str | None = None, description: str | None = None, enabled: bool | None = None, experiment_name: str | None = None, project_name: str | None = None) → dict[str, Any]

Rename, describe, or enable a deployment.

Parameters:
  • name (str) – Current deployment name.

  • new_name (str | None) – Replacement display name.

  • description (str | None) – Replacement description.

  • enabled (bool | None) – True enables the deployment, False disables it.

  • experiment_name (str | None) – Experiment name when several deployments share name.

  • project_name (str | None) – Project name when several deployments share name.

Returns:

The updated deployment.

Return type:

dict[str, Any]

validate_environment(*, name: str, version: str | None = None, source: str | PathLike[str] | bytes | None = None, env_config: str | PathLike[str] | None = None, requirements: str | PathLike[str] | None = None, entrypoint: str | None = None, description: str | None = None, do_rollouts: bool = False) → dict[str, Any]

Validate a custom GEM environment on Arena.

When source is provided the environment is uploaded, created, and validated in a single step. When source is None an already-registered environment is validated by name/version.

Parameters:
  • name (str) – Environment name.

  • version (str | None) – Environment version. If creating an environment from scratch, defaults to “v1”, if validating an already-registered environment, defaults to None, which resolves to the latest version.

  • source (str | os.PathLike[str] | bytes | None) – Environment source — a directory path (compressed automatically), a .tar.gz file path, or raw bytes.

  • env_config (str | os.PathLike[str] | None) – Path to the environment configuration file containing the environment parameters. When source is a directory and this is None, a top-level env_config.yaml, env_config.yml, or env_config.json (in that order) is picked up automatically. Default is None.

  • requirements (str | os.PathLike[str] | None) – Path to additional dependencies needed for the environment. When source is a directory and this is None, a top-level requirements.txt is picked up automatically. Default is None.

  • entrypoint (str | None) – Optional entrypoint override. Default is None.

  • description (str | None) – Optional description of the environment. Default is None.

  • do_rollouts (bool) – Whether to perform environment rollouts during validation. Setting this to True will run 100 random episodes and collect additional information such as the average random reward and visualize the rendered environment. Default is False.

Returns:

A dictionary containing the validation result.

Return type:

dict[str, Any]