use Statechart
Select the agent's active statechart. Allowed only when the current chart (if any) is not started — between runs, before activation, or after the current chart has stopped / reached a final state. Throws otherwise. If the model is running when this is called, the new chart starts immediately; otherwise AgentModel.initialize starts it at the next replication.