An agentic approach to building council scripts #1583
davida72
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Earlier this year I wanted to try a different approach to creating council scripts, having created and reworked a bunch of scripts for this project. It was mostly an exercise in figuring out how I could use AI agents such as Claude Code and LLMs such as Gemini. I also wanted to compare using the Playwright browser instead of Selenium.
I thought I'd share the results, in case it's interesting. I made a point of not using any code or data from this project.
I started with an official list of council codes, then created a script that would find the council website bin collection website for each council. That built a JSON for each council. From there I created a web interface to find and add sample addresses for each council just by clicking on places on the map.
With a JSON for each council, which contained the council's bin collection website and sample addresses, I could feed this into Claude Code. At first I was giving Claude the Playwright steps for how to navigate the website, i.e. what to click on and what was expected in the input boxes, but after a while it didn't need those steps. I could just tell it to read the council's json file and ask it to figure out how to use the sample addresses to get bin collection info.
I also figured out that rather than parsing the bin types and collection dates using code, it was easier just to send a screenshot or HTML blob to Gemini and ask for the information to be returned in a valid JSON. Admittedly, this means anyone using the script would need to use a few tokens if they used the same script. The Gemini model I used was near-free, but not completely free.
Playwright by Microsoft proved to be better that Selenium. Less steps in the code, faster and less strange behaviour (on my machine at least).
It was just a proof of concept, but I found it interesting that agentic coding was at a point that it could create a working council script with just a council URL and some sample addresses.
The result is that you could type
BinDay <any uk address>
and it would return bin collection types and dates in json format.I recorded a video of Claude Code creating a sample script, which you can click on below. This one happened to be a one-shot, i.e. I set it off and it did the whole script without any intervention on my part. Took 4.5 minutes. Others took a bit of nudging before they'd work. Nonetheless I did about 100 councils or so, just going A-Z, all using Playwright.
Here's a sample council JSON. The dev-notes were notes that Claude Code wrote that it thought would be useful to know. The genai-model is the Gemini model used to process the bin types and dates.
I'm not planning on releasing this as it's just a proof of concept, but perhaps an indication of how an agentic system can be used on a project like this.
Beta Was this translation helpful? Give feedback.
All reactions