What's the difference between AGI and AMI

Dear All,
I’m new here. I have a question:
What’s the difference between AGI and AMI.

Thank you in advance,

AGI - Asterisk Gateway Interface - provides synchronous control over a channel in asterisk using stdio and stderr. Basically anything that can read from standard input and write to standard output can control an asterisk channel via AGI.


AMI - Asterisk Manager Interface - an asynchronous TCP based plain text protocol which allows asterisk to send events and receive commands.


Thank you for your reply.