Agent Behavior Prediction and Its Generalization Analysis