AgentInterface
class AgentInterface(ABC)
Abstract interface for the agent half of an RL optimization — everything that is not the
Gymnasium environment step itself. Implement these methods on your RLAgentEnv
subclass. See RL Agents for how RLExecutor drives your class through the optimization loop.
Model transfer, export, and import are not part of AgentInterface; use ModelHandler for those.
Import
from adk.executors.rl import AgentInterface
Members
| Member | Description |
|---|---|
env_data | EnvData constructed by RLExecutor and passed at construction. |
agent_data | AgentData constructed by RLExecutor and passed at construction. |
Methods
compute_action
def compute_action(self, observation, info) -> action
Choose an action given the current observation and step info dict from the environment.
experience
def experience(
self,
observation,
info,
action,
reward,
next_observation,
next_info,
terminated,
truncated,
) -> None
Record one transition. Called once immediately after each step, in this argument order.
learn
def learn(self) -> None
Perform one learning update (e.g. gradient step). Called once after each experience call.
save_models
def save_models(self, save_to: Path) -> None
Persist agent state (weights, buffers, etc.) under the given directory. Training runs trigger saves periodically via RLExecutor.
load_models
def load_models(self, load_from: Path) -> None
Restore agent state from the given directory at the start of each optimization run.
After save_models followed by load_models, external behaviour must match the saved state — the platform and your tests should see identical actions for identical observations.
Related types
Observation and action types depend on your environment; the ADK uses Any at the interface boundary. Gymnasium spaces on your env define the concrete shapes.