AI series · Part 4: Agentic Automation
Letting AI Agents Use the Command Line, Safely
Agents can run ordinary terminal commands like git, kubectl and aws because LLMs already know them. That's fast and powerful, so lock the dangerous buttons. CLI vs MCP compared.
Instead of building a custom tool, an agent can run normal terminal commands (git, kubectl, aws) and read the output. LLMs already know these commands well.
It's like handing the agent the TV's existing remote instead of building a new one, but with the dangerous buttons locked.
Where you see it
- Claude Code runs
git diff,npm testandgh pr create. - DevOps agents run
kubectl get podsto inspect a cluster.
CLI vs MCP
| CLI tools | MCP tools | |
|---|---|---|
| Setup | None: the commands already exist | Build or install a server |
| Control | Broad: anything the shell can do | Narrow: only the tools you expose |
| Best for | Developer tooling | Business systems |
Locking the dangerous buttons
Our reference agent has a run_cli tool that allows only ls, grep, wc, head, cat and date. Anything else, including rm -rf ., is blocked before it runs.
CLI tools are fast to use because the model already knows them, but I always restrict them with an allow-list, a sandbox, timeouts and human approval for destructive commands.
- The short version
Next in the GenAI series: Top-5 Misses, Top-20 Bloats: Search Wide, Then Pick Narrow
Start from the top: GenAI Quick Answers and Series Guide
We deploy these patterns across production engagements in fintech, healthcare, and eCommerce. Talk to a senior engineer about how they apply to your platform.
