Behavior Keys


Behavior Keys define the data type of the fields that a behavior accesses on an agent's state. HASH uses behavior keys to improve the runtime performance of simulations. To view the behavior keys associated with a file, click the button containing the brain icon, located next to the help button, to toggle the key panel's visibility (highlighted in green below).

Adding behavior keys

From the behavior key panel you can define the field the behavior will need to access by putting in the name of the field - the same name as its field name on the agents state object - and the type of the field.

How do I know what fields I need to assign?

Any custom fields your behavior is getting from state, or setting in state, should have an entry in your behavior keys. For example, if your behavior calls state.cost = 300, you should have a behavior key called cost with type number. You do not need to create entries for special fields which HASH defines - see 'Built-in Fields' below.

If you type in the name of a behavior key that already exists in your simulation, the type will automatically be populated based on the existing key's type.

Behavior Keys are optional for in-browser simulation runs, but are required for cloud runs.

Previous

Join our community of HASH developers