How inbound email reaches an AI agent over a webhook or WebSocket, what the event contains, and how the agent replies in the same thread. Working code included.