Add spawn function to AI.py