Skip to content

Agent API

Complete API reference for Agent operations.

Agent Class

class Agent:
    def __init__(self, name, model_type, input_size, output_size, config=None)

Methods

forward(input)

Process input through the agent.

output = agent.forward(input_tensor)

save(path)

Save agent to disk.

agent.save("./agent.pt")

load(path)

Load agent from disk.

agent = Agent.load("./agent.pt")

get_config()

Retrieve agent configuration.

config = agent.get_config()

set_mode(mode)

Set agent mode (train/eval).

agent.set_mode("eval")

get_parameters()

Get model parameters.

params = agent.get_parameters()

freeze()

Freeze agent parameters.

agent.freeze()

unfreeze()

Unfreeze agent parameters.

agent.unfreeze()

Agent Properties

Property Type Description
name str Agent identifier
device str Computation device
dtype torch.dtype Data type
trainable bool Is trainable
num_params int Total parameters

See Also