count_prop

Aggregationboth

Counts how many agents in an array have a specific value for a given property. Common pattern: counting connected agents in a particular state (e.g., active members of a team, completed steps of a process). The comparison is exact — string equality for text properties, numeric equality for numbers.

Signature

count_prop(agents, prop_name, value) -> number

Example

// Number of active employees on a team
count_prop(get_connected(agent, "has_member"), "state", "Active")

// Number of completed predecessors
count_prop(get_connected(agent, "follows"), "state", "Completed")