When the buyer of a business is an unrelated third party, consulting agreements are used more frequently than employment agreements. Usually the buyer will agree to make specified payments at certain intervals of time, and the seller agrees to be available for consultation for a specified number of hours per month. The seller is to be "on call" and still gets the payments even if no services are required.
One disadvantage to these agreements is that you may need to make yourself available for consultation, even if your plan was to retire to a yacht off of Tahiti. A possible solution, provided the buyer is amenable to the plan, is to set up your own consulting company and have it sign the agreement, so that you can substitute other consultants if you are not available.
Payments made under consulting agreements are taxed as ordinary income to you, and are deductible by the buyer. They can serve a dual purpose of compensating you for your wisdom and also making a portion of the cash you get (which might otherwise be part of the purchase price) deductible to the buyer. The IRS is well aware of the potential for abuse in this situation, so make sure that the agreement is in writing and that any payments under consulting arrangements are within the range of fair market value, given your experience, contacts, knowledge of the business, etc.