The anhydrides react with amines and ammonia to form amides. Under the reaction conditions, a carboxylic acid is also obtained.

 
anhidridos-reaccion-aminas
 
The mechanism of the reaction consists in the addition of ammonia with subsequent elimination of acetic acid.
 
Stage 1. Addition of ammonia
 
anhidridos-reaccion-aminas
 
Stage 2. Acid-base balance
 
anhidridos-reaccion-aminas
 
Stage 3. Elimination
 
anhidridos-reaccion-aminas