Run AI Agents in Lightweight Sandboxes

Currently, “AI agents” like Claude Code are all the rage for software development. These programs facilitate feeding context into LLMs directly from your codebase and environment by empowering the LLM to read/write files and run arbitrary code on your system.

If you’re at all security conscious, the above should make you very uncomfortable. An intentionally non-deterministic model running arbitrary code and reading arbitrary files? No thanks. What’s worse is programs like Claude Code are not even open source. As a rule I go to lengths to avoid proprietary software, but I decided to cave on Claude Code just to see what all the fuss is about.

The SQL standard includes a boolean type which, unsurprisingly, represents a Boolean value. This can be useful, but I’m going to argue that it should almost never be used in a normalised data model.

The Problems with Boolean

Here are few of the problems you’ll inevitably run into if you use boolean in a normalised data model:

It’s not really binary

So you’re chatting to your domain expert and he says something like “books are either hardback or paperback”. Something twigs in your mind: two options… binary… that’s a Boolean! So you duly write:

Just Send Me the Prompt

If you are thinking about using an LLM to communicate with me, you will be glad to hear I’ve just developed an exciting new technique which will save us both time. Rarely are such wins possible, so this is surely cause for a celebration.

The technique goes as follows:

  1. Type up your LLM prompt,
  2. (Here’s where it gets really exciting), instead of sending your prompt to an LLM, just send the prompt directly to me!

“What?” I hear you crying, “My prompt doesn’t contain all the information you need!”

Metabase is a really nice free software business intelligence tool. It’s quite easy to deploy; they provide a Docker image and all you really need for a production instance is your own database.

I use Flux to manage my cluster so I thought it would be nice to utilise image update automation to keep up to date with updates automatically. But Metabase makes this slightly difficult because it doesn’t use proper semantic versioning on the image tags.

Clean Domain Models with SQLAlchemy

One of the most tried and tested techniques in programming is to build components that map closely to the real-world problems you are trying to solve. In domain-driven design (DDD), one of the key tenets is to have a domain model at the centre of your application.

The domain model should be built in close collaboration with domain experts and, crucially, should consist purely of high-level domain logic and be completely free of low-level application logic like databases, GUIs, web frameworks etc.

Talos Linux on XCP-ng

Talos Linux is a minimal Linux distribution designed purely for running Kubernetes nodes. It’s pretty neat, check out its website here: https://www.talos.dev/

I use XCP-ng in my homelab for running virtual machines and decided to set up a Talos cluster there. I followed the excellent Getting Started guide but there are a few additional things I wanted to do right from the start:

  1. Have the Xen Guest Tools (aka Xen Guest Utilities, xe-guest-utilities. xen-guest-agent etc.) installed on the nodes,
  2. Have static IP addresses.

I also had to configure the installation disk as mentioned in the guide, to /dev/xvda.

Hillshading on my Static Maps

In a previous article I wrote about adding maps to my blog, which is a static site. I use these maps to write about walks I’ve done. These maps can be dragged, rotated and zoomed, but there is no backend tileserver supporting it, it all comes from a single static file. This is thanks to the PMTiles format and support by the frontend renderer maplibre-gl.

In the original article I took a pre-made pmtile file of the world from the Protomaps project and extracted a smaller part using the pmtiles CLI. Later I ended up making my own pmtiles directly from OpenStreetMap data, which I’ll describe below. This provides a lot of geographic data like coastlines, forests, roads etc., but what I really wanted was hillshading, which I’ve now figured out.

West Highland Way

The West Highland Way is a waymarked, long-distance path in Scotland. It starts just north of Glasgow and ends at Fort William in the Highlands. It is probably the most famous of Scotland’s Great Trails (similar to the National Trails in England and Wales). In September 2024 I walked the West Highland Way over seven days with my partner Vicki.

Planning

At 154 km the WHW will take most people between 5-10 days to complete. We didn’t fancy any super long days, so we decided to do it in 7 days.

Kubernetes Ingress vs Load Balancer

I’ve been using Kubernetes successfully for a while, but I felt like I still didn’t fully understand the difference between an Ingress and a LoadBalancer. Whenever I tried to find an explanation I’d find some vague thing like “they are sort of the same, but not really”.

The problem is I was thinking about these things wrong. One is not a replacement for the other; they exist in different planes of abstraction within k8s. For someone who just wants to deploy a web service, there are three orthogonal concepts you need to understand in k8s.

Make Reading a Habit

Habits are really important. Long-term goals are too but, ultimately, habits are what you are doing to yourself day in, day out. Your habits determine what goes into your body (your diet), your physical condition (diet and exercise) and your mental condition (sleep and everything else).

I think you should make reading one of your habits.

The benefits of reading are many. First of all, it’s a great form of entertainment. You can read anywhere; you won’t disturb anyone. I love films, but the books are almost always better than the films. Really. A good book can conjure images in the mind that a film could never capture and these images never age. You’ll never go back to a favourite book and be disappointed at how bad the CGI looks now.