The vvek blog
Databases, programming, AI and how teams get work done, written by the people building vvek.

Designing tools an AI agent can use well: fewer tools, clearer names, smaller answers
Practical rules for agent tools, drawn from Anthropic's engineering guide: consolidate, name clearly, return readable and short results, and test with real tasks.

Postgres transaction isolation in practice: Read Committed, Repeatable Read, Serializable, and the retry loop you need
What each Postgres isolation level actually guarantees, what error 40001 means, and a small retry loop that makes stronger levels safe to use.

Why one slow service takes down the rest: deadlines, retry budgets and load shedding
How overload spreads between services, and four habits that stop it: deadlines that propagate, retry budgets, small queues and load shedding.

Search without a search engine: full-text search in Postgres with tsvector, GIN and websearch_to_tsquery
Add fast, ranked, highlighted search to a Postgres table: tsvector, a generated column, a GIN index, websearch_to_tsquery, ts_rank and ts_headline.

When something breaks: a simple incident command routine for small teams
Four roles, one shared document and clean handoffs: how a small team can run an incident calmly, drawing on Google's SRE guidance on managing incidents.

Always-on agents: five building blocks for an AI worker that sleeps between jobs
An agent that runs for weeks is mostly an inbox, timers, memory, permissions and an outbox. How the pieces fit, based on Anthropic's new guide.

Recursive queries in Postgres: walk a tree with WITH RECURSIVE, and stop it from looping forever
How WITH RECURSIVE works, how to walk org charts and folder trees, the SEARCH and CYCLE clauses, and when CTEs are materialized in Postgres.

TypeScript 7 in practice: the native compiler, the new defaults, and a safe way to upgrade
TypeScript 7.0 is a native Go port of the compiler. What changed, which options are removed, what tooling still needs 6.0, and how to run both side by side.

Receiving webhooks safely: verify the signature, answer fast, and expect every event twice
A practical checklist for webhook receivers: HMAC signature checks on the raw body, replay windows, quick 2xx replies, queues and deduplication by event id.

JSONB in Postgres: when a JSON column is the right call, and the index that makes it fast
When to store data as jsonb in Postgres, how containment with @> works, how to choose between the two GIN operator classes, and the row-lock trap.

Service level objectives in one afternoon: pick two indicators, set a loose target, spend the error budget
How to define SLIs and SLOs, why percentiles beat averages, and how an error budget turns reliability into a release decision. Based on Google's SRE book.

Better retrieval for your AI app: give every chunk its context, then combine two kinds of search
Why chunks lose meaning in RAG, how contextual retrieval, BM25 and reranking cut missed results in Anthropic's tests, and a checklist to try on your own data.

Prompt injection for builders: treat model output as a suggestion, not an order
Why prompt injection cannot be filtered away, and the controls that hold up: separation, code-side permissions, approval for risky actions and monitoring.

Docker multi-stage builds: smaller images by leaving the build tools behind
How multi-stage Dockerfiles keep compilers out of your final image: named stages, copying artifacts, build targets and a Go example.

HTTP caching in plain words: Cache-Control, ETag and the headers worth setting
How browsers and CDNs reuse responses: freshness, revalidation with ETag, hashed asset URLs, and a small set of Cache-Control defaults that work.

Vector search in Postgres with pgvector: choosing HNSW or IVFFlat, and making filters work
How pgvector's HNSW and IVFFlat indexes differ, which settings matter, and how iterative scans stop filtered similarity queries from returning too few rows.

Feature flags: ship code dark, turn it on gradually, and clean up afterwards
How feature flags separate deploying from releasing, the kinds of flag worth having, a vendor-neutral way to evaluate them, and how to avoid flag debt.

Context engineering for agents: give the model less, but better
A longer context is not a better one. Practical ways to keep an agent's context small and useful: just-in-time retrieval, compaction, notes and sub-agents.

Kubernetes requests and limits: how to size containers without surprises
Requests decide scheduling, limits decide throttling and OOM kills. How CPU and memory differ, what QoS classes mean, and a sensible way to start.

Postgres partitioning: when to split a big table and what it asks of you
Range, list and hash partitioning in Postgres: when it pays off, how pruning works, the primary key rule, and how to drop old data in seconds.

Code review that helps: approve what improves the code, save the nitpicks for later
A practical code review standard for reviewers and authors: improve code health steadily, separate facts from taste, label nits and settle disagreements.

Rate limits from both sides: handling 429 responses and limiting your own API
What a 429 means, how to retry with backoff and jitter, how to smooth traffic with a token bucket, and what to tell clients when you limit them.

SQL window functions: per-group answers without losing your rows
A practical guide to Postgres window functions: OVER, PARTITION BY, ORDER BY, running totals, top-N per group and reusable WINDOW definitions.

A job queue in Postgres: how FOR UPDATE SKIP LOCKED lets workers share a table
Build a simple, safe job queue on Postgres: claiming rows with SKIP LOCKED, handling crashes with leases, retries, and the limits of the approach.

The transactional outbox: saving data and sending a message without losing either
How the outbox pattern keeps a database write and its message in step, why duplicates still happen, and how to build a small version on Postgres.

Blameless postmortems: how to learn from an incident without pointing fingers
When to write a postmortem, what goes in it, and how to keep it blameless so people report problems early. Practical notes based on Google's SRE book.

Trace sampling with OpenTelemetry: head or tail, and what each one costs you
Keeping every trace gets expensive. How head and tail sampling differ in OpenTelemetry, when to combine them, and when not to sample at all.

Evals for AI agents: start with twenty tasks, grade the outcome
How to test an AI agent before users do: tasks, trials, graders, pass@k versus pass^k, and a first eval set you can build in an afternoon.

Prompt caching for LLM apps: put the stable parts first and watch the usage fields
How prompt caching works, how to order a prompt so it hits, what breaks the cache, and how to verify savings from the usage fields.

Python 3.15 for working developers: lazy imports, a sampling profiler and UTF-8 by default
A practical look at Python 3.15: the lazy keyword, the Tachyon profiler, UTF-8 as the default encoding, frozendict and unpacking in comprehensions.

Kubernetes probes: what liveness, readiness and startup checks should (and should not) test
A practical guide to Kubernetes liveness, readiness and startup probes: what each one does, sensible settings, and the dependency-check mistake to avoid.

Connection pooling for Postgres: what PgBouncer's pool modes change
Why Postgres needs a pooler, how PgBouncer's session, transaction and statement modes differ, and which features stop working in transaction mode.

Schema changes without downtime in Postgres: locks, NOT VALID and safer migrations
Which ALTER TABLE changes block your app, and how NOT VALID, VALIDATE CONSTRAINT and a lock timeout let you change a live Postgres table safely.

Architecture decision records: write down why, not only what
A short, practical guide to architecture decision records: what to put in one, when to write it, and how a decision log saves your team repeated debates.

Giving an AI agent only the access it needs: a least-privilege checklist
Most agent mishaps come from too many tools, too many permissions or too much autonomy. A practical checklist for narrowing all three, based on OWASP guidance.

Go 1.27 in practice: generic methods, goroutine leak profiles and a UUID package
A working developer's tour of the Go 1.27 release notes: generic methods, the goroutineleak profile, a standard uuid package, json v2 and go fix updates.

Reading EXPLAIN ANALYZE: a practical guide to Postgres query plans
How to read EXPLAIN ANALYZE output in Postgres: costs, row estimates, scan types, buffers, and the habits that keep it safe to run.

PostgreSQL 19 release candidate: what to look at before the final release
A tour of the PostgreSQL 19 release notes: REPACK, parallel autovacuum, automatic I/O workers, sequence replication and the migration items to check.

MCP goes stateless: what the 2026-07-28 revision changes for server authors
The newest Model Context Protocol revision drops sessions and the initialize handshake. Here is what that means if you run or build an MCP server.

Row-level security in Postgres: a practical guide to isolating tenants
How Postgres row-level security works, the traps that catch people, and a small tenant isolation pattern you can try today.

Idempotency keys: making retries safe in any API
Networks fail halfway. Idempotency keys, backoff and jitter let clients retry without charging, creating or sending twice.

Workflow or agent? Choosing the simplest design that does the job
Fixed workflows and autonomous agents suit different tasks. Five workflow patterns, tool design tips and a way to decide which one you need.

How database indexes speed up reads, and when they slow down writes
Learn when to use indexes for faster queries and when they hurt write performance.
Introducing vvek: hire AI agents like employees
A Manager agent that plans and hires, agents that work in chat beside your people, and you in charge of anything risky.
Why every agent gets its own virtual machine
Agents that run code and browse the web need real computers. Here is how we give them one without risking yours.