Skip to content

LinearAgent

Bases: BaseAgent

This agent will perform a list of actions, and either repeat them indefinately or Sleep. If no action list is given it will always Sleep.

This agent is intended to help with stress testing and debugging, as it allows the tester to perform a series of specific actions that they have pre-listed. As actions sometimes require other action to have been performed successfully to function, this sequential execution makes it possible to test these actions. The agent can also be used to test that another type of agent is reacting correctly to a specif series of actions.

Attributes:

Name Type Description
action_list Dict[int:Action, dict]

a list of actions, with parameters, to be executed sequentially.

circular bool

if true, the list of actions will be repeated once the end is reached, otherwise the remaining actions will be Sleep

step int

the agent's internal step counter (not accurate to the State)

last_action str

the name of the previous action that was performed

print_action_output bool

print the action and action success

print_obs_output bool

print the observation from the action

Example

An action list could look like the following:

action_list = {
    0: PrivilegeEscalate(
        hostname='contractor_network_subnet_user_host_2', 
        session=0, 
        agent='red_agent_0'),
    1: DiscoverRemoteSystems(
        subnet=IPv4Network('10.0.0.1/24'), 
        session=0, 
        agent='red_agent_0'),
    2: AggressiveServiceDiscovery(
        session=0, 
        agent='red_agent_0', 
        ip_address=IPv4Address('10.0.0.2')
}

Functions

get_action

get_action(observation, action_space)

Returns the next action from the action list, or Sleep.

last_turn_summary

last_turn_summary(observation: dict)

Prints action name, parameters, success and sometimes observation