Blogs

Long-form essays on distributed systems, backend engineering, databases, and AI systems.

2026

(21)
  • LLM-as-a-Judge, Part 2: Your LLM Judge Was 94% Right in Testing. In Production, 6 in 10 Flags Are False Alarms.

    Read on LinkedIn

  • LLM-as-a-Judge, Part 1: Both Judges Agreed With Humans 92% of the Time. Only One Was Useful.

    Read on LinkedIn

  • Our LLM Judge Agreed With Humans 92% of the Time. It Still Missed 15 of 23 Bad Conversations.

    LLM-as-a-judge in production: what it can grade, what it can't, and why you still need people.

    Read on LinkedIn

  • Where the 400 Cases Come From: Building the Eval Set Behind Your Gate

    An agent passed its 400-case eval gate at 97% for 11 releases while auto-approving 37 refunds above the $200 human-approval limit — a config typo had raised it to $250, and 61 cases had been recorded from the agent's own outputs, so the boundary cases expected the bug. Expected answers must come from the policy, not the agent.

    Read on LinkedInRead on MediumRead on dev.to

  • How to Build an AI Agent Eval Set That Doesn't Share Your Bugs

    TL;DREval sets fail by being too lenient, not too small. Build cases from five labelled sources, write expected answers from policy rather than agent output, grade with rules first and a calibrated judge second, and run every case more than once.

    1. 01Build the set from five sources
    2. 02Write each case from the source of truth
    3. 03Grade with rules first, a judge second, humans to calibrate
    4. 04Keep the eval independent of the agent
    5. 05Run every case more than once
    6. 06Keep the set alive

    Read on Hashnode

  • The Second Refund: Designing Agent Tools That Are Safe to Retry

    Part 2 of Shipping AI Agents to Production. Three weeks after the first double refund, it happened again — the idempotency key was there, but it was built from the tool call ID, so a new retry meant a new key and a second refund. Same intent, same key, one refund.

    Read on LinkedInRead on MediumRead on dev.to

  • Make agent tools safe to retry: one idempotency key per business intent

    TL;DRFor a side-effecting tool, an error means "outcome unknown", not "failed". Tie the idempotency key to the business intent, not the tool call or the attempt, and wrap risky tools so they record, lock, call and verify before acting again.

    1. 01Classify every tool
    2. 02One key per business intent
    3. 03Wrap every side-effecting tool
    4. 04Tell the model what happened
    5. 05Test the failure shapes on purpose

    Read on Hashnode

  • Eval gate passed, production broke: add a smoke eval to agent deploys

    TL;DRAn eval gate checks whether the version is good; a smoke eval checks whether the environment works right now. A 20-case, 3-minute check against real dependencies stops a bad rollout at 5% traffic.

    1. 01Write the gate down before the results come in
    2. 02Take retries out of the prompt
    3. 03Write the smoke eval
    4. 04Run it after every rollout step

    Read on Hashnode

  • Shipping AI Agents to Production: Eval Gates, Smoke Evals, and What to Do on a Bad Day

    One added prompt line — 'if a tool call fails, retry once' — passed the offline eval at 96%, then refunded 212 customers twice within 38 minutes, because the mocked refund tool answered in 50 ms and the real payments API timed out. The eval gate tests the version; a smoke eval tests the environment.

    Read on LinkedInRead on MediumRead on dev.to

  • Authorise AI agent tool calls from the JWT, not the prompt

    TL;DRThe JWT was valid and the model still picked the customer ID. Freeze identity into run context so a fooled model can’t reach the wrong data.

    1. 01Verify the JWT once and freeze identity into run context
    2. 02Read the identity inside the tool, never from tool arguments
    3. 03Scope the query in the data layer and fail closed
    4. 04Treat retrieved text as data, not instructions
    5. 05Audit every tool call, then attack it

    Read on Hashnode

  • Your AI Agent Just Showed Customer A's Orders to Customer B

    A verified login doesn't stop an agent from leaking another customer's data — the leak happens after login, when a customer ID gets typed into the prompt and the model fills a tool parameter with it. A system prompt saying 'only show this customer's orders' is a request, not a permission check; the fix belongs in code, not the prompt.

    Read on LinkedInRead on MediumRead on dev.to

  • Idempotent tool calls: stop your AI agent from charging twice

    TL;DRRetries come from four layers and can multiply into many runs of one action. Seven rules make a dangerous tool call happen exactly once.

    1. 01Sort every tool into three groups
    2. 02Let one layer own retries
    3. 03Give every dangerous write an idempotency key
    4. 04Record the key and the result
    5. 05Return the first result as a success
    6. 06After a timeout, look before you retry
    7. 07Put a gate on what cannot be undone

    Read on Hashnode

  • Your AI Agent Just Charged the Customer Twice. Here Is Why.

    Duplicate actions in AI agents usually come from retries, not bad code — the HTTP client, the orchestrator, the model's own re-attempt, and a resumed run after a crash can each multiply the same action. A content hash and stable chunk IDs stopped a RAG indexer from double-writing; seven rules for preventing duplicates follow.

    Read on LinkedInRead on MediumRead on dev.to

  • You Probably Have a Context Problem, Not an Agent-Count Problem

    Before adding more agents to a RAG system, check whether the evidence for a failed answer was even in the model's context — if not, a second agent can't fix it, because the model needed the missing evidence, not collaborators. Multi-agent systems can burn roughly 15x the tokens of a single chat.

    Read on LinkedInRead on MediumRead on dev.to

  • Single agent vs multi-agent: check the context before you split

    TL;DRA second agent buys a context window, not intelligence. Check whether the evidence reached the model before you add agents.

    1. 01Pull your failed runs
    2. 02Check whether the evidence arrived
    3. 03Give every failure a label
    4. 04Pick the cheapest shape that works

    Read on Hashnode

  • Rate Limiting an Agentic System with Redis: Count Tokens, Not Requests

    Request-count limits don't track cost: a one-line question and a multi-step agent run both count as one request. Two Redis counters — tokens per minute for capacity, cost per day for budget — with estimate, reserve, reconcile, plus per-run agent budgets so retries and sub-agents draw from the same cap.

    Read on LinkedInRead on MediumRead on dev.to

  • When a Redis Cache Hit Is the Wrong Answer

    Three caches in front of an LLM agent, what goes in each key, and the five cases where a saved answer must not be returned.

    Read on LinkedInRead on MediumRead on dev.to

  • Rate limit LLM tokens with Redis when the cost arrives after the call

    TL;DRA token limit is a reservation: reserve an estimate before the model call, correct it after, and give every agent run its own budget.

    1. 01Decide what each counter protects
    2. 02Estimate before the call
    3. 03Reserve in one atomic script
    4. 04Call the model, then reconcile
    5. 05Give every agent run its own budget
    6. 06Tell the caller which limit it hit

    Read on Hashnode

  • How to cache an LLM agent with Redis without serving wrong answers

    TL;DRPut three caches in Redis and check them in order of cost — exact match, semantic, then tool results inside the agent loop — and know the cases where a hit must be treated as a miss.

    1. 01Check in order of cost
    2. 02Add the exact-match cache
    3. 03Add the semantic cache, with an identifier check
    4. 04Add the tool-result cache inside the agent loop
    5. 05Re-check authorisation on every hit
    6. 06Invalidate by version
    7. 07Fail open when Redis is down
    8. 08Leave prefix caching to the model provider

    Read on Hashnode

  • Multi-Tenant RAG Leaks Through the Search, Not the Login

    TL;DROne pipeline, many users: the client may select a workspace but never assert one. Four checkpoints keep every answer inside the asker’s own documents.

    1. 01The server decides the workspace on every request
    2. 02Every path to the data carries the limit
    3. 03Document text never makes an access decision
    4. 04Prove it with refusal tests and an audit trail

    Read on Hashnode

  • Secure a RAG API without minting tokens or storing passwords

    TL;DRLet an identity provider (Keycloak, Okta, Cognito) issue tokens; the RAG API only verifies them, locally, against cached public keys.

    1. 01The config holds nothing that signs
    2. 02Verify locally, then check membership
    3. 03The route and every tool take identity from the principal

    Read on Hashnode