sum_prop

Aggregationboth

Sums a numeric property across an array of agents. Most often used in combination with get_connected to roll up values from connected agents — total payroll, total inventory, total revenue. Non-numeric or missing properties evaluate to 0, so a partially-filled set still produces a clean number.

Signature

sum_prop(agents, prop_name) -> number

Example

// Total payroll across team members
sum_prop(get_connected(agent, "has_member"), "salary")

// Total inventory across connected warehouses
sum_prop(get_connected(agent, "stores_in"), "on_hand")