The anhydrides react with amines and ammonia to form amides. Under the reaction conditions, a carboxylic acid is also obtained.
The mechanism of the reaction consists in the addition of ammonia with subsequent elimination of acetic acid.
Stage 1. Addition of ammonia
Stage 2. Acid-base balance
Stage 3. Elimination