Building a coding agent from scratch: What we learned
- PYYNE DIGITAL

- Mar 12
- 2 min read
Pyyne's Tribe AI Lunch & Learn — March 11, 2026
Ever wondered what's actually happening under the hood when tools like Claude Code or Cursor write code for you?
When building and operating software at scale, we find it not only valuable but critical to understand the fundamentals of the different tools we are using. At our latest lunch and learn, our Senior Engineer Christopher walked us through building a simple coding agent — Some key concepts and topics below.
The Agentic Loop
The core concept is simple: tools running in a loop. The user gives a prompt, the LLM decides which tools to call (read a file, search the codebase, etc.), the agent executes them and returns the output, and the cycle continues until the task is done.
Because LLM API calls are stateless, the full conversation history has to be passed with every request. The LLM can't touch your file system directly — it issues instructions, and the agent carries them out. Think of it like guiding a friend through cooking dinner over the phone.
On top of the loop, a few additions go a long way:
Context files (like claude.md) inject project-specific knowledge — coding conventions, stack details, business logic — into every request, keeping the LLM grounded in your codebase.
Context management keeps the messages array from bloating. Strategies range from starting a fresh CLI instance to having the agent summarize and compact older messages automatically.
Sub-agents are separate agent instances spawned for specialized tasks like planning or exploration, so their tool call output doesn't pollute the main agent's context.
Skills are reusable instruction sets invoked via slash commands for specific tasks like front-end design or brainstorming.
The Takeaway
The agentic loop is simple to build and easy to extend — and once you understand it, the same pattern applies well beyond coding, to research, writing, workflow automation, and more.
Want to see the full walkthrough? Watch the recording on our YouTube channel. Have an idea for our next lunch and learn? Reach out — we'd love to hear it.



