Mobile code carried by a mobile agent can automatically travel to several data sources in order to complete a designated program. Traditionally, most mobile agent systems [7][8][13] need explicit involvement of the programmer to designate migration and computation schedule of the agent. In this paper, we study the compilersupported agent scheduling to optimize either the number of the migrations or the amount of data transfer. Two approaches are proposed and evaluated in our experiments, i.e. the static and dynamic scheduling algorithms. The first algorithm works totally offline. After converting the program control flow graph (CFG) to program dependency graph (PDG), the schedule is worked out. On the other hand, in order to dynamically schedule the agent when it reaches predicate (control flow) nodes, our dynamic scheduling algorithm generates the motion schedule incrementally. Finally, our results show good improvement over unoptimized agent code both in terms of data transfer sizes...