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.
Supports two backends: - 'verl' (default): Standard training backend supporting both workflow and agent/env classes - 'fireworks': Pipeline-based training backend optimized for workflow-based training
Source code in rllm/trainer/agent_trainer.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
__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, backend: Literal['verl', 'fireworks', 'tinker'] = 'verl', agent_run_func: Callable | None = None)
Initialize the AgentTrainer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workflow_class
|
type | None
|
The workflow class to use for training |
None
|
workflow_args
|
dict[str, Any] | None
|
Optional arguments to pass to the workflow class |
None
|
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
|
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
|
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
|
backend
|
Literal['verl', 'fireworks', 'tinker']
|
Training backend to use ('verl' or 'fireworks'). Default is 'verl' |
'verl'
|