TheAILAB blog

Notes from the lab.

We write about the things we build: automating everyday business work, running AI on your own hardware, and turning trading rules into automated systems. When we state a fact, we link to where it came from.

AI Automation8 min read

Prompt caching for LLM automations: cut repeat input costs

How prompt caching works at Anthropic, OpenAI and Google, how to order prompts so the cache hits, and the maths that tells you when it saves money.

Read article

AI Automation7 min read

API pagination for automations: stop missing and duplicating records

How offset, cursor and page-token pagination work, the mistakes that make syncs silently skip records, and a tested Python loop that avoids them.

Read article

Custom Software6 min read

Zero-downtime database migrations: expand and contract in Postgres

How to change a live PostgreSQL schema without locking out users: lock timeouts, safe column and index changes, and the expand-and-contract pattern.

Read article

AI Automation7 min read

Daylight saving time and scheduled jobs: missed and doubled runs

Why scheduled automations skip or run twice when clocks change, how cron, AWS and Google Cloud schedulers differ, and how to schedule jobs safely.

Read article

Data Privacy & Security7 min read

Webhook signature verification: keeping fake events out

How HMAC webhook signatures work, why you need the raw body, constant-time checks and a timestamp window, with tested Python and GitHub, Stripe and Slack docs.

Read article

AI Automation8 min read

Monitoring automated workflows: how to catch silent failures

How to tell when an automation has quietly stopped working: heartbeat checks, outcome-based alerts, useful logs and alert rules people won't learn to ignore.

Read article

Custom Software7 min read

Backup restore testing: proving your business software can recover

How to set recovery targets, back up a custom app's database properly and run restore tests that show your backups actually work.

Read article

Algorithmic Trading6 min read

Paper trading vs live trading: why your results won't match

What a paper trading simulator actually models, what it leaves out, and how to use a paper run so the gap to live trading doesn't surprise you.

Read article

AI Automation8 min read

Retries and idempotency: making automations safe to run twice

Which failures to retry, how to back off, and how idempotency keys and deduplication stop a retried automation from charging, emailing or invoicing twice.

Read article

Algorithmic Trading7 min read

Kill switches and risk limits for automated trading systems

Which pre-trade limits, loss limits and kill switches an automated trading system needs, based on SEC, ASIC, FIA and CME guidance and the Knight Capital case.

Read article

Algorithmic Trading7 min read

Order types and slippage: what happens when your bot sends an order

How market, limit, stop and stop-limit orders actually fill, where slippage comes from, and what an automated trading system should log and handle.

Read article

Workflow Optimization7 min read

Email triage automation: patterns that work and ones that backfire

How to automate email triage safely: sort with headers and rules first, keep the LLM to labelling, and avoid auto-reply loops and risky forwarding.

Read article

Workflow Optimization7 min read

How to measure time saved by automation without fooling yourself

How to measure the time an automation really saves: take a baseline, count the new work it creates, use a comparison group and avoid selection effects.

Read article

Workflow Optimization7 min read

How to map a business process before you automate it

A practical method to map a business process before automating it: set the boundaries, map what really happens, record the data and find the exceptions.

Read article

Custom Software7 min read

Spreadsheet to app: signs your process has outgrown Excel

How to tell when a business process has outgrown Excel, what the evidence says about spreadsheet errors, and what to try before building an app.

Read article

Custom Software6 min read

The real cost of maintaining custom software after launch

What maintaining custom software actually involves after launch, the outside deadlines that force the work, and how to budget for it honestly.

Read article

Algorithmic Trading7 min read

Walk-forward testing explained, with a worked Python example

How walk-forward testing works, how to choose window sizes, and a runnable Python example showing how far in-sample results can mislead.

Read article

Custom Software7 min read

Build vs buy for internal tools: a practical decision framework

A short set of questions for deciding whether to build, buy or configure an internal tool, drawn from government guidance and engineering practice.

Read article

Data Privacy & Security6 min read

Data leakage through AI assistants: where your pasted text goes

What OpenAI, Anthropic and Google say happens to the text you paste into ChatGPT, Claude and Gemini: training, human review, retention and business plans.

Read article

AI Automation7 min read

Measuring hallucinations in document Q&A: methods that hold up

How to measure hallucinations in a document Q&A or RAG system: claim-level faithfulness, citation checks, published benchmarks and hand grading.

Read article

AI Automation7 min read

Human-in-the-loop design: where approval steps belong in AI workflows

Where to put human approval in an AI workflow, what the reviewer should see, and how to stop approvals turning into a rubber stamp.

Read article

Local AI8 min read

Local RAG: running retrieval-augmented generation on your own machines

How to build retrieval-augmented generation that never leaves your hardware: embeddings, storage, hybrid search, prompting and the security gaps to close.

Read article

Local AI7 min read

LLM quantisation explained: what 4-bit and 8-bit models trade away

What 4-bit and 8-bit LLM quantisation costs in quality, why benchmark averages hide it, and how to test a quantised model on your own tasks.

Read article

AI Automation6 min read

When not to use an LLM: tasks where plain code and rules win

How to tell which steps in a workflow need a language model and which are better as plain code or rules, with a simple test and a hybrid pattern.

Read article