Agent Trainer
Main training interface for RL algorithms and agent optimization.
rllm.trainer.agent_trainer
AgentTrainer
A wrapper class that allows users to easily train custom agents with custom environments without having to directly interact with the underlying training infrastructure.
Source code in rllm/trainer/agent_trainer.py
__init__
__init__(workflow_class: type | None = None, workflow_args: dict[str, Any] | None = None, agent_class: type | None = None, env_class: type | None = None, agent_args: dict[str, Any] | None = None, env_args: dict[str, Any] | None = None, config: dict[str, Any] | list[str] | None = None, train_dataset: Dataset | None = None, val_dataset: Dataset | None = None)
Initialize the AgentTrainer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_class
|
type | None
|
The custom agent class to use for training |
None
|
env_class
|
type | None
|
The custom environment class to use for training |
None
|
config
|
dict[str, Any] | list[str] | None
|
Configuration overrides to apply to the default config Can be a dictionary with dot notation keys (e.g., {"data.train_batch_size": 8}) or a list of strings in the format "key=value" (e.g., ["data.train_batch_size=8"]) |
None
|
train_dataset
|
Dataset | None
|
Optional train dataset to use |
None
|
val_dataset
|
Dataset | None
|
Optional validation dataset to use |
None
|
agent_args
|
dict[str, Any] | None
|
Optional arguments to pass to the agent class |
None
|
env_args
|
dict[str, Any] | None
|
Optional arguments to pass to the environment class |
None
|