AI 资讯
Handling Email Replies in an Agent Loop
You built the outbound half of an email agent. It sends a well-crafted message, the recipient writes back six hours later... and your agent has no idea. The reply either gets ignored or — arguably worse — gets treated as a brand-new conversation, and the agent reintroduces itself to someone it emailed yesterday. That gap between "can send" and "can converse" is where most email agents stall. Closing it takes four pieces: detection, context, routing, and a threaded response. Here's each one, using a Nylas Agent Account (in beta) as the mailbox — a hosted address the agent owns outright. Step 1: know a reply when you see one Every message.created webhook payload carries a thread_id . If the agent sent the original message, that thread already exists in your state store. So detection is a lookup, not a parsing exercise: app . post ( " /webhooks/nylas " , async ( req , res ) => { // Verify X-Nylas-Signature here. res . status ( 200 ). end (); const event = req . body ; if ( event . type !== " message.created " ) return ; const msg = event . data . object ; if ( msg . grant_id !== AGENT_GRANT_ID ) return ; const context = await db . getThreadContext ( msg . thread_id ); if ( context ) { await handleReply ( msg , context ); // active conversation } else { await handleNewMessage ( msg ); // fresh inbound — triage it } }); Why does this work without touching a single header? Because the threading already happened upstream: messages get grouped by their In-Reply-To and References headers, which every mail client sets on a reply. You never parse them yourself — the Threads API did the work. Step 2: pull the full conversation The webhook payload is a summary — subject , from , snippet . Before an LLM decides how to answer "sounds good, let's do Thursday," it needs to know what was proposed. Fetch the full message body and the thread: const fullMessage = await nylas . messages . find ({ identifier : AGENT_GRANT_ID , messageId : msg . id , }); const thread = await nylas . thread
AI 资讯
Stop Your Agent From Replying Twice: Dedup Patterns
Ever watched an email agent reply to the same message twice? The recipient gets two near-identical responses seconds apart, screenshots them, and your carefully engineered assistant suddenly looks like a script with a stutter. Worse: under real load, this isn't a freak event. It's the default outcome if you haven't designed against it. The double-reply problem has three distinct causes, and each one needs its own fix. Let's walk through them. Why duplicates happen at all First cause: webhook redelivery . Nylas — like most webhook providers — guarantees at-least-once delivery. If your endpoint doesn't return a 200 fast enough, or a transient network blip eats the response, the same message.created notification shows up again. Process both, send two replies. Second: concurrent workers . Your handler probably runs on multiple instances — Lambda invocations, ECS tasks, worker processes. Two of them can pick up the same notification at nearly the same instant and both start generating a reply. Third: shared inboxes . Two agents (or an agent and a human) watching the same mailbox can both decide a message is theirs to answer. This one isn't a duplicate event at all — it's a coordination problem, and it's the hardest to patch at the application layer. Fix one: deduplicate deliveries Track which message IDs you've processed, and check before doing anything else: app . post ( " /webhooks/nylas " , async ( req , res ) => { res . status ( 200 ). end (); const event = req . body ; if ( event . type !== " message.created " ) return ; const messageId = event . data . object . id ; // Atomic check-and-set. If the key exists, bail. const alreadyProcessed = await db . processedMessages . setIfAbsent ( messageId , { receivedAt : Date . now (), }); if ( alreadyProcessed ) return ; await handleMessage ( event . data . object ); }); The check-and-set must be atomic. In Redis that's SET messageId 1 NX EX 86400 ; in Postgres it's INSERT ... ON CONFLICT DO NOTHING with a row-count check. G
AI 资讯
Multi-Turn Email Conversations for LLM Agents
Day 0, 10:00 — your agent sends a demo follow-up. Day 2, 14:37 — the prospect replies with a question. Day 2, 14:39 — they send a second thought. Day 5 — silence, then a reply to something the agent said a week ago. Somewhere between day 0 and day 5, your process restarted twice and deployed once. A single send-and-forget email is easy. The timeline above is the actual job: a conversation spanning five exchanges over days, where the agent has to remember what it said, what it's waiting for, and where in the workflow it stands — across restarts, deploys, and hours of dead air. The multi-turn conversation recipe builds this loop on a Nylas Agent Account (the feature's in beta), running entirely on webhooks and the Threads API — no polling, no missed messages. State lives outside the model The core design decision: every active conversation gets a durable record keyed by the thread ID. const conversationRecord = { threadId : " nylas-thread-id " , grantId : AGENT_GRANT_ID , contactEmail : " prospect@example.com " , purpose : " demo_followup " , // What started this conversation step : " awaiting_reply " , // Where in the workflow we are turnCount : 1 , maxTurns : 10 , // Safety cap before escalation lastActivityAt : " 2026-04-14T10:00:00Z " , metadata : {}, }; The step field is the heart of it — a tiny state machine tracking what the agent is waiting for, which determines how the next inbound message gets handled. The store has to be durable (Postgres, Redis with AOF, DynamoDB); the gap between messages can be days, so in-memory state is a non-starter. Starting a conversation means sending the first message and persisting the record under the threadId the send returns: async function startConversation ({ to , subject , body , purpose , metadata }) { const sent = await nylas . messages . send ({ identifier : AGENT_GRANT_ID , requestBody : { to : [{ email : to . email , name : to . name }], subject , body , }, }); await db . conversations . create ({ threadId : sent . dat
AI 资讯
So you want to buy a gaming handheld PC
Gaming handhelds are amazing. They make it so much easier to fit all kinds of games into my day. Sadly, they’re less affordable than they’ve ever been — due to an unprecedented, AI-fueled shortage of memory chips, an unforced oil crisis, rampant inflation, fallout from tariffs, and more. But that’s not going to stop you. […]
AI 资讯
The Nintendo DS is still the best gaming handheld for travel
Even with the looming specter of rising prices, there's never been a better time for portable gaming. The Steam Deck has ushered in a new era of handheld PCs, the Analogue Pocket and other Game Boy-style remakes are making retro games more approachable than ever, the Playdate has led to an alternate universe of weirdo […]
开发者
Summer Upgrade Week
The sun is out, the sky is clear. It’s time to get outside and disconnect — from work, at least. This summer, we’re looking at all the ways to upgrade our free time indoors and out, from smart lights for the backyard to great gadgets to bring camping to ways to wind down at the local library.
AI 资讯
The Download: “reprogramming” aging, and the hidden sense of interoception
This is today’s edition of The Download, our weekday newsletter that provides a daily dose of what’s going on in the world of technology. Why “reprogramming” is the buzziest approach to reversing aging right now Earlier this week, Life Biosciences, a biotech company focused on reversing age-related diseases, announced that it had dosed its first…
工具
6 Best Digital Notebooks (2026): ReMarkable, Kobo, Kindle
These nifty tools combine the ease of jotting notes by hand with the power of saving them digitally.
AI 资讯
Pinecone Brings AI Agents Directly to Enterprise Data with Microsoft OneLake Integration
Pinecone has announced a new integration between its Nexus knowledge engine and Microsoft OneLake, aiming to fundamentally change how enterprise AI agents access and reason over corporate data. By Craig Risi
科技前沿
Cameras, sensors, and 3D body scans: All the tech helping eliminate blown calls
This World Cup, refs will use digital twins of each player to view plays from every angle.
AI 资讯
US surveillance law to expire for first time after lawmakers reject Trump’s controversial pick to lead spy agencies
The spy law known as Section 702, which authorizes the NSA and FBI's warrantless surveillance, will all but certainly expire on Friday for the first time.
科技前沿
Ebola cases in DRC rise to 676 as Kenya protests erupt over US plans
Outbreak responses are still playing catch-up as US works to isolate itself.
AI 资讯
This portable light is great for way more than camping
It's intended for camping, but BougeRV's T1 light is so versatile that it also makes for a great summer travel companion that'll continue to light the dark corners of your life long after you return. I used it for a few months during a recent road trip in my camper van, and it's the light […]
安全
4 Best Floodlight Security Cameras (2026) After Thorough Testing
Light up and secure your driveway, backyard, or porch with a floodlight security camera.
AI 资讯
Pokémon Go players unwittingly contributed to tech with military drone uses
The repurposing of Pokémon Go data for AI training continues to draw scrutiny.
产品设计
Tadka
Ship 10x more ad creative, without hiring a design team. Discussion | Link
AI 资讯
Bernie Sanders’ AI Sovereign Wealth Fund Plan
Let no one accuse Bernie Sanders of ducking the big questions. Writing in the New York Times last week, the senator asked : “Will the future of humanity be determined by a handful of billionaires who have promoted and developed AI, with virtually no democratic input, who stand to become even richer and more powerful than they are today?” We agree entirely that this is one of the most potent questions facing global democracy today. Our book, Rewiring Democracy , surveys the emerging uses for and impacts of AI in democracy around the world and reaches the same conclusion: that the most urgent risk posed by AI is the ...
科技前沿
Pedal Electric H/T Review: A Fast, Powerful, Stylish Ebike
The pedal-assist can be jerky, but the throttle offers smooth, powerful acceleration.
AI 资讯
Verizon sent man a refurbished phone with MDM, then deleted his data remotely
Failure raises questions about how Verizon prepares refurbished phones for new users.
AI 资讯
Rocket Report: Nova moving through test campaign; SpaceX IPO launches Friday
"If I needed to fly on another vehicle, what would that look like?"