Adam C.H. Profile picture
ai, cyber, agents, games - now working on something new and sharing my journey | ex: founding swe @cadosecurity, founder @ Gruchka Games, swe@idf

Apr 8, 2023, 6 tweets

My brother (@0xDACA) and I worked on a fun project tonight, inspired by @yoheinakajima : Coding Agent that follows the Test Driven Development (TDD) methodology!

You write the tests - and the agent runs in a loop until it creates the feature properly!

1/6
#buildinpublic

We start with a simple FastAPI app and two tests - one of which will fail (the "echo" endpoint does not exist)

2/6

Then - we run the agent - it does not read the tests, it can just run them and get the output.

On the first try, it created the "echo" endpoint with a POST method - which failed, as the test defined it as a GET:

3/6

It then took the failures and converted the code to use GET instead - which failed again but with a different error*.

*We tried to make it fail on purpose, so in the test, we defined the expected key name of the return value as "message1" and not "message"

4/6

It, therefore, took the failures (again), and adjusted the code - this time making the return value "message1" - which worked, and the tests passed.

5/6

Currently only works well with small changes, but we are working on cool stuff for it: enabling changes across multiple files, creating its own tests, etc

Framing it inside TDD is super useful to steer it in a specific, measurable direction - while keeping it somewhat autonomous

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling