Build a working coding agent in R from three tools
Author builds a functional coding agent in R starting from three tools, then adds tools to make it safer and more efficient. ·
Done with a custom-built or unnamed agent
- What they did
- The author uses R's ellmer package to build a Claude-backed agent from three plain R functions: read file, write file and run shell command. Each function returns a string to the model, and a short system prompt tells it to read before editing and to run tests. He then adds list and search tools, a path check that keeps access inside the project directory, and a targeted edit tool.
- How it went
- The three-tool agent can find a function, read the existing tests, write a new test and run the suite, though the author says it falls well short of Claude Code. The shell tool stays risky, and the author defers fuller security coverage to a later post.
- Worth knowing
- Wrap every file tool in the path check, not just search. The unrestricted shell tool can still bypass it, so don't treat the project-directory check as full protection.
Try it yourself with Claude Code
Help me build a small coding agent in [language, e.g. R] from three tools: read a file, write a file, and run a shell command. Wire them to [LLM provider] in a simple loop and test it on a small task in [path to scratch folder]. Then suggest and add tools that make it safer and more efficient, such as confirmation before running commands. Finish when it completes the test task end to end.
Want help getting this working? Join the Vibe Coding Academy ↗ Run by Alex Finn, who also runs this site.
Discussion on Bluesky · Jun 19, 2026
Related use cases
Build a C compiler with a team of parallel agents
Anthropic's engineering write-up on tasking Opus 4.6 agent teams with building a C compiler.
Autonomously test an entire iOS app and report bugs
A tool lets Claude Code drive an iOS app through the accessibility tree, tap every screen, and return a structured bug summary.
Audit a feature's issues and hand them to an engineer's agent
An AI agent listed all issues with a feature and sent them to an engineer, whose own agent then addressed most of them automatically.
Custom agent
Build small features and integrations with Cursor agent mode
A commenter uses Cursor agent mode for smaller features, third-party integrations, background jobs, notifications and activity tracking, and has it log key findings to a worklog file for the next run.
Cross-check coding agent answers with a second agent
The poster built a tool that automatically sends Claude Code responses to Codex for a second opinion, replacing manual copy-pasting.
Upgrade vulnerable dependencies via automated pull request
Devin opened a PR on a Spring Boot and Next.js sample app upgrading dependencies to fix listed CVEs, including 103 npm vulnerabilities on the frontend.
Get 5 like this every morning
The best things people got an AI agent to do, each with the prompt to try it.