r/Python • • 20d ago

Showcase Showcase Thread

Post all of your code/projects/showcases/AI slop here.

Recycles once a month.

29 Upvotes

148 comments sorted by

View all comments

1

u/jingweno 6d ago

Nanocode: a small Python coding agent you can learn from

I wrote Nanocode as a teaching project. Its free, MIT-licensed source builds up chapter by chapter, without an agent framework.

One useful example is testing conversation state without calling a real model. FakeBrain returns predetermined responses; a separate FailingBrain test checks that a failed model call doesn’t leave a stray user message in the history. These tests check application logic, not whether the model makes good decisions.

It’s for Python developers who want to understand the conversation and tool loop rather than adopt a production-ready agent.

Source: https://github.com/optimalone/build-your-own-coding-agent Tests: https://github.com/optimalone/build-your-own-coding-agent/blob/main/ch03/test_nanocode.py

If you try the later file/shell tools, use a disposable environment: they aren’t sandboxed.

What failure case would you add to the tests?