Agent retention depends on the right balance of many factors: your firm's reputation, size, expertise, lead generation, training, atmosphere, team-building skills, referrals, fees, expenses, splits, caps, office availability, technology and equipment availability, e&o insurance, hand-holding if or when necessary, allowing agents the freedom to market in any way that is ethical and legal, transaction management assistance, troubleshooting, quality of agents, your personal integrity as a broker, how you treat your agents and people in general, etc.
that said, here are some random thoughts about your question:
you can contract for one year commitment from agents but you cannot stop agents from leaving prior to one year completion if they want to;
you can collect a training fee according to terms of your contract;
your contract should have terms that allows for you to terminate your association with an agent -- what if they engage in unethical or illegal behavior? -- are you going to keep them for a year? you have to specify, for example, that the training fee is still owed even if they are expelled from the brokerage for cause and definne what cause is
your contract should also have some resolution mechanism in case an agent contends that you as the broker did not live up to the representations you made about the quality and follow-through with your training
on a tangent: you could also put in your IC agreement that listings belong to the brokerage and are not transferable if an agent leaves or alternatively that a referral fee is owed if agents are allowed to move their listings on departure