If the Agreement is signed by both spouses and both spouses had the opportunity to review the terms with a lawyer before they signed, then it is very unlikely that a Court would change the terms of alimony in the Agreement.
Technically, an Agreement can be overturned if the spouse asking to set it aside can prove that the Agreement was reached by fraud, coercion or extreme duress. Also if the terms of the Agreement are “unconscionably disparate” meaning that the terms of the Agreement leave one both spouse seriously disadvantaged vis-a-vis the other. However, please keep in mind that in order to be successful in undoing an Agreement, you will need to demonstrate an extreme case of the aforementioned conditions before a Judge will substitutes his/her judgment for the terms of the Agreement. In short, everyone going through a divorce is under extreme duress and everyone feels coerced, so your facts will need to be clear and extreme or the Judge will allow you to exercise your freedom to contract and you will have to live with your Agreement.
If you only have an agreement as to alimony and not as to other issues concerning the disposition of marital property, then most states (such as Maryland) have other equitable remedies to adjust any imbalance in the distribution of the marital estate (e.g. unfair alimony amount and duration). In Maryland, your best bet may be to ask the Court for a “monetary award” to adjust this imbalance — assuming you can prove the imbalance of assets/income in court.