Kayn Ng (@Kayn_Ng) profile picture
Joined February 2026
Kayn Ng retweeted
Donald Trump and Benjamin Netanyahu started World War 3 against Iran because one had the dark videos of other guy presence in Esptein Island. So now worst to safe place you could be in the condition of nukes WW3 properly breaks out
78
143
3
984
320,633
Kayn Ng retweeted
1
26
1
164
3,301
Recently I interviewed a Senior Engineer. Strong candidate. Kafka? โœ… Redis? โœ… Microservices? โœ… Distributed systems? โœ… Then I asked: โ€œDesign Google Pay.โ€ He started with the basics. โ€œMobile app โ†’ API Gateway โ†’ Payment Service โ†’ Bank/UPI.โ€ Fair enough. I asked: โ€œA user wants to send โ‚น10,000 to a friend. Walk me through the payment.โ€ He explained the flow. Create transaction. Call the bank. Update payment status. Send notification. Looks good. Then I added: โ€œThe bank successfully processes the payment.โ€ โ€œBut before Google Pay receives the response, the network connection drops.โ€ The user sees: โ€œPayment failed.โ€ So they click Pay again. Now I asked: โ€œWhat happens?โ€ โ€œCheck the transaction status before processing.โ€ Okay. But then I asked: โ€œWhat if both requests reach different servers at almost the same time?โ€ Both servers check the transaction. Both see: PENDING Both send the payment request to the bank. ๐Ÿ’ฅ โ‚น20,000 transferred instead of โ‚น10,000. โ€œUse Redis lock.โ€ Okay. โ€œWhat if the server holding the lock crashes?โ€ โ€œUse a database transaction.โ€ Okay. โ€œThe database transaction can't roll back a payment that already succeeded at the bank. Now what?โ€ Silence. And that's the point where โ€œDesign Google Payโ€ stops being about drawing boxes. It's about handling: โ†’ Retries โ†’ Timeouts โ†’ Duplicate requests โ†’ Concurrent processing โ†’ Partial failures โ†’ Bank callbacks โ†’ Reconciliation โ†’ Payment state consistency You can't guarantee that a request will never be retried. You need to guarantee that a retry won't create another payment. That's where idempotency comes in. The same payment request can arrive multiple times. But the system should produce the same outcome: โ‚น10,000 charged โ†’ once. Not twice. Not three times. Exactly once in effect. Your turn: How would you design Google Pay so network failures and retries never result in duplicate payments? There's a specific distributed-systems concept behind this. And you'll encounter it everywhere money moves through a distributed system. ๐Ÿ‘‡
19
45
4
486
43,045
Kayn Ng retweeted
LangChain tiene un harness open source inspirado en Claude Code. se llama Deep Agents y permite construir agentes con: - filesystem - memoria persistente - manejo de contexto - skills - subagentes - human in the loop vos elegรญs el modelo, conectรกs tus propias tools y personalizรกs el resto. bรกsicamente, la infraestructura para construir agentes avanzados sin arrancar desde cero. les dejo el repo: github.com/langchain-ai/deepโ€ฆ
6
16
6
224
31,821
System Design Series : How Microservices Communicate
31
1
233
5,800
Kayn Ng retweeted
Most developers are learning AI wrong You don't need another prompt engineering course You need to learn how production AI agents actually work - orchestration, RAG, evals, context engineering, inference, and more I put together the entire course here:
18
56
3
317
346,010
Kayn Ng retweeted
Most developers are learning AI wrong You don't need another prompt engineering course You need to learn how production AI agents actually work - orchestration, RAG, evals, context engineering, inference, and more I put together the entire course here:
27
106
7
462
622,178
Kayn Ng retweeted
Agents vs. Graphs, clearly explained! spawning more agents is great, but it has a ceiling nobody says out loud: five agents is a count. a graph is a shape. only one of them changes the answer. point five agents at the same pile with the same window and they converge. the first one writes a finding, the rest read it, and all five reports centre on the same thing. you paid five times for one opinion with four echoes. Graph engineering fixes this by moving the decision up a layer: not how many agents, but who is allowed to look at what. you need both. here's how it works: โ†ณ the count buys you throughput. five things happening instead of one โ†ณ the shape buys you coverage. five different things happening instead of the same one five times Prompts โ†’ Context โ†’ Harness โ†’ Agents โ†’ Graphs the node that does this is the splitter, and it decides more than any other node in the system. cut a repository by folder and four workers audit the same three files. cut it by blast radius and each one sees something the others cannot. the trick is being selective about what each lane is allowed to see. separate contexts are not a nice-to-have, they are the mechanism. if two agents are meant to produce different things, they must not share a window. if they are meant to produce the same thing, you did not need two agents. one thing to know before you scale it. a branch that throws does not reject the batch. it resolves to null, and that is the containment. which means your merge quietly receives a short list. โ†ณ filter the nulls before the merge, or one dead lane poisons the whole result โ†ณ never index a merge by position. eight good branches and one failure will shift everything by one, silently skip that and the run looks like it worked. the output is just missing a lane, and nothing errored. and the one that eats whole nights: multi-agent setups can use up to fifteen times the total tokens of a single chat, because every lane reloads its own core. you are trading total tokens for a clean main window. usually the right trade, always a choice. below i have quoted my full guide on graph engineering. it covers the three topologies, the verifier patterns, and where the gate should actually open. save this and read it below โ†“
33
112
9
768
97,761
Installs 160+ production-ready skills for Claude Code, Cursor, and Codex covering DevOps, security, and infrastructure. github.com/BagelHole/DevOps-โ€ฆ
5
127
803
37,615
If I had to become an AI Reliability Engineer (AI SRE). I'd do this. Stage 1:) Traditional SRE Foundations Learn: Linux, Docker, Kubernetes, Prometheus, Grafana, Terraform, CI/CD Build: Monitoring + alerting stack for a FastAPI service Why: AI systems still run on real infrastructure Stage 2:) LLM Inference Infrastructure Learn: vLLM, SGLang, Ollama, Ray Serve, KV cache, continuous batching, quantization Build: Self-hosted inference server with load balancing Why: You cannot make reliable what you cannot serve Stage 3:) AI Observability and Tracing Learn: OpenTelemetry for LLMs, LangSmith, Langfuse, Arize Phoenix, structured logging Build: Distributed tracing across a multi-agent workflow Why: You cannot fix what you cannot see Stage 4:) Evaluation and Quality Gates Learn: DeepEval, RAGAS, golden datasets, LLM-as-a-judge, regression testing Build: CI pipeline that blocks merges when eval scores drop Why: Quality must be enforced not hoped for Stage 5:) Cost Engineering and AI FinOps Learn: Token tracking, semantic caching, prompt caching, model routing, budget alerting Build: Cost dashboard with per-user and per-feature spend tracking Why: Bad economics kills AI products faster than outages Stage 6:) Resilience and Fallback Patterns Learn: Circuit breakers, exponential backoff, multi-model fallback, graceful degradation Build: Router that survives provider outages with zero user impact Why: Providers fail. Your system should not. Stage 7:) AI Guardrails and Security Learn: Prompt injection defense, PII redaction, NeMo Guardrails, output filtering, sandboxing Build: Guardrail middleware that runs on every single request Why: One breach destroys trust forever Stage 8:) Load Testing and Chaos Engineering Learn: Locust for LLMs, chaos experiments, context-window exhaustion tests, injection fuzzing Build: Load test suite simulating 1000+ concurrent agent requests Why: Break it in staging, not in production Stage 9:) Vector Database Reliability Learn: Qdrant/Pinecone/Weaviate scaling, HNSW tuning, index optimization, pipeline monitoring Build: Backup, recovery and failover plan for a vector cluster Why: Retrieval is the backbone of most AI products Stage 10:) Incident Management for AI Learn: SLOs for non-deterministic outputs, hallucination spike runbooks, drift alerting, post-mortems Build: Incident response playbook + on-call rotation docs Why: AI fails differently. Your runbooks must too. Stage 11:) Auto-Scaling and Queuing Learn: KEDA for GPU pods, request queuing, priority routing, thundering herd handling Build: Auto-scaling setup that survives a 10x traffic spike Why: Demand is unpredictable. Capacity must be elastic. Stage 12:) The AI SRE Portfolio Learn: Public post-mortems, open-source eval tooling, architecture writeups Build: One production-grade AI system with full observability, evals & docs Why: Proof beats promises in every interview Builders get hired. (Bookmark it)
15
6
1
57
3,345
Integrating ๐—”๐—ด๐—ฒ๐—ป๐˜๐—ถ๐—ฐ ๐—ฅ๐—”๐—š Systems via ๐— ๐—–๐—ฃ ๐Ÿ‘‡ If you are building RAG systems and packing many data sources for retrieval, most likely there is some agency present at least at the data source selection for retrieval stage. This is how MCP enriches the evolution of your Agentic RAG systems in such case (๐˜ฑ๐˜ฐ๐˜ช๐˜ฏ๐˜ต 2.): ๐Ÿญ. Analysis of the user query: we pass the original user query to a LLM based Agent for analysis. This is where: โžก๏ธ The original query can be rewritten, sometimes multiple times to create either a single or multiple queries to be passed down the pipeline. โžก๏ธ The agent decides if additional data sources are required to answer the query. ๐Ÿฎ. If additional data is required, the Retrieval step is triggered. We could tap into variety of data types, few examples: โžก๏ธ Real time user data. โžก๏ธ Internal documents that a user might be interested in. โžก๏ธ Data available on the web. โžก๏ธ โ€ฆ ๐—ง๐—ต๐—ถ๐˜€ ๐—ถ๐˜€ ๐˜„๐—ต๐—ฒ๐—ฟ๐—ฒ ๐— ๐—–๐—ฃ ๐—ฐ๐—ผ๐—บ๐—ฒ๐˜€ ๐—ถ๐—ป: โœ… Each data domain can manage their own MCP Servers. Exposing specific rules of how the data should be used. โœ… Security and compliance can be ensured on the Servel level for each domain. โœ… New data domains can be easily added to the MCP server pool in a standardised way with no Agent rewrite needed enabling decoupled evolution of the system in terms of ๐—ฃ๐—ฟ๐—ผ๐—ฐ๐—ฒ๐—ฑ๐˜‚๐—ฟ๐—ฎ๐—น, ๐—˜๐—ฝ๐—ถ๐˜€๐—ผ๐—ฑ๐—ถ๐—ฐ ๐—ฎ๐—ป๐—ฑ ๐—ฆ๐—ฒ๐—บ๐—ฎ๐—ป๐˜๐—ถ๐—ฐ ๐— ๐—ฒ๐—บ๐—ผ๐—ฟ๐˜†. โœ… Platform builders can expose their data in a standardised way to external consumers. Enabling easy access to data on the web. โœ… AI Engineers can continue to focus on the topology of the Agent. ๐Ÿฏ. Retrieved data is consolidated and Reranked by a more powerful model compared to regular embedder. Data points are significantly narrowed down. ๐Ÿฐ. If there is no need for additional data, we try to compose the answer (or multiple answers or a set of actions) straight via an LLM. ๐Ÿฑ. The answer gets analyzed, summarized and evaluated for correctness and relevance: โžก๏ธ If the Agent decides that the answer is good enough, it gets returned to the user. โžก๏ธ If the Agent decides that the answer needs improvement, we try to rewrite the user query and repeat the generation loop. Learn how to handle Agentic RAG system with data sources via MCP hands-on in my End-to-end AI Engineering Bootcamp. Next cohort kicking off on January 12th: maven.com/swirl-ai/end-to-enโ€ฆ ๐ŸŽ Code NYRESOLUTION for 10% off. Are you using MCP in your Agentic RAG systems? Let me know about your experience in the comment section ๐Ÿ‘‡
18
99
4
556
27,794
Kayn Ng retweeted
Naive RAG vs. Agentic RAG, explained visually: Naive RAG has well-known failure modes: - It retrieves once and generates once. If the context isn't relevant, it can't search again. - It treats every query the same. A simple lookup and a complex multi-hop reasoning task go through the identical retrieve-then-generate path. - There's no verification. The system blindly trusts whatever the retriever returns. Agentic RAG introduces decision-making loops at each stage to fix this. Steps 1-2) A query rewriting agent reformulates the raw query. This goes beyond fixing typos, like optimizing it for retrieval by making vague terms precise, decomposing complex queries into sub-queries, and expanding abbreviations. Steps 3-5) A routing agent decides if the query even needs external context. If not, retrieval is skipped. If yes, a source selector picks the best backend for this specific query type. Steps 6-7) The source selector routes to the most appropriate source: vector DB for semantic search, web search for real-time info, or structured APIs for tabular data. The retrieved context and rewritten query are combined into the prompt. Steps 8-9) The LLM generates an initial response. Steps 10-12) A validation agent (known as Corrective RAG) checks whether the response is relevant, grounded, and complete. If it passes, it's returned. If not, the system loops back to Step 1 with a reformulated query. This continues for some iterations until we get a satisfactory response or the system admits it cannot answer. The reason this works is that each agent acts as a quality gate. The rewriter ensures retrieval precision. The router ensures the right source is queried. The validator ensures the output is grounded. Individual failures get caught and corrected rather than silently propagated. That said, the diagram below shows one of many blueprints of an Agentic RAG system. Production systems increasingly combine Corrective RAG, Adaptive RAG, Self-RAG, and hybrid search (vector + lexical with reranking) based on latency budgets and accuracy requirements. ๐Ÿ‘‰ Over to you: What does your Agentic RAG setup look like? ____ Find me โ†’ @_avichawla Every day, I share tutorials and insights on DS, ML, LLMs, and RAGs.
33
118
7
702
39,319
โ€œI will build a RAG system for my company in one weekโ€ - that is what I often hear nowadays from recently turned AI experts. Unfortunately, building a ๐—ฝ๐—ฟ๐—ผ๐—ฑ๐˜‚๐—ฐ๐˜๐—ถ๐—ผ๐—ป ๐—ด๐—ฟ๐—ฎ๐—ฑ๐—ฒ ๐—ฅ๐—ฒ๐˜๐—ฟ๐—ถ๐—ฒ๐˜ƒ๐—ฎ๐—น ๐—”๐˜‚๐—ด๐—บ๐—ฒ๐—ป๐˜๐—ฒ๐—ฑ ๐—š๐—ฒ๐—ป๐—ฒ๐—ฟ๐—ฎ๐˜๐—ถ๐—ผ๐—ป (๐—ฅ๐—”๐—š) ๐—ฏ๐—ฎ๐˜€๐—ฒ๐—ฑ ๐—”๐—œ ๐˜€๐˜†๐˜€๐˜๐—ฒ๐—บ is a challenging task. Here are some of the moving parts in the RAG based systems that you will need to take care of and continuously tune in order to achieve desired results: ๐—ฅ๐—ฒ๐˜๐—ฟ๐—ถ๐—ฒ๐˜ƒ๐—ฎ๐—น: ๐˜ ) Chunking - how do you chunk the data that you will use for external context. - Small, Large chunks. - Sliding or tumbling window for chunking. - Retrieve parent or linked chunks when searching or just use originally retrieved data. ๐˜Š ) Choosing the embedding model to embed and query and external context to/from the latent space. Considering Contextual embeddings. ๐˜‹ ) Vector Database. - Which Database to choose. - Where to host. - What metadata to store together with embeddings. - Indexing strategy. ๐˜Œ ) Vector Search - Choice of similarity measure. - Choosing the query path - metadata first vs. ANN first. - Hybrid search. ๐˜Ž ) Heuristics - business rules applied to your retrieval procedure. - Time importance. - Reranking. - Duplicate context (diversity ranking). - Source retrieval. - Conditional document preprocessing. ๐—š๐—ฒ๐—ป๐—ฒ๐—ฟ๐—ฎ๐˜๐—ถ๐—ผ๐—ป: ๐˜ˆ ) LLM - Choosing the right Large Language Model to power your application. โœ… It is becoming less of a headache the further we are into the LLM craze. The performance of available LLMs are converging, both open source and proprietary. The main choice nowadays is around using a proprietary model or self-hosting. ๐˜‰ ) Prompt Engineering - having context available for usage in your prompts does not free you from the hard work of engineering the prompts. You will still need to align the system to produce outputs that you desire and prevent jailbreak scenarios. And letโ€™s not forget the less popular part: ๐˜) Observing, Evaluating, Monitoring and Securing your application in production! What other pieces of the system am I missing? Let me know in the comments ๐Ÿ‘‡
15
60
2
298
12,052
Kayn Ng retweeted
DevOps vs. MLOps vs. LLMOps, clearly explained: Many teams are trying to apply DevOps practices to LLM apps. But DevOps, MLOps, and LLMOps solve fundamentally different problems. DevOps is software-centric. You write code, test it, and deploy it. The feedback loop is straightforward, i.e., does the code work or not? MLOps is model-centric. Here, you're dealing with data drift, model decay, and continuous retraining. The code might be fine, but the model's performance can degrade over time because the world changes. LLMOps is foundation-model-centric. Here, you're typically not training models from scratch. Instead, you're selecting foundation models and then optimizing through three common paths: - Prompt engineering - Context/RAG setup - Fine-tuning But here's what really separates LLMOps: The monitoring is completely different. In MLOps, you track data drift, model decay, and accuracy. In LLMOps, you're watching for: - Hallucination detection - Bias and toxicity - Token usage and cost - Human feedback loops This is because you can't just check if the output is "correct." You need to ensure it's safe, grounded, and cost-effective. The evaluation loop in LLMOps also feeds back into all three optimization paths simultaneously. Failed evals might mean you need better prompts, richer context, OR fine-tuning. So it's not a linear pipeline anymore. One more thing: prompt versioning and RAG pipelines are now first-class citizens in LLMOps, just like data versioning became essential in MLOps. And the ops layer you choose should match the system you're building. If you want to go deeper into LLMOps, I wrote a full LLM engineering roadmap a while back. It walks through the eight pillars of building LLM systems, starting at prompt engineering and ending at observability and safety, with free and open-source resources attached to each one. You can read it below.
40
76
369
52,383
Design a Notification Service: API โ†’ Kafka โ†’ Validate/Prioritize โ†’ Redis rate limiting โ†’ User Preferences โ†’ Kafka โ†’ channel handlers (SMS/Email/Push/IVRS) โ†’ multiple vendors โ†’ Cassandra tracking. Bulk notifications use Elasticsearch + Query Engine for user targeting.
2
65
333
10,217
If you're learning Kubernetes, this repo has 24 hands-on labs worth checking out ๐Ÿ‘‡ It covers: โ†’ Pods, Deployments, ReplicaSets, StatefulSets & DaemonSets โ†’ Rollouts, rollbacks & live scaling โ†’ Secrets, ConfigMaps, PVs & PVCs โ†’ Node affinity, taints & tolerations, RBAC โ†’ Services, Ingress & Helm โ†’ Kubeadm cluster setup You get the YAML, the kubectl commands, and an actual lab to work through. Pick one. Open your terminal. Start breaking things. Repo: github.com/omerbsezer/Fast-Kโ€ฆ
13
80
468
15,262
Kayn Ng retweeted
All you need for System Design Interviews ๐Ÿ“Œ github.com/liquidslr/system-โ€ฆ
9
283
1,818
83,928