procedure ExternalStabilityTest
input:  agents: the list of agents with a history of their utility function values
output: stability (true or false) and the period of the overall behaviour if the system is stable
begin
for each agent in agents do
   if not PeriodicUtility() then
     return (false, 0)
   end if
end for
 periodList = empty list
for each agent in agents do
  add utilityPeriod() to periodList
end for
 lcm = least common multiple of elements in periodList
return (true, lcm)
end procedure
Pseudocode 2: External test for stability.