Type: url
Original: https://mathspp.com/blog/write-a-coding-agent-from-first-principles-better-tools
Status: generated
Language: en
Summary
A tutorial on mathspp that extends a minimal Python coding agent by replacing its hand-written file-editing and shell tools with Anthropic’s text editor tool and bash tool, whose schemas the Claude models are trained on. It walks through implementing the text editor’s create, str_replace, view and insert commands, a persistent bash session with timeouts and output truncation, and guardrails such as restricting edits to the working directory, backing files up before edits and asking the user to approve each shell command.