Other great resources: Official JS API docs, Scripting Forum
MEDIUM
Act like a regular skirmish player...
Overview
At "Medium" difficulty level, the human that set-up the game is expecting your AI to act like a seasoned skirmish player:
Use a more beneficial build order (factories and labs before power gens and HQ)
Chose randomly from a few decent fixed research paths
Use decent droid designs and attack with larger groups
Implement some unit micro-management, but avoid early rushes
Basically, act like someone who's completed the campaign and is mostly focussed on single player tactics. Humans who set AI's to "Medium" level are basically looking for an opponent or ally that can keep up, but not dominate them.