agent CounterAgent extends Agent { #handles event CounterEvent; #uses plan CounterPlan; #posts event CounterEvent ev; private int currentCount; public CounterAgent(String agentName){ super(agentName); //give a name for the agent this.currentCount = 1; postEvent( ev.nextEvent(this.currentCount) ); //generate an event by calling a method of the event, the plan will be invoked automatically once this event happens } public static void main(String[] args){ CounterAgent counterAgent = new CounterAgent("My Counter Agent"); } }