Arena Client¶
Arena is an RLOps platform that streamlines the reinforcement learning development process and accelerates iteration through distributed training and evolutionary hyperparameter optimization. It provides managed cloud infrastructure purpose-built for RL workloads, so researchers and engineers can focus on algorithms and environments rather than cluster management.
The Arena client, available as both a CLI (arena) and a Python SDK
(ArenaClient), allows registered users to do
everything from their own development environment: validate custom environments,
submit training experiments, monitor progress, and deploy trained agents for
inference.
Tip
Sign up to Arena for free now and get 110 free training credits (~20 hours) to get started!
Installation¶
To use the Arena client, install the standalone package directly with lightweight dependencies, or install AgileRL, which depends on it:
pip install agilerl-arena
# or
pip install agilerl
Authentication¶
Authentication is resolved automatically in priority order:
Organisation key plus external user id (constructor arguments
org_key/external_user_id, orARENA_ORG_KEY/ARENA_EXTERNAL_USER_ID). SendsAuthorization: Bearer <org key>and the headerX-External-User-Id. For partner servers.api_key argument passed directly to the client or CLI.
ARENA_API_KEY environment variable: if set, no login is needed.
Stored OAuth credentials from
~/.arena/credentials.json(persisted after a successfularena login).Interactive device login: opens a browser for OAuth authorization.
The simplest approach for scripting and CI is to set the environment variable:
export ARENA_API_KEY="arena_pat_..."
Note
Personal access tokens can be found in the Arena account profile, under Profile management -> CLI API Key.
Organisation keys (arena_org_…) are minted by platform operators for partner
integrations and must be sent with X-External-User-Id.
Once set, all CLI commands and SDK calls authenticate automatically without
requiring arena login.
For interactive use, arena login opens a browser-based OAuth flow and
persists credentials locally so you only need to log in once per machine:
from agilerl.arena.client import ArenaClient
# Option 1: Set ARENA_API_KEY env var, no login needed
client = ArenaClient()
# Option 2: Pass the key explicitly
client = ArenaClient(api_key="arena_pat_...")
# Option 3: Partner organisation key (requires an external user id)
client = ArenaClient(
org_key="arena_org_...",
external_user_id="partner-user-id",
)
# Option 4: Interactive device login (one-time)
client = ArenaClient()
client.login() # opens browser, persists credentials
# One-time interactive login (persists to ~/.arena/credentials.json)
arena login
# Or skip login entirely with an env var or flag
export ARENA_API_KEY="arena_pat_..."
# Partner servers:
export ARENA_ORG_KEY="arena_org_..."
export ARENA_EXTERNAL_USER_ID="partner-user-id"
Custom Environments¶
Before launching a training run on a custom environment or dataset, Arena requires these to be validated, ensuring that the environment is importable, follows the GEM API, and can be stepped without errors.
Users can register two types of environments on Arena:
Custom GEM environments: upload a source directory, file, or
.tar.gzarchive containing your multi-turn environment code.LLM Datasets: upload a dataset file or reference a HuggingFace dataset ID to create a language-model fine-tuning environment.
Uploading and Validating¶
In order to create and validate a custom GEM environment from scratch, users need to provide a source
file or directory containing the environment code. Additionally, an entrypoint can be provided to the environment class to use, which is useful when multiple entrypoints exist in the same path.
Please refer to the ArenaClient.validate_environment method documentation for more details.
When you point source at a directory, Arena packages the whole folder and uploads it. A
requirements.txt in the folder is installed before your environment runs, and an
env_config.yaml is used to set the arguments passed to your environment’s constructor. You
can also pass these files explicitly with requirements and env_config (--requirements
and --env-config on the CLI).
Once your environment / dataset has been validated successfully, you will be able to view it in the Environments / Datasets section in Arena.
GEM Environments¶
The following commands use a my-gem-env/ directory containing a GEM environment.
# Upload, create, and validate in one step
result = client.validate_environment(
source="my-gem-env/",
name="my-gem-env",
)
# Re-validate an already-registered environment
result = client.validate_environment(name="my-gem-env", version="v1")
# Upload and validate in one step
arena env validate my-gem-env \
--source my-gem-env/
# Re-validate an already-registered environment
arena env validate my-gem-env --version v1
LLM Datasets¶
result = client.create_dataset(
name="my-dataset",
category="reasoning",
column_mapping={"question": "prompt", "answer": "completion"},
file="./my_dataset/data.csv",
)
# Upload a local CSV and create the dataset
arena datasets create my-dataset \
--category reasoning \
--column-mapping '{"question": "prompt", "answer": "completion"}' \
--file ./my_dataset/data.csv
Recorded model calls (agent traces) go in a traces dataset: OpenAI chat
messages in prompt-completion rows, checked locally before upload and trained
by SFT or on-policy distillation with no column mapping. See Traces datasets.
arena datasets create helpdesk-traces --category traces --file ./traces.jsonl
Additional Tools¶
Here is a list of additional methods provided by the ArenaClient to help you navigate the custom environments workflow in Arena.
You can find the analogous CLI commands by running arena env --help.
list_environments(): List all registered environments and their versions.list_environment_entrypoints(): List available entrypoints for a specific environment version.environment_exists(): Check whether an environment (and optionally a version) is registered.delete_environment(): Delete one or all versions of a registered environment.
HuggingFace Models¶
Arena keeps a catalog of HuggingFace models you can train. List the catalog, or fetch LoRA target modules and context length for one model.
models = client.list_models()
for row in models:
print(row["model_name"], row["num_params"], row["max_context_length"])
info = client.get_model_info("ibm-granite/granite-3.3-2b-instruct")
print(info["modules"], info["max_context_length"])
arena models list
arena models info ibm-granite/granite-3.3-2b-instruct
Project Management¶
Projects are the top-level organisational unit in Arena. Every experiment belongs to a project, and you must specify a project when submitting training jobs.
Some useful command to manage your projects:
# List all projects
projects = client.list_projects()
# Create a new project
client.create_project(name="CartPole-HPO", description="HPO on CartPole")
# Delete a project
client.delete_project("CartPole-HPO")
# Show the current default
client.get_default_project()
# List all projects
arena projects list
# Create a new project
arena projects create CartPole-HPO --description "HPO on CartPole"
# Delete a project
arena projects delete CartPole-HPO --yes
# Show the current default
arena projects get-default
Tip
You can set a default project to work on by doing the following. This will be stored in the ~/.arena/config.json file.
arena projects set-default <project-name>
Organization Secrets¶
Secrets hold API keys your training jobs need, such as an LLM judge’s provider key.
In a manifest, judge.api_key_env names one of these secrets, and Arena passes it
to the job as an environment variable of that name. Any org member can list, set and
delete secrets. Arena never shows any part of a value, only each secret’s name, when
it was created and last updated, and who last updated it.
import os
client.list_secrets()
client.set_secret(name="OPENAI_API_KEY", value=os.environ["OPENAI_API_KEY"])
client.delete_secret("OPENAI_API_KEY")
arena secrets list
# Hidden prompt; or pipe the value on stdin, or use --from-env VAR
arena secrets set OPENAI_API_KEY
arena secrets set OPENAI_API_KEY --from-env OPENAI_API_KEY
arena secrets delete OPENAI_API_KEY --yes
The CLI never takes the value as an argument, so it stays out of your shell history.
Submitting Experiments¶
Once your environment or dataset has been validated, you can submit training jobs for it to Arena. AgileRL has its own managed cloud infrastructure with automatic checkpointing, metric logging, and real-time monitoring accessible directly from the Arena dashboard. Training runs in a distributed manner across multiple nodes (this can be customized by the user) to achieve lightning-fast training for arbitrarily large populations of agents.
Available GPU Types on Arena¶
Arena trains on several GPU types. These might change over time, so it is recommended to use the
ArenaClient.list_resources method to get
the latest list before setting off an experiment. Pass a GPU type as gpu_type (--gpu-type on
the CLI) and a GPU count as num_gpus (--num-gpus) when you submit. Pass your manifest’s
algorithm.name to list only the GPU counts that algorithm trains on.
resources = client.list_resources(algorithm="GRPO")
arena resources list --algorithm GRPO
Example output from CLI command. --num-gpus lists the GPU counts a GRPO run takes on each type:
GPU type |
|
GPUs per node |
Dev only |
|---|---|---|---|
a100-40 |
2, 4, 8, 16 |
1 |
|
a100-80 |
2, 4, 8, 16 |
1 |
|
h100-80 |
8, 16, 32, 64, 128 |
8 |
|
l4 |
2, 4, 8, 16, 32, 64 |
1, 4 |
Job Submission¶
A training configuration is defined via a manifest (YAML or JSON file) describing
the algorithm, environment, training parameters, and evolutionary HPO settings. The formulation of the manifest is described in the Manifest Formulation section,
and is mostly analogous for both the LocalTrainer and training jobs in Arena.
For an LLM manifest, check the GPU before you submit. arena memory estimate
prints the training and generation bars against the card; arena memory solve
finds the longest context the run fits, given the rest of the manifest.
See GPU memory estimate.
Here is an example manifest for fine-tuning Qwen/Qwen3.5-0.8B with GRPO on GSM8K:
gsm8k_grpo.yaml
---
algorithm:
name: GRPO
batch_size: 8
beta: 0.001
lr: 0.000005
clip_coef: 0.2
max_grad_norm: 0.1
update_epochs: 1
group_size: 8
temperature: 0.9
calc_position_embeddings: true
environment:
name: gsm8k
env_type: rollout
dataset: gsm8k
rubric_file_path: reward.py
prompt_template:
system_0: Reason step by step. End with the final number in <answer></answer> tags, like <answer>42</answer>.
user_1: '{question}'
chat_template_kwargs:
enable_thinking: false
max_reward: 2.0
replay_buffer:
kind: llm
training:
max_steps: 100_000
evo_steps: 5
pop_size: 1
eval_loop: 1
evaluation_interval: 5
network:
pretrained_model_name_or_path: Qwen/Qwen3.5-0.8B
max_context_length: 1024
lora_config:
lora_r: 16
lora_alpha: 64
task_type: CAUSAL_LM
result = client.submit_experiment(
manifest="gsm8k_grpo.yaml",
reward_file="reward.py",
project="my-project",
experiment_name="gsm8k-grpo",
)
# Submit an experiment
arena experiments submit gsm8k_grpo.yaml \
--reward-file reward.py \
--project my-project \
--experiment-name gsm8k-grpo
You can also submit experiments via the ArenaTrainer
class, which provides a higher-level interface:
from agilerl.training.trainer import ArenaTrainer
# Don't need to provide a client if we have already authenticated through `arena login`
trainer = ArenaTrainer.from_manifest(
manifest="my_manifest.yaml",
)
result = trainer.train()
See also
Manifest Formulation section for an overview of the training manifest and its options.
Prompts and reward inputs for how
prompt_templateis rendered and what your reward function receives.Trainers section for more information on the
ArenaTrainerclass and its usage.Multi-GPU LLM training for sizing multi-GPU LLM runs (
fsdp,training_gpus_per_agent).
Additional Tools¶
Here is a list of additional methods provided by the ArenaClient for managing experiments.
You can find the analogous CLI commands by running arena experiments --help.
list_experiments(): List all experiments in a project.list_checkpoints(): List saved checkpoints for an experiment.resume_experiment(): Resume a stopped experiment with a new step budget.stop_experiment(): Stop a running experiment.download_experiment_metrics(): Download training metrics as CSV to a local file.deploy_agent(): Deploy a trained checkpoint to an inference endpoint.
Agent Deployment¶
Once training is complete, you can deploy a checkpoint from an experiment to an Arena inference endpoint and interact with it in real time. Deployed agents expose an HTTP API that accepts prompts and returns completions, making the integration of fine-tuned models into applications seamless.
To deploy an agent, you can use the deploy_agent() method by specifying the experiment
name and optionally the checkpoint you wish to deploy. Name a checkpoint by its steps from
list_checkpoints() (or arena experiments checkpoints), for example 500.
If no checkpoint is given, the one with the most steps is deployed.
# Deploy an agent from an experiment
client.deploy_agent(
experiment_name="<experiment-name>",
checkpoint="500", # optional: the checkpoint's steps; defaults to the most steps
)
# Deploy the checkpoint with the most steps
arena agent deploy gsm8k-grpo
# Deploy a specific checkpoint
arena agent deploy gsm8k-grpo --checkpoint 500
GPUs¶
Pick the GPUs an agent is served on with num_gpus and
gpu_type (a short GPU name such as h100-80, b200 or l4):
client.deploy_agent(
experiment_name="<experiment-name>",
num_gpus=2,
gpu_type="h100-80",
)
arena agent deploy my-chat-model --num-gpus 2 --gpu-type h100-80
Without either option (--num-gpus / --gpu-type on the CLI), 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.
Memory Scope¶
An LLM deployment keeps chat sessions either per user or across your whole
organisation. Choose which with memory_scope when you first deploy:
client.deploy_agent(
experiment_name="<experiment-name>",
memory_scope="organization",
)
arena agent deploy my-chat-model --memory-scope organization
A new deployment uses user when you leave it out, so each caller only ever
sees their own conversations. The scope is fixed once the deployment exists.
Redeploying without the option keeps whatever is stored rather than resetting it
to user, and it cannot be changed afterwards.
Deployments show their scope in arena agent list.
Interacting with a Deployed Agent¶
Each deployment runs one agent type. The simplest way to interact with one is to open it by
name with open_inference_agent(), which returns an
Agent you can make requests to:
from agilerl.arena import ArenaClient
with ArenaClient() as client:
with client.open_inference_agent("<deployment-name>") as agent:
print(agent.metadata.agent.algo, agent.metadata.agent.llm)
Call the matching agent method; the server returns HTTP 400 if the route does not match the deployment:
Supervised (SFT):
predict()LLM:
generate()orgenerate_stream()
Tip
For LLM deployments, set an active agent with arena agent run <deployment-name> and you
can drop the deployment name from later CLI commands. arena agent generate --prompt "..."
then makes inference requests to the active agent.
Deployment URLs are cached in ~/.arena/inference.json so ordinary commands do
not have to look them up. Redeploying moves a deployment to a new URL, which the
client notices on its own: a 404 from the cached URL refetches it once and
retries, so the stale entry repairs itself. --refresh forces the lookup up
front if you would rather not rely on that.
Chat Sessions¶
LLM deployments can keep chat history. Pass session_id to continue an earlier
conversation, and list what is stored with
list_sessions():
with ArenaClient() as client:
with client.open_inference_agent("<deployment-name>") as agent:
for session in agent.list_sessions():
print(session.session_id, session.created_at, session.last_updated)
results = agent.generate("What did I just ask?", session_id="<session-id>")
Sessions come back most recently updated first. Leave session_id out and the
request does not carry one at all, so the deployment starts a new conversation.
Nothing on this side invents a session id for you.
The same is available from the CLI with arena agent sessions list,
arena agent sessions get <session-id>, and --session-id on
arena agent generate.
Sessions from the CLI¶
arena agent generate keeps a conversation going on its own. The first prompt
starts a session, and later prompts continue it:
arena agent generate --prompt "My name is Sam."
arena agent generate --prompt "What is my name?"
Every prompt runs in a session, because the deployment starts one either way. The CLI picks the id when it starts a conversation and logs which one it chose. The id is remembered per deployment, so switching active agents never carries a session across to one where it means nothing.
Two options change which conversation a prompt runs in:
# Start a fresh conversation and continue that one from now on
arena agent generate --prompt "New topic" --new-session
# Use a different session for this prompt only, leaving the current one alone
arena agent generate --prompt "Back to that" --session-id 8ab31d77
To pick up an older conversation, resume it once:
arena agent sessions resume
With no --session-id, this lists your sessions and lets you choose one with
the arrow keys. Press Enter to pick it, or Escape to cancel. Pass
--session-id to skip the picker, which is what you need in a script, where
there is no terminal to draw it on:
arena agent sessions resume --session-id 1f4c9e02
arena agent sessions list marks the current session in its first column.
When you are done, clear it so the next prompt starts a new conversation. Only
the local pointer is cleared. The session stays on the deployment, so
arena agent sessions resume can pick it up again later:
arena agent sessions clear
To remove a conversation for good, delete it. This asks for confirmation, takes
--yes to skip the prompt, and cannot be undone: the messages go from the
deployment, not just from this machine.
arena agent sessions delete 8ab31d77
Deleting the session you are currently in clears the local pointer too, so the next prompt starts a new conversation rather than writing to an id that is gone.
Inference requests carry your own Arena credential, so a deployment that keeps
memory per user knows which conversations are yours. Run arena login, or set
ARENA_API_KEY to a personal access token from Profile then CLI API key.
Without either, the deployment returns a 403 asking you to log in.
Tutorial
- Training GRPO on GSM8K in Arena
Complete walkthrough of fine-tuning an LLM with GRPO on the GSM8K dataset in Arena.
In-account Snowflake¶
Train on a Snowflake table and serve the model without the data leaving the account, with the Arena Native App from the Snowflake Marketplace. See Arena Native App on Snowflake.