How do you program an agent to prioritize competing goals or tasks?

Situational