Hi dev.to, this is my first post here.
I've been writing C#/.NET for 23+ years, and over the last month or so I've been building Litos — a small, transparent AI coding agent, written entirely in pure C#/.NET. No Python or Typescript.
The goal wasn't to compete with the big coding agents out there, it was to actually understand how one works, from the inside, by building it myself.
This post is just the basics: what an "agent loop" is, and how 'Litos' AI Coding Agent is put together.
What is an agent loop?
At the core of any AI coding agent is a surprisingly simple. A "turn" starts when you send a message, and then the agent just keeps going — asking the model for a response, running any tools the model asks for (like reading a file, editing code, or running a shell command), feeding the results back to the model, and repeating — until the model comes back with a plain answer and no more tool calls to make.
That's it.
That loop, repeated with an ever-growing transcript (context) of what's happened so far, is what lets the model read your code, make edits, run commands, and check its own work.
How Litos is structured
I divided the project into three parts, inspired by Tau's "brain, environment, face" split, and by Mario Zechner's pi:
-
The brain (
Litos.Agent) — the core loop, the transcript, and context management. It doesn't know or care whether it's talking to Anthropic, OpenAI, or Gemini, or whether it's running in a terminal or a desktop app. -
The environment (
Litos.Tools,Litos.Providers.*) — the actual capabilities: file editing, shell access, web search, and the calls to whichever LLM provider you've configured. -
The face (
Litos.Gui,Litos.Api,Litos.Console) — the thin UI layer.An Avalonia desktop app, and an HTTP/API host (with a working Telegram bridge) and a terminal UI all drive the exact same loop underneath.
Keeping those separate has made it much easier to reason about — and to add a new provider or a new UI without touching the core loop at all.
See it in action
I've got two short videos showing it working end to end:
- Built an AI Coding Agent in Pure C#/.NET (No Python!) — Watch It Build a WinForms 15-Puzzle Game
- Built an AI Agent in Pure C#/.NET — Here it is working through Telegram creating Mermaid Diagrams
Code
It's all open source: github.com/nitinmms/LitosAiCodingAgent
It's still very much a work in progress — some pieces (like the console UI and a couple of the provider adapters) are unfinished, and the README is upfront about that. But the Desktop coding agent and the desktop/Telegram experiences work today.
I'll follow up with more detail posts on individual pieces (context management, MCP support, etc.) if there's interest.
Feedback welcome!
Top comments (0)