<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ajitkumar Singh</title>
    <description>The latest articles on DEV Community by Ajitkumar Singh (@ajitkumar_singh_7a94b3eaa).</description>
    <link>https://dev.to/ajitkumar_singh_7a94b3eaa</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4173647%2F2d9a099b-f36d-4162-ac08-7019829b5e27.png</url>
      <title>DEV Community: Ajitkumar Singh</title>
      <link>https://dev.to/ajitkumar_singh_7a94b3eaa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ajitkumar_singh_7a94b3eaa"/>
    <language>en</language>
    <item>
      <title>A filtered DynamoDB Scan still reads the whole table</title>
      <dc:creator>Ajitkumar Singh</dc:creator>
      <pubDate>Wed, 11 Nov 2026 13:00:00 +0000</pubDate>
      <link>https://dev.to/ajitkumar_singh_7a94b3eaa/a-filtered-dynamodb-scan-still-reads-the-whole-table-13lp</link>
      <guid>https://dev.to/ajitkumar_singh_7a94b3eaa/a-filtered-dynamodb-scan-still-reads-the-whole-table-13lp</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fd56l0o87gzazwesk7jxg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fd56l0o87gzazwesk7jxg.png" alt="40 million orders of about 1 KB each, and a question that returns 200. A Query on the partition key evaluates 200 items, uses 24.5 read units and returns one page. A Scan with a filter expression evaluates 40,000,000 items, uses about 4.9 million read units and reads at least 38,147 pages, about 13 minutes: about 199,000 times the read capacity for the same 200 results. Design the key for the question: PK = CUSTOMER#4471, SK = ORDER#2026-09-09#8871 makes all orders for a customer, newest first, one Query." width="800" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DynamoDB is a distributed hash table with a sorted range, and nearly everything about designing for it follows from that. The partition key is hashed to choose a partition, so equality is the only operation it supports. The sort key orders items within a partition and supports ranges, prefixes and ordered reads. That is why so much DynamoDB modelling comes down to encoding hierarchy into the sort key, as in &lt;code&gt;ORDER#2026-09-09#8871&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The practical consequence: know your access patterns before you design the table. A Scan does not turn an unindexed access pattern into a cheap lookup.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a filtered Scan actually reads
&lt;/h2&gt;

&lt;p&gt;Take a table of 40 million order items at about 1 KB each, 40 GB in all, and a question whose answer is 200 orders.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Query on the partition key&lt;/th&gt;
&lt;th&gt;Scan with a filter expression&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Items evaluated&lt;/td&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;td&gt;40,000,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Read units&lt;/td&gt;
&lt;td&gt;24.5&lt;/td&gt;
&lt;td&gt;About 4.9 million&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pages&lt;/td&gt;
&lt;td&gt;One&lt;/td&gt;
&lt;td&gt;At least 38,147 of up to 1 MiB: about 13 minutes at 20 ms a page&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The Scan spends roughly 199,000 times the read capacity to return the same 200 items. A filter is applied after items are read, so it shrinks what comes back without shrinking the capacity spent evaluating them. That capacity also competes with your operational reads, and a throttled read can stall a flow that has nothing to do with the report.&lt;/p&gt;

&lt;h2&gt;
  
  
  Design the key for the question
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;The question&lt;/th&gt;
&lt;th&gt;Key design&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Has this idempotency key been used?&lt;/td&gt;
&lt;td&gt;Partition key = the key itself, claimed atomically with a conditional write&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;All orders for a customer, newest first&lt;/td&gt;
&lt;td&gt;PK = &lt;code&gt;CUSTOMER#4471&lt;/code&gt;, SK = &lt;code&gt;ORDER#2026-09-09#8871&lt;/code&gt;, queried in descending order&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Orders in a date range, across all customers&lt;/td&gt;
&lt;td&gt;A global secondary index keyed on a coarse bucket, such as the month&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Failed orders above a value&lt;/td&gt;
&lt;td&gt;An index with status as the partition key and the value as a numeric sort key&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Every one of these has a cost. A heavily used customer becomes a hot key. Month buckets make the current month a hot partition, while day buckets need 30 queries to cover a month. Each index adds write and storage cost, and its results are eventually consistent.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Engineering Insight&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Choose DynamoDB when the access patterns are known, stable and key-based: sessions, idempotency keys, event stores, user profiles by id. Choose a relational database when someone will eventually ask a question you did not anticipate, which describes most product data. "We might need to scale" is not a reason. "Every read is by this key, forever" is.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A nightly Scan-and-filter report can still be acceptable if its load is bounded and the table has read headroom to spare. Measure consumed read capacity and read throttling before deciding, or move the reporting to an export or a suitable index.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://engineertoai.com/articles/dynamodb-filtered-scan?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost" rel="noopener noreferrer"&gt;engineertoai.com&lt;/a&gt;. The full lesson is free, with no sign-up: &lt;a href="https://engineertoai.com/courses/aws-data-messaging-and-cost.html?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost#dynamo-model" rel="noopener noreferrer"&gt;Design DynamoDB Around Access Patterns&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>dynamodb</category>
      <category>database</category>
      <category>nosql</category>
    </item>
    <item>
      <title>A good hash can't fix a hot tenant</title>
      <dc:creator>Ajitkumar Singh</dc:creator>
      <pubDate>Tue, 10 Nov 2026 13:00:00 +0000</pubDate>
      <link>https://dev.to/ajitkumar_singh_7a94b3eaa/a-good-hash-cant-fix-a-hot-tenant-4jmd</link>
      <guid>https://dev.to/ajitkumar_singh_7a94b3eaa/a-good-hash-cant-fix-a-hot-tenant-4jmd</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmr86i0vuboyml4dliosw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmr86i0vuboyml4dliosw.png" alt="Bar chart of write share across 8 shards partitioned by a hash of the tenant ID: shard 2 carries 49% of all writes, 3.9 times the average, against an even share of 12.5%; the other shards carry between 2% and 11.6%. One large merchant is 40% of all writes, so 8 machines deliver roughly the throughput of 2." width="800" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You avoided the monotonic key. You hashed &lt;code&gt;tenant_id&lt;/code&gt;, as the documentation recommends for a multi-tenant system, and that choice is right about a lot: every tenant's rows live together, so a per-tenant query hits exactly one shard, and tenants spread evenly across the cluster.&lt;/p&gt;

&lt;p&gt;Then the marketplace signs one large merchant, and that merchant is 40% of all writes.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the shards see
&lt;/h2&gt;

&lt;p&gt;The course's lab runs 100,000 writes from 149 tenants across 8 shards partitioned by &lt;code&gt;hash(tenant_id)&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Shard&lt;/th&gt;
&lt;th&gt;0&lt;/th&gt;
&lt;th&gt;1&lt;/th&gt;
&lt;th&gt;2&lt;/th&gt;
&lt;th&gt;3&lt;/th&gt;
&lt;th&gt;4&lt;/th&gt;
&lt;th&gt;5&lt;/th&gt;
&lt;th&gt;6&lt;/th&gt;
&lt;th&gt;7&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Share of writes&lt;/td&gt;
&lt;td&gt;2.0%&lt;/td&gt;
&lt;td&gt;11.2%&lt;/td&gt;
&lt;td&gt;49.0%&lt;/td&gt;
&lt;td&gt;7.2%&lt;/td&gt;
&lt;td&gt;7.6%&lt;/td&gt;
&lt;td&gt;7.4%&lt;/td&gt;
&lt;td&gt;11.6%&lt;/td&gt;
&lt;td&gt;4.0%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Load vs. average&lt;/td&gt;
&lt;td&gt;0.16√ó&lt;/td&gt;
&lt;td&gt;0.90√ó&lt;/td&gt;
&lt;td&gt;3.92√ó&lt;/td&gt;
&lt;td&gt;0.58√ó&lt;/td&gt;
&lt;td&gt;0.61√ó&lt;/td&gt;
&lt;td&gt;0.59√ó&lt;/td&gt;
&lt;td&gt;0.93√ó&lt;/td&gt;
&lt;td&gt;0.32√ó&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Shard 2 carries almost four times the average load while shard 0 sits nearly idle. Capacity is set by the hottest shard, so eight machines deliver roughly the throughput of two.&lt;/p&gt;

&lt;p&gt;Hashing distributes keys uniformly. It cannot distribute load uniformly, because load per key is not uniform. The skew is in the traffic, and no better hash function will remove it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three repairs, not interchangeable
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Salting&lt;/strong&gt; writes the large tenant's rows under &lt;code&gt;tenant#0&lt;/code&gt; to &lt;code&gt;tenant#15&lt;/code&gt;, chosen at random for each write. Sixteen keys spread the load over up to sixteen shards, which here means all eight. The cost lands on reads: every read of that tenant becomes sixteen reads.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A composite key&lt;/strong&gt; spreads on something the query already knows. Partitioning the large tenant by &lt;code&gt;tenant_id#order_seq&lt;/code&gt; evens the load out to 1.01√ó in the lab, and every query for that tenant now fans out to all eight shards. It is the better choice when queries can supply the extra part of the key.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An explicit placement override&lt;/strong&gt; gives the large tenant its own shard and leaves the other 148 alone. That shard still carries 40% of all writes by itself, so it needs a bigger machine or a further split. It is the only repair that needs no change to code on the read path.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Think Like an Engineer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The large tenant is salted across sixteen keys, and a report needs that tenant's orders for one day. How many shards does it ask, and what sets its latency? All eight, and the client merges the results, so the report is as slow as the slowest shard's reply. Salting bought an even write load with read fan-out.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You have probably met this problem under other names: "one customer's reports time out and nobody else's do", or "we had to give the enterprise account its own instance". The second one is a hot partition solved by hand.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://engineertoai.com/articles/hot-tenant-partition?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost" rel="noopener noreferrer"&gt;engineertoai.com&lt;/a&gt;. The full lesson is free, with no sign-up: &lt;a href="https://engineertoai.com/courses/sharding-time-and-coordination.html?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost#hot-partitions" rel="noopener noreferrer"&gt;The Tenant That Is 40% of Your Traffic&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>systemdesign</category>
      <category>database</category>
      <category>distributedsystems</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Where a slow first token comes from</title>
      <dc:creator>Ajitkumar Singh</dc:creator>
      <pubDate>Sun, 08 Nov 2026 13:00:00 +0000</pubDate>
      <link>https://dev.to/ajitkumar_singh_7a94b3eaa/where-a-slow-first-token-comes-from-40c2</link>
      <guid>https://dev.to/ajitkumar_singh_7a94b3eaa/where-a-slow-first-token-comes-from-40c2</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj5d3xyw6rsvuvp5kmra0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj5d3xyw6rsvuvp5kmra0.png" alt="The stages of one LLM request on a single request clock: gateway (auth, quota, parameters), route, queue, preparation (media fetch, tokenizer), prefill (prompt forward pass, KV cache), first decode (logits, sample one token) and transport (stream to the user). Causes of a slow first token sit beside them: a two-second queue, a slow fetch or overloaded tokenizer, a long prefill or rank synchronization, and a stream buffered at the proxy. A 10% faster matrix multiply would do nothing for five of those six causes." width="800" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A model API looks like one call. Behind it is a pipeline of stages, some deterministic and some not. A gateway authenticates the caller, enforces quotas, validates the generation parameters and chooses a route. A tokenizer turns the text into token IDs. The engine reserves memory, batches the request with compatible work, runs a forward pass over the prompt and stores the attention keys and values. Then it computes new tokens a step at a time, a sampler applies the decoding rules, a detokenizer rebuilds the text, and the transport streams events until a stop rule, a cancellation, an error or a token limit ends the request.&lt;/p&gt;

&lt;p&gt;The model server is only one failure domain in that chain.&lt;/p&gt;

&lt;h2&gt;
  
  
  One symptom, six causes
&lt;/h2&gt;

&lt;p&gt;Suppose users report a three-second first token. The same symptom can come from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a two-second queue before any kernel launches,&lt;/li&gt;
&lt;li&gt;a slow fetch of the request's media,&lt;/li&gt;
&lt;li&gt;an overloaded tokenizer, which can also block an event loop,&lt;/li&gt;
&lt;li&gt;a long prefill,&lt;/li&gt;
&lt;li&gt;synchronization between distributed ranks,&lt;/li&gt;
&lt;li&gt;a stream buffered at a proxy.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Making matrix multiplication ten percent faster would do nothing for five of them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decompose time to first token
&lt;/h2&gt;

&lt;p&gt;Give each boundary its own timestamp, all on one monotonic request clock, and split the time to first token into its parts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TTFT = gateway + route + queue + preparation + prefill + first decode + transport
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The parts should add up closely to what the user saw. When they do not, there is a boundary you have not instrumented yet. Making that possible means production traces carry identifiers for the request, the route, the model artifact, the engine configuration, the queue, prefill, decode, tokens, cancellation and the response.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Engineering Insight&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Record why each request ended as carefully as when: natural stop, length limit, policy block, client cancellation, deadline, worker failure or upstream disconnect. That is what separates a model that habitually runs out of output budget from a network that abandons healthy work, and it exposes the disconnected client whose expensive decode kept running after nobody was listening.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Senior performance work begins with this discipline: find where the time and the state are before changing capacity or code.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://engineertoai.com/articles/slow-first-token?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost" rel="noopener noreferrer"&gt;engineertoai.com&lt;/a&gt;. The full lesson is free, with no sign-up: &lt;a href="https://engineertoai.com/courses/llm-inference-gpu-serving-and-performance-engineering.html?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost#request-lifecycle" rel="noopener noreferrer"&gt;Follow One Request from Text to Stream&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>llm</category>
      <category>performance</category>
      <category>ai</category>
      <category>mlops</category>
    </item>
    <item>
      <title>A voice agent is a stack, not a model</title>
      <dc:creator>Ajitkumar Singh</dc:creator>
      <pubDate>Fri, 06 Nov 2026 13:00:00 +0000</pubDate>
      <link>https://dev.to/ajitkumar_singh_7a94b3eaa/a-voice-agent-is-a-stack-not-a-model-19bl</link>
      <guid>https://dev.to/ajitkumar_singh_7a94b3eaa/a-voice-agent-is-a-stack-not-a-model-19bl</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F82ajty0pyumi085fcrvv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F82ajty0pyumi085fcrvv.png" alt="Voice agent stack: phone or app, media edge (WebRTC, SIP, codecs, jitter), speech layer (voice activity, ASR, TTS, speech-to-speech) and orchestrator (turns, state, prompts, policy), which calls tools and RAG or hands off to a human agent. Around every turn: identity, consent, authorization, session state, tracing, evaluation and retention. Design rule: a reconnect must never repeat a payment." width="800" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The first voice demo most teams build is three calls in a row: speech-to-text, a language model, text-to-speech. It works on a laptop. A production voice agent answering real calls is a stack, and the model is one dependency inside it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The layers a call passes through
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The client or phone&lt;/strong&gt; captures audio and plays the reply, sometimes with its own processing such as echo cancellation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A media edge&lt;/strong&gt; terminates WebRTC or telephony (SIP), handles codecs, jitter and session signaling, and forwards normalized audio frames.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The speech layer&lt;/strong&gt; detects when someone is speaking, recognizes words, synthesizes the reply, or does both through a speech-to-speech model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The orchestrator&lt;/strong&gt; owns the conversation: it keeps state, applies prompts and policies, retrieves knowledge, runs tools, and decides when to hand off.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A human agent&lt;/strong&gt; receives a bounded summary and verified business context when the call transfers, not an unreviewed transcript of everything the model considered.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Around all of it sit identity, consent, authorization, policy and audit. Observability has to join the media sequence, transcript revisions, model events, tool calls, generated audio and the reason each session ended, or nobody can explain a bad call afterwards.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep media apart from business actions
&lt;/h2&gt;

&lt;p&gt;This is the rule that separates a voice product from a voice demo. Audio is fragile and gets retried; business actions must happen once. So the two are controlled separately:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A dropped connection can reconnect the audio without repeating a payment the agent already made.&lt;/li&gt;
&lt;li&gt;A slow or failed tool call must not corrupt the media session.&lt;/li&gt;
&lt;li&gt;When a caller interrupts, the agent cancels the audio it was generating and the model work in progress, and keeps the actions it has already committed.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Think Like an Engineer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A caller says "yes, pay it", the payment tool succeeds, and the caller interrupts while the agent is still saying "Your payment of‚Ä¶". What gets cancelled? The rest of that sentence and any model work queued behind it. What survives? The payment, and the record that it happened, so the next thing the agent says is consistent with it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Give every event a name
&lt;/h2&gt;

&lt;p&gt;Interruptions and reconnects produce stale events: audio from a response the caller already talked over, a tool result arriving after the turn moved on. Explicit identifiers for the session, the turn, the response, each generated piece of audio, each tool call and each handoff let the orchestrator recognize events that belong to the past and drop them. Without those identifiers, a late event can quietly overwrite the present.&lt;/p&gt;

&lt;p&gt;The session store keeps only the state that must survive; high-rate media buffers stay ephemeral.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://engineertoai.com/articles/voice-agent-stack?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost" rel="noopener noreferrer"&gt;engineertoai.com&lt;/a&gt;. The full lesson is free, with no sign-up: &lt;a href="https://engineertoai.com/courses/realtime-voice-ai-and-conversational-agent-engineering.html?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost#voice-stack" rel="noopener noreferrer"&gt;See the Complete Voice System Stack&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>voice</category>
      <category>webrtc</category>
      <category>architecture</category>
    </item>
    <item>
      <title>One metric label can cost 648 GB of memory</title>
      <dc:creator>Ajitkumar Singh</dc:creator>
      <pubDate>Wed, 04 Nov 2026 13:00:00 +0000</pubDate>
      <link>https://dev.to/ajitkumar_singh_7a94b3eaa/one-metric-label-can-cost-648-gb-of-memory-3g56</link>
      <guid>https://dev.to/ajitkumar_singh_7a94b3eaa/one-metric-label-can-cost-648-gb-of-memory-3g56</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsjgukeoo12e79iizqcnb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsjgukeoo12e79iizqcnb.png" alt="Bar chart on a log scale for a request counter on the order service. Service, endpoint, status and region labels give 1,080 series and 3.2 MB of Prometheus memory. As an 8-bucket histogram: 10,800 series and 32 MB. With user_id added for 200,000 users: 216,000,000 series and 648 GB. As a log field or span attribute, user_id is free because it is indexed per event; as a metric label it is a series for every user, in every combination. A raw URL is the same mistake: label /orders/:id, not /orders/8871." width="800" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Metrics, logs and traces are usually presented as three products to buy. They are more usefully three shapes of data, and the shape decides where a given piece of information belongs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Metrics&lt;/strong&gt; are numbers aggregated over time, indexed by a small set of label combinations. They are cheap and compress well, and their cost is a product of label cardinality. They answer "how much, how many, how fast" for the whole system, and nothing about one particular request.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Logs&lt;/strong&gt; are discrete events with arbitrary fields, indexed per event. They are expensive per unit of information, but they can carry anything, including high-cardinality identifiers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Traces&lt;/strong&gt; are causally linked spans across services, indexed by a trace id. They are the only signal that shows a request's path through a distributed system, and the only one that can attribute latency to a hop.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Cardinality, multiplied out
&lt;/h2&gt;

&lt;p&gt;Take a request counter on the order service with four sensible labels: 6 services, 12 endpoints, 5 status codes and 3 regions. At about 3 KB of Prometheus memory per active series:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Labels&lt;/th&gt;
&lt;th&gt;Series&lt;/th&gt;
&lt;th&gt;Memory&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;service × endpoint × status × region&lt;/td&gt;
&lt;td&gt;1,080&lt;/td&gt;
&lt;td&gt;3.2 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The same counter as a histogram with 8 buckets, plus sum and count&lt;/td&gt;
&lt;td&gt;10,800&lt;/td&gt;
&lt;td&gt;32 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The counter with user_id added, for 200,000 users&lt;/td&gt;
&lt;td&gt;216,000,000&lt;/td&gt;
&lt;td&gt;648 GB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The last row is not an exaggeration. It is one label, added by someone who wanted to know which customers were affected, which is an entirely reasonable thing to want. The same field in a log line or a span attribute costs nothing structural, because those are indexed per event rather than per label combination. The question was fine; the shape was wrong.&lt;/p&gt;

&lt;p&gt;The middle row catches people who already know that rule. A histogram multiplies the series count by its number of buckets plus two, so the eight-bucket latency histogram an SLO needs carries ten times the cardinality of the counter beside it. That is still cheap at 10,800, but the multipliers compound: put user_id on the histogram instead of the counter and the last row becomes 2.16 billion series.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which shape answers which question
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;You want to know&lt;/th&gt;
&lt;th&gt;Shape&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;How many orders failed in the last hour&lt;/td&gt;
&lt;td&gt;Metric&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Which customer's orders failed&lt;/td&gt;
&lt;td&gt;Log field or span attribute&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Why this one order took 2 seconds&lt;/td&gt;
&lt;td&gt;Trace&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Common Mistake&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Keeping user_id out of the labels but adding the full URL, query string and all. A raw path with ids and parameters in it is just as unbounded: &lt;code&gt;/orders/8871?ref=email&lt;/code&gt; becomes its own series for good. Normalise to the route template, &lt;code&gt;/orders/:id&lt;/code&gt;, in the instrumentation layer rather than trusting every caller to be tidy. The tell is a series count that keeps growing with traffic instead of levelling off.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://engineertoai.com/articles/metric-label-cardinality?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost" rel="noopener noreferrer"&gt;engineertoai.com&lt;/a&gt;. The full lesson is free, with no sign-up: &lt;a href="https://engineertoai.com/courses/observability-and-production-engineering.html?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost#three-signals" rel="noopener noreferrer"&gt;Three Shapes, Not Three Tools&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>observability</category>
      <category>prometheus</category>
      <category>monitoring</category>
      <category>sre</category>
    </item>
    <item>
      <title>Your primary key is a storage decision</title>
      <dc:creator>Ajitkumar Singh</dc:creator>
      <pubDate>Tue, 03 Nov 2026 13:00:00 +0000</pubDate>
      <link>https://dev.to/ajitkumar_singh_7a94b3eaa/your-primary-key-is-a-storage-decision-45nk</link>
      <guid>https://dev.to/ajitkumar_singh_7a94b3eaa/your-primary-key-is-a-storage-decision-45nk</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F82joydd7wr22pyafmpnm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F82joydd7wr22pyafmpnm.png" alt="Bar chart of bytes written to disk per byte stored for 5 million 120-byte rows: B-tree with sequential keys 2.0√ó (1.1 GiB), LSM tree size-tiered 7.0√ó (3.9 GiB), LSM tree leveled 42.0√ó (23.5 GiB), B-tree with random UUIDv4 keys 69.3√ó (38.7 GiB). A random key turns each row into a full 8 KiB page write." width="800" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Store five million rows of 120 bytes each. That is 572 MiB of data. How much does the database write to disk to store it? Anywhere from about twice that to about seventy times that, depending on two choices most teams make for other reasons.&lt;/p&gt;

&lt;p&gt;The figures below come from the course's lab, a model with 8 KiB pages and five compaction levels rather than a benchmark of one particular database. The model is simple enough to reason about, which is the point.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layout&lt;/th&gt;
&lt;th&gt;Bytes written&lt;/th&gt;
&lt;th&gt;Amplification&lt;/th&gt;
&lt;th&gt;Where the writes go&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;B-tree, sequential keys&lt;/td&gt;
&lt;td&gt;1,147 MiB&lt;/td&gt;
&lt;td&gt;2.0√ó&lt;/td&gt;
&lt;td&gt;the write-ahead log, plus packed pages of 68 rows each&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LSM tree, size-tiered compaction&lt;/td&gt;
&lt;td&gt;4,005 MiB&lt;/td&gt;
&lt;td&gt;7.0√ó&lt;/td&gt;
&lt;td&gt;the log, the first flush, and five tier merges&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LSM tree, leveled compaction&lt;/td&gt;
&lt;td&gt;24,033 MiB&lt;/td&gt;
&lt;td&gt;42.0√ó&lt;/td&gt;
&lt;td&gt;the log, the flush, and about ten rewrites at each of four levels&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;B-tree, random keys&lt;/td&gt;
&lt;td&gt;39,635 MiB&lt;/td&gt;
&lt;td&gt;69.3√ó&lt;/td&gt;
&lt;td&gt;the log, plus 39,062 MiB of dirty pages&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Why key order matters to a B-tree
&lt;/h2&gt;

&lt;p&gt;With sequential keys, each insert lands on the last leaf page. The page fills up with 68 rows and is written once, full. With random keys, such as UUIDv4, consecutive inserts land on unrelated pages all over the tree, so storing one 120-byte row can mean writing a whole 8 KiB page. Same rows, same disk: about 35 times more writing, purely from the order in which keys arrive.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why compaction matters to an LSM tree
&lt;/h2&gt;

&lt;p&gt;An LSM tree writes sequentially and merges files in the background. How it merges sets the cost. Leveled compaction rewrites each byte roughly ten times at every level below the first, and in return a read touches about one file per level. Size-tiered compaction rewrites each byte about once per tier, and a read may check several same-size files per tier. Bloom filters let reads skip most of those files either way.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Common Mistake&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Choosing UUIDv4 primary keys for a naming reason (globally unique, no coordination needed) without noticing it is also a storage decision. On a B-tree-backed table with heavy inserts, it can be the most expensive storage decision in the schema.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The fix comes with its own trade
&lt;/h2&gt;

&lt;p&gt;Time-sortable identifiers such as UUIDv7, ULID and Snowflake IDs exist because random IDs destroy write locality. They restore it, and in doing so bring back the write hotspot: every insert now targets the newest page, or the newest partition once the table is sharded. That is a different problem, with different fixes. Which one you would rather have depends on the workload, and it is better chosen on purpose than inherited from a default.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://engineertoai.com/articles/primary-key-write-amplification?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost" rel="noopener noreferrer"&gt;engineertoai.com&lt;/a&gt;. The full lesson is free, with no sign-up: &lt;a href="https://engineertoai.com/courses/databases-at-scale.html?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost#write-amplification" rel="noopener noreferrer"&gt;What It Actually Costs to Store a Byte&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>database</category>
      <category>postgres</category>
      <category>systemdesign</category>
      <category>performance</category>
    </item>
    <item>
      <title>Security, safety, robustness and privacy are four different problems</title>
      <dc:creator>Ajitkumar Singh</dc:creator>
      <pubDate>Sun, 01 Nov 2026 13:00:00 +0000</pubDate>
      <link>https://dev.to/ajitkumar_singh_7a94b3eaa/security-safety-robustness-and-privacy-are-four-different-problems-11cf</link>
      <guid>https://dev.to/ajitkumar_singh_7a94b3eaa/security-safety-robustness-and-privacy-are-four-different-problems-11cf</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foqddrtvgafzfon6www27.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foqddrtvgafzfon6www27.png" alt="Four cards. Security asks whether an untrusted document can trigger an unauthorized tool action, with attack tests and tool traces as evidence. Safety asks whether an allowed answer can cause unacceptable harm: hazard analysis and scenario tests. Robustness asks whether quality holds under blur, accents, long context or missing data: slice metrics and perturbation tests. Privacy asks whether training or inference can expose a person's data: data inventory and access logs. One event can cross all four, and no single guardrail proves them all." width="800" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Teams often file every AI risk under one word, usually "security" or "safety", and then argue about whether a guardrail has dealt with it. The four concerns are related, but they ask different questions, need different evidence, and usually belong to different people.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Security&lt;/strong&gt; asks whether an actor can violate confidentiality, integrity, availability or authorized control.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Safety&lt;/strong&gt; asks whether operating the system can cause unacceptable harm, including harm with no attacker involved.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Robustness&lt;/strong&gt; asks whether behavior stays acceptable under noise, distribution shift, ambiguity or stress.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Privacy&lt;/strong&gt; asks whether personal or sensitive information is collected, inferred, used, retained or disclosed appropriately.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  One summarizer, three different failures
&lt;/h2&gt;

&lt;p&gt;Take a model that summarizes clinical documents.&lt;/p&gt;

&lt;p&gt;A malicious document instructs it to reveal another patient's record. That is a security attack, with privacy impact. A faithful summary leaves out a critical allergy because the scan was poor. That is a robustness failure, with safety impact. And a correct diagnosis, inferred where nobody authorized the inference, can be a privacy and governance failure with no attacker anywhere.&lt;/p&gt;

&lt;p&gt;No single guardrail can prove all three cases are controlled. Treating the four words as synonyms produces controls too vague to test.&lt;/p&gt;

&lt;h2&gt;
  
  
  Different questions need different evidence
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;th&gt;Discipline&lt;/th&gt;
&lt;th&gt;Representative evidence&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Can an untrusted document cause an unauthorized tool action?&lt;/td&gt;
&lt;td&gt;Security&lt;/td&gt;
&lt;td&gt;Taint-aware attack tests, policy decisions, egress and tool traces&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Can an allowed answer create unacceptable physical or social harm?&lt;/td&gt;
&lt;td&gt;Safety&lt;/td&gt;
&lt;td&gt;Hazard analysis, scenario tests, review and escalation outcomes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Does quality hold under blur, accent, long context or missing data?&lt;/td&gt;
&lt;td&gt;Robustness&lt;/td&gt;
&lt;td&gt;Slice metrics, perturbation tests, calibrated abstention&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Can training or inference expose a person's data?&lt;/td&gt;
&lt;td&gt;Privacy&lt;/td&gt;
&lt;td&gt;Data inventory, minimization, access logs, deletion and privacy attack tests&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Engineering Insight&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Record the overlap, but keep accountability separate. Security may own exploitability and access controls, product safety the hazardous outcomes, privacy the lawful processing and minimization, and ML engineering the robustness. A shared risk register shows where they intersect; each claim in it still needs an owner, a test, a threshold and a response.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;An architecture review that lists one "AI risk" control and calls the job done has usually tested one of these four. Asking which discipline a control serves, and what evidence would show it failing, is the quickest way to find the other three.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://engineertoai.com/articles/security-safety-robustness-privacy?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost" rel="noopener noreferrer"&gt;engineertoai.com&lt;/a&gt;. The full lesson is free, with no sign-up: &lt;a href="https://engineertoai.com/courses/ai-security-and-red-teaming-for-production-systems.html?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost#security-safety" rel="noopener noreferrer"&gt;Separate Security, Safety, Robustness, and Privacy&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>llm</category>
      <category>privacy</category>
    </item>
    <item>
      <title>Five ways to code with AI, five different risks</title>
      <dc:creator>Ajitkumar Singh</dc:creator>
      <pubDate>Fri, 30 Oct 2026 13:00:00 +0000</pubDate>
      <link>https://dev.to/ajitkumar_singh_7a94b3eaa/five-ways-to-code-with-ai-five-different-risks-4hi6</link>
      <guid>https://dev.to/ajitkumar_singh_7a94b3eaa/five-ways-to-code-with-ai-five-different-risks-4hi6</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6draw6bc7nchxqf87zw5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6draw6bc7nchxqf87zw5.png" alt="Table of five AI coding modes. Completion: text suggestion only, risk of a plausible local error. Chat assistant: usually read-only, risk of missing repo context. Interactive agent: files and chosen commands, risk of a wrong multi-file edit. Async agent: throwaway environment and branch, risk of unsupervised drift. Agentic workflow: policy-run automation, risk of a bad rule at scale." width="800" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;"We use AI for coding" covers at least five different arrangements, and they fail in different ways. Before picking one, it helps to be precise about what a coding agent is.&lt;/p&gt;

&lt;p&gt;A coding agent is a software system that uses a generative model to choose and sequence repository tools toward an engineering goal, while an external runtime controls what it can see, change, run and report. The model proposes. The harness supplies files, search, shell commands and patches. Policies decide whether an action is allowed. Tests and reviewers decide whether the result is acceptable.&lt;/p&gt;

&lt;h2&gt;
  
  
  The five modes
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Mode&lt;/th&gt;
&lt;th&gt;Unit of work&lt;/th&gt;
&lt;th&gt;Typical authority&lt;/th&gt;
&lt;th&gt;Main risk&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Completion&lt;/td&gt;
&lt;td&gt;the next tokens or line&lt;/td&gt;
&lt;td&gt;a text suggestion only&lt;/td&gt;
&lt;td&gt;a plausible local error&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Chat assistant&lt;/td&gt;
&lt;td&gt;an explanation or snippet&lt;/td&gt;
&lt;td&gt;usually read-only&lt;/td&gt;
&lt;td&gt;missing repository context&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Interactive coding agent&lt;/td&gt;
&lt;td&gt;a bounded repository change&lt;/td&gt;
&lt;td&gt;files and selected commands&lt;/td&gt;
&lt;td&gt;an incorrect multi-file change&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Asynchronous coding agent&lt;/td&gt;
&lt;td&gt;an issue, pull request or maintenance job&lt;/td&gt;
&lt;td&gt;a disposable environment and branch&lt;/td&gt;
&lt;td&gt;unsupervised drift&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Agentic workflow&lt;/td&gt;
&lt;td&gt;a repeatable delivery process&lt;/td&gt;
&lt;td&gt;policy-controlled automation&lt;/td&gt;
&lt;td&gt;a bad rule applied at scale&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Not a maturity ladder
&lt;/h2&gt;

&lt;p&gt;It is tempting to read the table top to bottom as a path from beginner to expert. It is not. A low-risk refactor across fifty files may suit an asynchronous agent that opens a pull request overnight. A production incident may call for an interactive agent with a senior engineer watching every step. The right mode follows from how reversible the change is, how uncertain the task is, and what a mistake would cost.&lt;/p&gt;

&lt;h2&gt;
  
  
  One session, several systems
&lt;/h2&gt;

&lt;p&gt;Here is an interactive session from the course. A developer asks an agent to fix a duplicate payment retry. The model does not get the whole repository: the harness first gives it the project instructions and search tools. It searches for the timeout error, reads the retry policy and its integration test, and proposes a plan touching three files. Policy allows edits in the workspace and local tests, and denies network and secret access. The model patches the retry key, runs a focused test, hits a contract failure, inspects the checkout response type, revises the patch, and runs the wider payment suite. A human reviews the diff, and CI reruns every required check independently.&lt;/p&gt;

&lt;p&gt;Count the systems in that story: a model that proposes, a harness that executes, a sandbox that limits reach, a repository that holds local truth, a CI system that produces independent evidence, and a reviewer who grants authority.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Engineering Insight&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Calling all of that "the AI" hides the boundaries engineers have to design. Most incidents with coding agents happen at one of those boundaries: a permission set too wide, a test that was not run, a review that was skipped.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://engineertoai.com/articles/five-ways-to-code-with-ai?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost" rel="noopener noreferrer"&gt;engineertoai.com&lt;/a&gt;. The full lesson is free, with no sign-up: &lt;a href="https://engineertoai.com/courses/ai-coding-agents-for-professional-engineers.html?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost#coding-agent" rel="noopener noreferrer"&gt;What a Coding Agent Actually Is&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>What multi-AZ buys, and what it doesn't</title>
      <dc:creator>Ajitkumar Singh</dc:creator>
      <pubDate>Wed, 28 Oct 2026 13:00:00 +0000</pubDate>
      <link>https://dev.to/ajitkumar_singh_7a94b3eaa/what-multi-az-buys-and-what-it-doesnt-3o7l</link>
      <guid>https://dev.to/ajitkumar_singh_7a94b3eaa/what-multi-az-buys-and-what-it-doesnt-3o7l</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8yfdnua7nxvmhfqqzzxs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8yfdnua7nxvmhfqqzzxs.png" alt="A table of failures against what survives them. Power, cooling or fibre loss and a rack or host failure: multi-AZ yes, multi-region yes. A regional control-plane incident: multi-AZ no, multi-region yes if the standby needs no API calls in the failed region. A bad deployment, an expired certificate and a corrupt schema migration: no in both columns. An exhausted account quota: multi-AZ no, multi-region partly. Below: three zones survive losing one only if two can carry peak load, so run at or below 66% utilisation." width="800" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;"Region" and "availability zone" sound like marketing. They are really definitions of failure domains, and knowing exactly which failures each one contains is most of designing for them.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;region&lt;/strong&gt; is a geographic area with its own control plane, such as ap-south-1 in Mumbai or eu-west-1 in Ireland. Regions are almost completely independent: separate APIs, separate service endpoints, separate failure domains, and no data moves between them unless you move it.&lt;/p&gt;

&lt;p&gt;An &lt;strong&gt;availability zone&lt;/strong&gt; is one or more data centres inside a region, with independent power, cooling and networking, linked to the other zones by low-latency connections of typically single-digit milliseconds. Zones fail independently, for physical reasons: a power event, a cooling failure, a fibre cut.&lt;/p&gt;

&lt;h2&gt;
  
  
  What each boundary covers
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Failure&lt;/th&gt;
&lt;th&gt;Multi-AZ survives it&lt;/th&gt;
&lt;th&gt;Multi-region survives it&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Power, cooling or fibre loss in one data centre&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A rack or host failure&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A regional control-plane incident&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes, if the standby needs no API calls in the failed region&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A bad deployment&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No, and active-active makes it worse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;An expired certificate&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A corrupt schema migration&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No: replication faithfully copies the corruption&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;An exhausted account quota&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Partly, because quotas are per region&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Three rows say no in both columns, and the quota row is covered only in part. A deployment pipeline crosses every zone and region without noticing them, the same certificate sits in every zone, and a corrupt migration replicates. Changes like these cause a large share of outages. Multi-AZ protects against infrastructure failure, multi-region against regional failure, and neither protects against you. A team asking for a third zone when its last four incidents were deploys is optimising the column that was already covered.&lt;/p&gt;

&lt;h2&gt;
  
  
  The two boundaries cost different things
&lt;/h2&gt;

&lt;p&gt;Crossing a zone costs one to two milliseconds and a per-gigabyte charge on the traffic, which is small enough that spreading across zones should be the default for everything. Crossing a region costs tens to over a hundred milliseconds; Mumbai to Ireland is roughly 120 ms round trip. That is an architectural constraint rather than a line item. A synchronous cross-region call inside a request path spends more time on the wire than most services spend on their entire response, and no amount of tuning wins it back.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Common Mistake&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Calling a service multi-AZ because it runs in three zones. Lose one zone and capacity drops by a third; if the other two saturate, the service failed along with the zone. Surviving the loss of a third means serving peak load on the remaining two thirds, which means running at or below 66% utilisation at peak. A zone-removal drill tells you which kind of deployment you actually have.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://engineertoai.com/articles/what-multi-az-buys?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost" rel="noopener noreferrer"&gt;engineertoai.com&lt;/a&gt;. The full lesson is free, with no sign-up: &lt;a href="https://engineertoai.com/courses/aws-architecture-for-backend-engineers.html?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost#region-az" rel="noopener noreferrer"&gt;Regions, Zones, and What Multi-AZ Actually Buys&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>sre</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Same average, very different users</title>
      <dc:creator>Ajitkumar Singh</dc:creator>
      <pubDate>Tue, 27 Oct 2026 13:00:00 +0000</pubDate>
      <link>https://dev.to/ajitkumar_singh_7a94b3eaa/same-average-very-different-users-37n7</link>
      <guid>https://dev.to/ajitkumar_singh_7a94b3eaa/same-average-very-different-users-37n7</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fv9jaghdjwatz0dc81hdy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fv9jaghdjwatz0dc81hdy.png" alt="Two latency panels with the same 153 ms mean. Service A: p50 153 ms, p99 161 ms, no requests over 1 second. Service B: p50 14 ms, p99 1,416 ms, 1,000 of 10,000 requests over 1 second." width="800" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Two services each handle 10,000 requests. A latency dashboard that shows the mean reports the same number for both: 153.0 ms, identical to one decimal place. They are not the same service.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Mean&lt;/th&gt;
&lt;th&gt;p50&lt;/th&gt;
&lt;th&gt;p90&lt;/th&gt;
&lt;th&gt;p99&lt;/th&gt;
&lt;th&gt;Max&lt;/th&gt;
&lt;th&gt;Requests over 1 s&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Service A, uniformly a little slow&lt;/td&gt;
&lt;td&gt;153.0 ms&lt;/td&gt;
&lt;td&gt;153.0 ms&lt;/td&gt;
&lt;td&gt;160.0 ms&lt;/td&gt;
&lt;td&gt;161.0 ms&lt;/td&gt;
&lt;td&gt;161.0 ms&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Service B, fast with a 10% tail&lt;/td&gt;
&lt;td&gt;153.0 ms&lt;/td&gt;
&lt;td&gt;14.0 ms&lt;/td&gt;
&lt;td&gt;17.0 ms&lt;/td&gt;
&lt;td&gt;1,416.0 ms&lt;/td&gt;
&lt;td&gt;1,419.0 ms&lt;/td&gt;
&lt;td&gt;1,000&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;In service A, nobody waits more than 161 ms. In service B, a thousand people wait almost a second and a half.&lt;/p&gt;

&lt;h2&gt;
  
  
  The mean is doing exactly its job
&lt;/h2&gt;

&lt;p&gt;A mean measures central tendency. It is deliberately insensitive to outliers, and in latency the outliers are the incident. Asking the mean to show a slow tail is asking it to do the one thing it was designed not to do.&lt;/p&gt;

&lt;p&gt;Two things make it worse in practice. First, the mean has no unit of experience: no user of service B ever waited 153 ms. Their requests took about 14 ms or about 1,400 ms, and the average describes a request that never happened.&lt;/p&gt;

&lt;p&gt;Second, the tail is not a small group of people. A p99 affects one request in a hundred, but a page or session that makes 100 requests is likely to hit it at least once: if each request independently has a 1% chance of landing in the tail, the chance is 1 ‚àí 0.99¬π‚Å∞‚Å∞, about 63%. Fan-out turns a rare request into a common experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to watch instead
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Percentiles per endpoint&lt;/strong&gt;: p50 for the typical request, p99 and the maximum for the people having a bad time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A count of requests over a threshold&lt;/strong&gt; you care about, such as one second. It reads like the table above, and it maps directly to an objective.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Histograms, aggregated across servers.&lt;/strong&gt; They can be merged; percentiles cannot.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Common Mistake&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Averaging each server's p99 to get a fleet-wide p99. Percentiles do not combine that way: the mean of eight servers' p99 values is not the p99 of all their requests. Merge the latency histograms first, then read the percentile from the result.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The mean still has a use: it tracks total work and capacity. It just cannot tell you who is waiting.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://engineertoai.com/articles/same-average-different-users?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost" rel="noopener noreferrer"&gt;engineertoai.com&lt;/a&gt;. The full lesson is free, with no sign-up: &lt;a href="https://engineertoai.com/courses/observability-and-production-engineering.html?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost#averages" rel="noopener noreferrer"&gt;The Average Is the Statistic Designed Not to See This&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>observability</category>
      <category>sre</category>
      <category>monitoring</category>
      <category>performance</category>
    </item>
    <item>
      <title>Read an MCP server before you trust it</title>
      <dc:creator>Ajitkumar Singh</dc:creator>
      <pubDate>Sun, 25 Oct 2026 13:00:00 +0000</pubDate>
      <link>https://dev.to/ajitkumar_singh_7a94b3eaa/read-an-mcp-server-before-you-trust-it-4fpg</link>
      <guid>https://dev.to/ajitkumar_singh_7a94b3eaa/read-an-mcp-server-before-you-trust-it-4fpg</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm4lmoxm5wh0oizltjh68.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm4lmoxm5wh0oizltjh68.png" alt="Four steps for a new MCP server. 1, pin a version: tool descriptions are instructions a model reads, and an unpinned install fetches whatever was published last. 2, list what it offers with the Inspector's tools/list before any model can; the reference server exposes fourteen tools. 3, read the hints and doubt them: get-env is marked readOnlyHint true and returned DEMO_API_KEY; gzip-file-as-resource is marked openWorldHint true and fetches any URL from your machine, even 169.254.169.254. 4, allow only what you decided: a denied tool is removed from the model's context, and an allow list is safer because tools a later version adds stay off. Read-only describes side effects, not confidentiality." width="800" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The quickest way to learn what an MCP server owes its users is to be one first. The reference server that the MCP maintainers publish to exercise every protocol feature is a good place to start: it is safe to run, and it shows exactly why you read a server before you trust it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pin the version
&lt;/h2&gt;

&lt;p&gt;An MCP server's tool descriptions are instructions that a model reads. Start a server with &lt;code&gt;npx some-server&lt;/code&gt; and no version, and every start fetches whatever was published last, so a later release can change what those instructions say without you noticing. Pin an exact version, and a change reaches you only when you choose to upgrade and read what changed.&lt;/p&gt;

&lt;h2&gt;
  
  
  List what it offers
&lt;/h2&gt;

&lt;p&gt;The MCP Inspector, the protocol's own debugging client, has a command-line mode that connects, sends one request and prints the answer. Asked for &lt;code&gt;tools/list&lt;/code&gt;, the reference server returns fourteen tools, each with a description, an input schema and four annotations: &lt;code&gt;readOnlyHint&lt;/code&gt;, &lt;code&gt;destructiveHint&lt;/code&gt;, &lt;code&gt;idempotentHint&lt;/code&gt; and &lt;code&gt;openWorldHint&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Two of them deserve a second look.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Annotation&lt;/th&gt;
&lt;th&gt;What it actually does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;get-env&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;readOnlyHint: true&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Returns every environment variable, including the &lt;code&gt;DEMO_API_KEY&lt;/code&gt; set for the test&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;gzip-file-as-resource&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;openWorldHint: true&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fetches whatever URL it is given, from the machine the server runs on&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;get-env&lt;/code&gt; really does change nothing, so its annotation is honest. Read-only describes side effects, not confidentiality. Annotations are also claims a server makes about itself, and the specification tells clients to treat them as untrusted unless the server itself is trusted.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Engineering Insight&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gzip-file-as-resource&lt;/code&gt; is not marked destructive, yet a model, or text an attacker planted somewhere the model reads, can give it any URL: a router's admin page, a service on localhost, or a cloud metadata endpoint such as &lt;code&gt;169.254.169.254&lt;/code&gt;. The response lands in the model's context. That is server-side request forgery, and &lt;code&gt;openWorldHint: true&lt;/code&gt; is the only clue in the annotations.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Allow only what you decided
&lt;/h2&gt;

&lt;p&gt;In Claude Code, add the server and then deny the tools you do not want a model to have, in the project's &lt;code&gt;.claude/settings.local.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"permissions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"deny"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"mcp__everything__get-env"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"mcp__everything__gzip-file-as-resource"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A denied MCP tool is removed from the model's context entirely, not merely refused when called. In Codex, list the only tools the server may expose with &lt;code&gt;enabled_tools&lt;/code&gt;. Of the two, the allow list is safer when a server can grow, because a tool added in a later version stays off until you choose to enable it.&lt;/p&gt;

&lt;p&gt;A stdio server runs as you, with your files, your network and your environment variables. Installing one is running a program, not adding a bookmark.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://engineertoai.com/articles/read-an-mcp-server-first?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost" rel="noopener noreferrer"&gt;engineertoai.com&lt;/a&gt;. The full lesson is free, with no sign-up: &lt;a href="https://engineertoai.com/courses/mcp-for-developers.html?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost#use-servers" rel="noopener noreferrer"&gt;Use a server before you build one&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>security</category>
      <category>agents</category>
    </item>
    <item>
      <title>Build the safety net before your coding agent's first edit</title>
      <dc:creator>Ajitkumar Singh</dc:creator>
      <pubDate>Fri, 23 Oct 2026 13:00:00 +0000</pubDate>
      <link>https://dev.to/ajitkumar_singh_7a94b3eaa/build-the-safety-net-before-your-coding-agents-first-edit-2076</link>
      <guid>https://dev.to/ajitkumar_singh_7a94b3eaa/build-the-safety-net-before-your-coding-agents-first-edit-2076</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw4cbzmdop6r4pnxcm4fc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw4cbzmdop6r4pnxcm4fc.png" alt="Four stacked safety layers around a coding agent. 1, permissions: which actions need your approval, using Claude Code permission modes or the Codex approval policy. 2, sandbox: what an approved command can reach, enforced by the operating system. 3, checkpoints: rewind the agent's own file edits with /rewind; shell commands are not tracked. 4, Git: restores anything inside the repository, but not databases, packages or sent messages." width="800" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sooner or later a coding agent will do something you did not ask for. It will edit a file you never mentioned, run a command that changes more than it should, or make a failing test pass by weakening the test. Better instructions make that rarer. They never make it impossible.&lt;/p&gt;

&lt;p&gt;What you can control is the damage: how much an unwanted action can touch, and how fast you can undo it. That is a setup task, not a prompting skill, and you do it once per project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four layers, each covering the last one's blind spot
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Permissions decide which actions need your yes.&lt;/strong&gt; Claude Code calls them permission modes and rules; Codex calls it the approval policy. In a codebase you do not know yet, choose a mode that asks before it edits, so you can see which files the agent reads and which commands it reaches for. The fully automatic modes are useful later, once you trust the project's setup.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The sandbox decides what an approved command can reach.&lt;/strong&gt; Files outside the project and the network are the usual boundaries, and the operating system enforces them. That matters because the model can be wrong about what a command does: inside Codex's &lt;code&gt;workspace-write&lt;/code&gt; sandbox, a write inside the project folder succeeds, while a write to your home folder and a request to the npm registry both fail.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Checkpoints rewind the agent's own edits.&lt;/strong&gt; Claude Code saves one with every prompt, and &lt;code&gt;/rewind&lt;/code&gt; restores the code, the conversation or both. It undoes a wrong direction in seconds, with one large exception below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Git restores anything inside the repository&lt;/strong&gt;, including what shell commands changed. It restores nothing outside it: not a database, not an installed package, not a message that was sent.&lt;/p&gt;

&lt;p&gt;No layer is enough alone. Git cannot recall a published package, and permissions cannot undo an edit you approved.&lt;/p&gt;

&lt;h2&gt;
  
  
  Git first: one branch and a clean tree per task
&lt;/h2&gt;

&lt;p&gt;Start every task from a clean working tree on its own branch. Then "what did the agent change?" always has an exact answer, and abandoning an attempt costs nothing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git status                     &lt;span class="c"&gt;# must say "nothing to commit"&lt;/span&gt;
git switch &lt;span class="nt"&gt;-c&lt;/span&gt; tb-101-overdue   &lt;span class="c"&gt;# one branch per task&lt;/span&gt;
&lt;span class="c"&gt;# ... the agent works ...&lt;/span&gt;
git diff &lt;span class="nt"&gt;--stat&lt;/span&gt;                &lt;span class="c"&gt;# which files changed, and how much&lt;/span&gt;
git diff                       &lt;span class="c"&gt;# every changed line&lt;/span&gt;
git stash &lt;span class="nt"&gt;-u&lt;/span&gt;                   &lt;span class="c"&gt;# set an attempt aside, untracked files included&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Commit whenever the tests pass, even halfway through a task. Small commits turn a bad turn into a few minutes of work instead of an afternoon, and they let you show the agent exactly which change broke something.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Common Mistake&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Trusting the working tree after a rewind. Checkpoints track only the edits Claude Code makes with its file tools. A file moved with &lt;code&gt;mv&lt;/code&gt;, deleted with &lt;code&gt;rm&lt;/code&gt;, regenerated by a script or changed by a database migration stays changed. After any rewind, run &lt;code&gt;git status&lt;/code&gt; and &lt;code&gt;git diff&lt;/code&gt; to see what is really there.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The settings to leave alone
&lt;/h2&gt;

&lt;p&gt;Both tools have a mode that removes every boundary at once. They exist for containers and virtual machines that are already isolated, not for your laptop. When a task needs one extra capability, such as network access to install a package, grant that one thing for that session, or run the install yourself and let the agent continue.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://engineertoai.com/articles/coding-agent-safety-net?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost" rel="noopener noreferrer"&gt;engineertoai.com&lt;/a&gt;. The full lesson is free, with no sign-up: &lt;a href="https://engineertoai.com/courses/codex-claude-code-and-mcp.html?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=crosspost#safety-net" rel="noopener noreferrer"&gt;Build a safety net before the first edit&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claude</category>
      <category>programming</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
