Build a working coding agent in R from three tools

Coding agents like Claude Code, Cursor, and Codex have taken the software engineering field by storm. Task: The author implemented a minimal coding agent in R using the ellmer package, registering three core tools: read_file, write_file, and run_command. The agent uses a system prompt to guide the LLM to explore codebases and execute shell commands for tasks like searching code or running tests. The workflow demonstrates how these basic functions allow an LLM to interact with files and the system, mimicking human developer actions.; tools: custom-built or unnamed agent. Human role: The original post does not say how a person stayed involved.; limitations: The run_command tool poses significant security risks as it allows arbitrary shell execution, which the author notes is 'rather dangerous.' The minimal implementation lacks safeguards for path traversal or secret exposure unless explicitly added. The text suggests that general-purpose shells are difficult to secure compared to stricter, purpose-built tools..

Tools

custom-built or unnamed agent

Published on Agent Work Atlas:

Overview

Coding agents like Claude Code, Cursor, and Codex have taken the software engineering field by storm.

Workflow

The author implemented a minimal coding agent in R using the ellmer package, registering three core tools: read_file, write_file, and run_command. The agent uses a system prompt to guide the LLM to explore codebases and execute shell commands for tasks like searching code or running tests. The workflow demonstrates how these basic functions allow an LLM to interact with files and the system, mimicking human developer actions.

Reported result

The source does not report measured performance metrics or success rates for the agent. It qualitatively states that the minimal agent is 'no Claude Code, but it’s in the same galaxy,' implying functional capability for basic tasks. No specific failures or quantitative outcomes are documented in the provided text.

Human role

The original post does not say how a person stayed involved.

Limitations

The run_command tool poses significant security risks as it allows arbitrary shell execution, which the author notes is 'rather dangerous.' The minimal implementation lacks safeguards for path traversal or secret exposure unless explicitly added. The text suggests that general-purpose shells are difficult to secure compared to stricter, purpose-built tools.

Try it

Build a minimal coding agent in R using the ellmer package. Define three functions: read_file(path), write_file(path, content), and run_command(command). Register these as tools in a chat_anthropic instance with a system prompt instructing the model to read before editing and run tests after changes. Use a sample project directory. Before executing any write_file or run_command actions, pause and display the proposed command or file content to me for approval. Do not proceed without my explicit confirmation. Start with a dry run on a non-critical file to verify the agent can read and list files correctly. If the agent attempts to access paths outside the project directory or execute dangerous commands, stop immediately and report the attempt.

Original source

Source reports are not independently verified. Publication date is the catalog publication date, not the original article date.

More cases · Software & development