Back to archive
By Ivan VydrinAI9 min read3 July 2026Updated 29 July 2026< 50 views

Build Your Own Code Agent: Tool Calling, Memory, and MCP from Scratch

Strip away the framework and a code agent is a while loop over tool calls. Here's how the calling contract, the message-array memory, and MCP fit together, and where each one breaks.