惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
L
Lohrmann on Cybersecurity
aimingoo的专栏
aimingoo的专栏
V
V2EX
S
Security Affairs
T
Threatpost
C
CXSECURITY Database RSS Feed - CXSecurity.com
IT之家
IT之家
J
Java Code Geeks
The Register - Security
The Register - Security
U
Unit 42
C
CERT Recently Published Vulnerability Notes
月光博客
月光博客
A
About on SuperTechFans
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
The Blog of Author Tim Ferriss
Cisco Talos Blog
Cisco Talos Blog
Project Zero
Project Zero
S
Schneier on Security
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
D
DataBreaches.Net
博客园 - 司徒正美
V
Vulnerabilities – Threatpost
T
Tor Project blog
Security Latest
Security Latest
T
The Exploit Database - CXSecurity.com
T
Threat Research - Cisco Blogs
Scott Helme
Scott Helme
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
M
MIT News - Artificial intelligence
云风的 BLOG
云风的 BLOG
小众软件
小众软件
L
LangChain Blog
Attack and Defense Labs
Attack and Defense Labs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
P
Palo Alto Networks Blog
A
Arctic Wolf
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园 - 叶小钗
D
Darknet – Hacking Tools, Hacker News & Cyber Security
L
LINUX DO - 最新话题
MongoDB | Blog
MongoDB | Blog
Webroot Blog
Webroot Blog
H
Hacker News: Front Page
Know Your Adversary
Know Your Adversary
Spread Privacy
Spread Privacy
AWS News Blog
AWS News Blog
Engineering at Meta
Engineering at Meta

Hacker News - Newest: "AI"

AI can't read an investor deck AI as an attorney? Student uses ChatGPT, Gemini to sue UW over alleged racial discrimination Hacking MCP Servers in AI Systems – The Rug Pull: Tool Changes After Approval GitHub - MeepCastana/KubeezCut: Free Web based video editor GitHub - GenAI-Gurus/awesome-eu-ai-act: Curated tools, official sources, OSS, templates, and guides for EU AI Act compliance. Can AI judge journalism? A Thiel-backed startup says yes, even if it risks chilling whistleblowers Coming soon: 10 Things That Matter in AI Right Now DARPA built an AI to fact-check enemy weapons claims What explains heterogeneity in AI adoption? When AI Meets Muscle: Context-Aware Electrical Stimulation Promises a New Way to Guide Human Movements - Department of Computer Science AI Changed How We Build. It Did Not Change What Matters. Linux rules on using AI-generated code - Copilot is OK, but humans must take 'full responsibility for the… Meta spins up AI version of Mark Zuckerberg to engage with employees Code Mode: Let Your AI Write Programs, Not Just Call Tools | TanStack Blog GitHub - Delavalom/graft: Go framework for building AI agents. Type-safe tools, multi-provider (OpenAI, Anthropic, Gemini, Bedrock), zero vendor SDKs. India's TCS tops estimates, says new AI models did not dent services demand Gen Z's fading AI hype Strong feeling: we are in a folded AI reality GitHub - machinarii/total-recall-catalog: A reference catalog of latest knowledge retrieval, memory & RAG systems GitHub - mensfeld/code-on-incus: Give each AI agent its own isolated machine with root, Docker, and systemd. Active defense detects and stops threats automatically.. Quantization, LoRA, and the 8% Problem: Benchmarking Local LLMs for Production AI Iran war: We spoke to the man making Lego-style AI videos that experts say are powerful propaganda Powell, Bessent discussed Anthropic's Mythos AI cyber threat with major U.S. banks GitHub - immartian/bellamem: Persistent belief-graph memory for AI agents. Retrieves decisive context by importance — not recency, not RAG, not /compact. recursive-mode: The Repo-Native Operating System for AI Engineering After the attack on Sam Altman's home, will AI CEO's go on the offensive? The biggest advance in AI since the LLM Opus 4.6 vs GPT 5.4 One Prompt Unity World Generation Test “AI polls” are fake polls Client Challenge Can AI be a 'child of God'? Inside Anthropic's meeting with Christian leaders How to Switch AI Chatbots and Why You Might Want To GitHub - MattMessinger1/agentic_refund_guardrail: Safe refund policy layer for AI agents — Python + TypeScript. Same behavior, shared tests. Adam/papers/emergent_values_whitepaper.md at master · strangeadvancedmarketing/Adam Ask HN: How do you stop playing 20 questions with your AI coding tools How far can automation and AI support psychotherapy? - @theU GitHub - stagas/rtdiff: realtime git diff gui and AI-assisted commits A Mac Studio for Local AI — 6 Months Later A History of the Early Years of AI at the University of Edinburgh Why AI Coding Tools Still Feel Stuck on Localhost MSN AI Datacenters Are Becoming Strategic Targets twitter.com Penn Researchers Use AI to Surface Unreported GLP-1 Side Effects in Reddit Posts Show HN: MoodSense AI (ML and FastAPI and Gradio, Deployed on Hugging Face) Moodsense Ai - a Hugging Face Space by aman179102 AI models are terrible at betting on soccer—especially xAI Grok GitHub - xialeistudio/echoic GitHub - HimashaHerath/github-dev-wrapped: AI-powered weekly GitHub activity reports deployed to GitHub Pages GitHub - alejandrobalderas/claude-code-from-source: Architecture, patterns & internals of Anthropic's AI coding agent — reverse-engineered from source maps AI and Tech brief: Ireland ascendant GitHub - Titovilal/context0: Context0 - Never Surrender Training for a Marathon with an AI Coach: What Worked and What Didn't Cyber Pulse: Agentic Intel - Apps on Google Play I Built an AI PR Reviewer That Catches Bugs by Not Looking for Bugs Gen Z workers are so fearful AI will take their job they’re intentionally sabotaging their company’s AI rollout | Fortune How AI Is Reimagining the Game of Golf–For Both Players and Courses GitHub - nattergabriel/reseed: A CLI tool for managing and distributing agent skills across projects Is SVG the final frontier? My AI workflow evolved from prompts to a near-autonomous workflow MLSharp Help - 3DGS Viewer & Generator I put my cognitive field based AI's runtime on GitHub Is Numble the first AI-proof game? A3: Kubernetes for autonomous AI agent fleets | Emergent Principles Deepali Vyas ("The Elite Recruiter") GitHub - msmarkgu/RelayFreeLLM: A restful API designed to route user prompts to various AI model providers. Unionized ProPublica staff are on strike over AI, layoffs, and wages Unleashing the Advantage of Quantum AI We're heading for an AI-fueled 'dementia crisis,' brain scientist warns The AI-Assisted Breach of Mexico's Government Infrastructure [pdf] GitHub - stef41/lmscan: 🔍 Detect AI-generated text and fingerprint which LLM wrote it. Open-source GPTZero alternative. Zero dependencies, works offline. MSN GitHub - visionscaper/collabmem: Enabling long-term collaboration with Agentic AI - building up episodic and world model memory over time with in-context awareness We gave an AI a 3 year retail lease in SF and asked it to make a profit | Andon Labs AI Code is Hollowing Out Open Source, and Maintainers are Looking the Other Way What leaked "SteamGPT" files could mean for the PC gaming platform's use of AI AI is the boss at this retail store. What could go wrong? GitHub - Wuzu11517/agentic-proxy: Local proxy meant to help reduce With Drones, Geophysics and ArtificiaI Intelligence, Researchers Prepare to Do Battle Against Land Mines A Single Operator, Two AI Platforms, Nine Government Agencies: The Full Technical Report 在 Steam 上购买 FriedrichAI: Offline AI 立省 10% GitHub - inevolin/resume-cli: Hit Claude usage limits? Resume any AI coding session elsewhere. Switch tools at zero friction. GitHub - atripati/ark: AI Runtime Kernel — a context operating system for AI agents. Eliminates tool bloat, loads only what’s needed, and gives LLMs their reasoning space back. How to Build a Secure AI PR Reviewer with Claude, GitHub Actions, and JavaScript This Startup Wants You to Pay Up to Talk With AI Versions of Human Experts Intel Arc Pro B70 Brings 32GB VRAM to Local AI for $949 WordPress 7.0: The Good, the AI, and the Still Missing AI on the couch: Anthropic gives Claude 20 hours of psychiatry IatroBench: Pre-Registered Evidence of Iatrogenic Harm from AI Safety Measures AI Agents Know About Supabase. They Don't Always Use It Right. The history and future of AI at Google, with Sundar Pichai Inside an AI‑enabled device code phishing campaign How Meta Used AI to Map Tribal Knowledge in Large-Scale Data Pipelines AI for Systems: Using LLMs to Optimize Database Query Execution Forecasting the Economic Effects of AI Introducing Tinker: Play with AI, bring your ideas to life AI sheds light on an ancient gaming mystery People really hate AI but not as much as Iran—or Democrats | Fortune What is an AI Product Engineer? Phoebe Gates wants her $185 million AI startup to succeed with 'no ties to my privilege or my last name': 'I have a chip on my shoulder' | Fortune
Is it easy to build advanced AI features on SSE? — /dev/knill
zknill · 2026-04-27 · via Hacker News - Newest: "AI"

Agents used to be a thing you talked to synchronously. Now they’re a thing that runs in the background while you work. When you make that change, the transport breaks.

But a lot of folks are saying: “No, you can just use Server-Sent Events (SSE) with Last-Event-ID to get a durable stream, it’s easy”. And yes, all of this is do-able. But I contest that it’s easy. So let’s walk through how to do it, and you can decide for yourself.

Catch up on the previous article and discussion

Tokens vs. the API responses

Tokens are the individual pieces of text that LLMs generate, but the actual responses you get back from LLM providers have a bunch more stuff in the. The responses have slightly different structure and format, but pretty much all follow a similar pattern.

Some kind of ‘start’ event, some ‘delta’ events that contain text or tool call requests, and then some kind of ’end’ event.

To get the full response text, you either concatenate the text deltas together, or some of the APIs will give you the ‘full’ response as it’s own event type at the end.

Vercel AI SDK:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{"type":"text-delta","value":"Let me"}
{"type":"text-delta","value":" look that up."}
{"type":"tool-call-streaming-start","value":{"toolCallId":"call_001","toolName":"search"}}
{"type":"tool-call-delta","value":{"toolCallId":"call_001","argsTextDelta":"{\"query\":\"weather Belfast\"}"}}
{"type":"tool-call","value":{"toolCallId":"call_001","toolName":"search","args":{"query":"weather Belfast"}}}
{"type":"tool-result","value":{"toolCallId":"call_001","result":{"temp":"14°C","condition":"cloudy"}}}
{"type":"text-delta","value":"It's currently"}
{"type":"text-delta","value":" 14°C and cloudy"}
{"type":"text-delta","value":" in Belfast."}
{"type":"finish-message","value":{"finishReason":"stop","usage":{"promptTokens":30,"completionTokens":28}}}

OpenAI Responses API:

1
2
3
4
5
6
7
8
9
{"event":"response.created","data":{"id":"resp_abc123","object":"response","status":"in_progress","model":"gpt-4o"}}
{"event":"response.output_item.added","data":{"output_index":0,"item":{"id":"item_001","type":"message","role":"assistant"}}}
{"event":"response.content_part.added","data":{"output_index":0,"content_index":0,"part":{"type":"output_text","text":""}}}
{"event":"response.output_text.delta","data":{"output_index":0,"content_index":0,"delta":"Hello"}}
{"event":"response.output_text.delta","data":{"output_index":0,"content_index":0,"delta":"! How can I"}}
{"event":"response.output_text.delta","data":{"output_index":0,"content_index":0,"delta":" help you today?"}}
{"event":"response.output_text.done","data":{"output_index":0,"content_index":0,"text":"Hello! How can I help you today?"}}
{"event":"response.output_item.done","data":{"output_index":0,"item":{"id":"item_001","type":"message","role":"assistant","content":[{"type":"output_text","text":"Hello!  How can I help you today?"}]}}}
{"event":"response.completed","data":{"id":"resp_abc123","object":"response","status":"completed","usage":{"input_tokens":25,"output_tokens":12}}}

Anthropic API:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{"event":"message_start","data":{"type":"message_start","message":{"id":"msg_01XFDUDYJgAACzvnptvVoYEL","type":"message","role":"assistant","content":[],"model":"claude-sonnet-4-20250514"}}}
{"event":"content_block_start","data":{"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}}
{"event":"content_block_delta","data":{"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello"}}}
{"event":"content_block_delta","data":{"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"!  How"}}}
{"event":"content_block_delta","data":{"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" can I"}}}
{"event":"content_block_delta","data":{"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" help you"}}}
{"event":"content_block_delta","data":{"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" today?"}}}
{"event":"content_block_stop","data":{"type":"content_block_stop","index":0}}
{"event":"message_delta","data":{"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"output_tokens":12}}}
{"event":"message_stop","data":{"type":"message_stop"}}

What you’ll notice, is that each ’line’ of the responses contain quite a lot of metadata for not very much text-delta data.

For example, a single event (line) from the Anthropic API contains 125 characters for just 5 characters of text delta:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
  "event": "content_block_delta",
  "data": {
    "type": "content_block_delta",
    "index": 0,
    "delta": {
      "type": "text_delta",
      "text": "Hello"
    }
  }
}

Why does this matter? It matters as soon as you decide to store every token, which we will get to in a sec.

Baseline: How to stream tokens to one client

This is table-stakes , right?

Starting with the basics that pretty much all AI chatbot demos have. A user makes an HTTP POST request with the prompt and current conversation history to the server. The server runs the agent, and the client holds the response open waiting for an SSE stream of response tokens from the agent.

SSE agent server architecture

Once streaming is finished, the server stores the full response in the database. The ‘conversation history’ stored in the database is really to re-hydrate the client on page refresh, it’s not for anything on the server.

This works fine for one user, on one device, on one connection that doesn’t drop. But out of the box, you get the behaviour in the gif below; if you refresh the page the in-progress token stream is lost, and the response only becomes available again once the stream has finished and the ‘full’ response is stored in the database.

Claude.ai page refresh

How to make the stream resumable

The SSE spec has a mechanism for resuming streams, which is based on the HTTP header Last-Event-ID.

The idea is that if every ’event’ in your server-sent events stream has a unique ID, then the client can keep track of the last event it received, and when the connection drops, it can reconnect and tell the server to resume from that last event.

Maybe you decide that each ‘response’ will have an id, say: abcxyz. And each token in-order will have an index. So abcxyz:0 is the first token, abcxyz:1 is the second token, and so on.

Horizontal scale architecture

Most applications are built on an architecture like the one above, where there are a number of stateless horizontally scaleable server replicas that can handle client requests. Data is stored in the database.

So all the tokens, from each LLM response, need to be stored in the database or in some token cache in case the ‘resume’ request with the Last-Event-ID is routed to a different server replica than the one that started the stream.

Because with the stateless server replica design, any replica can handle any user request. All the state lives in some database, and the replicas look it up on demand.

Resume on a different server replica

The problem is that you now need to write every token to the database. And you’re writing these tokens to a database on the off-chance that the client might drop. For successful requests where the HTTP SSE stream stays intact and delivers all the tokens, you will never need the per-token data that you’re writing to your database.

Remember that each token event has a lot of metadata for not that much text delta? Well, that means a lot of database writes for not much text. A lot of writes, for not much value.

And as soon as that response is finished by the LLM, the individual tokens are useless, because the ‘full’ response supersedes them all. So once the stream completes, you then need to go and clean up all the individual tokens in favour of the ‘full response’.

This is a pretty expensive write amplification for a feature that is only needed in the case of dropped connections. It used to be 1 request, 1 response, and a couple of database queries. Now you’ve got a db write per-token. (And don’t tell me you can batch them without thinking that through; because batching is just promising the client it can resume from an ID that you might not now have in the db).

How to handle cancellations

Cancellations get a bit awkward once you’ve made the stream resumable. Maybe before you assumed that a dropped connection from the client meant the server could cancel the request. But now, you assume that the client might come back with a Last-Event-ID to resume the stream, so a dropped connection doesn’t mean a cancellation any more.

Instead, you need to thread cancellations through the database too. A separate POST /cancel/{response_id} endpoint that writes a cancel marker into the same shared store the LLM inference process is writing to. The process handling the inference checks for the marker between tokens, and aborts the upstream LLM call if it sees one.

The replica that’s handling the LLM response might not be the replica that receives the cancellation request from the client, so the shared store is what routes the cancel through.

How to support multi-device

Multi-device is two problems, not one, and they don’t have the same answer.

You’re already some of the way there for the first problem, because you’re storing the individual tokens of the response in the database. So you can serve those to multiple devices. A second device can request the same conversation and receive the history and then the token stream for any in-flight responses.

But then there’s the second problem;

If device A sends a new prompt and starts receiving a token stream response, how does device B know there’s a new prompt and response that it should render?

… well device B doesn’t know.

Folks would tell you that you need all your clients to poll the server for new data. In “Patterns for building realtime features” we discussed why polling sucks; it’s a trade-off of latency if you poll in-frequently or hammering your servers with traffic if you poll frequently. Neither is great.

Of course you can make polling longer, with, yunno, long-polling. But that’s still polling.

Or, use a transport that does this for you

Warning

Stop reading here if you just wanted the how-to. Because I’m going to talk about what I think is better, and that is probably too ‘commercial’ for some folks.

All these features are doable on SSE, that’s what this post has been about. But I contest that they are ’easy’. They are janky and inefficient solutions to work around the fact that HTTP is just not a good transport for streaming LLM tokens and for building async agentic applications.

Ably pub/sub channel

I work for Ably, and I’m building a dedicated transport for AI applications that supports token streaming really well. It’s based on the pub/sub pattern in the diagram above.

The key differences from HTTP based SSE streaming are:

  1. The pub/sub channel still exists even if a client drops the connection to it, so the server can keep publishing tokens, and those tokens are available to the client the moment it reconnects. This decouples the connection lifetime from the agent lifecycle.
  2. Multiple users or multiple devices can connect to the same pub/sub channel and get the exact same token stream. The channel makes sure that clients get the tokens in realtime, and the Ably SDKs automatically handle reconnection, rewind for missed tokens, and history.
  3. The channel automatically compacts the token-deltas into full responses, so clients who are catching up only get 1 message for each full response instead of streaming every single token.
  4. Cancellations, interrupts, and steering are easy, because the channel handles the routing from the client publishing the interrupt on the client to the server process that’s running the agent. No more routing cancellations or followups through the database, the channel handles routing for you automatically.

So yes, you can build all these things if you want. But I’m not convinced they are ’easy’, or that SSE over HTTP is a suitable transport for streaming tokens from LLMs and building async agentic applications.