Latest API and SDK updates. Subscribe via RSS · Discord

July 20, 2025

Summary

Introducing WebSocket Streaming - receive email events in real-time as they happen. Build reactive agents that respond instantly to new messages, deliveries, and bounces without polling. Perfect for building interactive, event-driven email experiences.

What’s new?

WebSocket endpoint:

  • wss://ws.agentmail.to/v0 - Real-time event streaming

Events streamed:

  • message.received - New inbound email detected
  • message.sent - Outbound email sent successfully
  • message.delivered - Delivery confirmed by recipient server
  • message.bounced - Bounce detected (permanent or temporary)
  • message.complained - Spam complaint received

Connection features:

  • JWT-based authentication for secure connections
  • Automatic reconnection with exponential backoff
  • Event filtering by inbox for targeted subscriptions
  • Low-latency delivery (typically under 100ms)
  • Support for thousands of concurrent connections

Use cases

Build agents that:

  • Respond to emails within seconds of receipt
  • Monitor deliverability in real-time across all inboxes
  • Trigger workflows instantly on specific events
  • Build interactive conversational email experiences
  • Scale to handle high-volume email operations
  • React to bounces and complaints immediately
1from agentmail import AgentMail
2
3client = AgentMail(api_key="your-api-key")
4
5# subscribe to events for an inbox
6async with client.websockets.subscribe(
7 inbox_id="support@example.com"
8) as ws:
9 async for event in ws:
10 if event.type == "message.received":
11 print(f"New email from: {event.data.from_}")
12 response = await generate_response(event.data.text)
13 await client.messages.reply(
14 message_id=event.data.message_id,
15 text=response
16 )

Get started with WebSocket Streaming to build real-time email agents.