AgentModel maintains an internal parameter dictionary. Built-in parameters control graph construction and convergence detection. You can also add custom parameters to pass data into your behavior functions without relying on global variables.
Built-in parameters
These four parameters are always present and cannot be deleted:num_nodes
num_nodes
Number of nodes to create when
initialize_graph() builds the graph. Ignored if you supply a custom graph via set_graph().graph_type
graph_type
Graph topology for
initialize_graph(). Accepted values: "complete", "cycle", "wheel". See Graph structures.convergence_data_key
convergence_data_key
Node attribute monitored by
run_to_convergence() and is_converged(). Must be set before running to convergence. See Convergence.convergence_std_dev
convergence_std_dev
Standard deviation threshold for convergence. The simulation stops when the std dev of
convergence_data_key across all nodes is at or below this value.Managing parameters
update_parameters
Add new parameters or update existing ones by passing a dictionary:update_parameters with a key that already exists overwrites the previous value. Calling it with a new key adds the parameter.
delete_parameters
Remove one or more custom parameters by passing a list of keys:delete_parameters with no arguments (or None) resets the entire parameter dictionary to its default state:
list_parameters
Returns a list of all current parameter keys, including any custom ones you have added:Subscript access
You can read and write any parameter using dictionary-style subscript notation:update_parameters({key: value}). There is no restriction on which parameters you can write this way — including the built-in ones.
Custom parameters in behavior functions
Bothinitial_data_function and timestep_function receive the AgentModel instance as their first argument. This means they can read any parameter directly:
convergence_data_key and convergence_std_dev are used at runtime.