How do I create AI Teams?

I could do tags but the only problem I am having is this. How to get the Team number of what the AI is looking at.