Ramblings of an aging IT geek
← Ramblings of an aging IT geek
ai

a small agent that books its own train tickets

A weekend experiment wiring an LLM to a handful of real tools and the unglamorous plumbing that made it actually work.

A small toy robot on a desk

Most "agent" demos fall over the moment they touch the real world, so I gave myself a narrow brief: an LLM that could check my calendar, look up a train, and tell me the cheapest sensible departure. No grand framework, just a loop, a model, and four functions it was allowed to call.

The model itself was the easy part. The hard part, as always, was the boring bits around it. Tool schemas have to be honest about what they actually do, because the model will believe every word and then act on it. My first find_train returned times as friendly strings, and the agent cheerfully invented an "08:ish" departure. Returning ISO timestamps and a real price in pence sorted that out instantly.

The other lesson: let it fail loudly. When a tool errored, my early version swallowed the exception and the model carried on as if nothing had happened, confidently planning around a journey that didn't exist. Feeding the actual error text back into the conversation turned it from a liar into something that said "that lookup failed, shall I try the next hour" which is exactly what you want.

It is not clever. It is a while loop with good manners and well-typed tools. But it did book me onto the 17:42 to Edinburgh without me touching the website, and that felt like a small piece of the future arriving early.