Skip to content
Urnish Tech logo
Back to blog
AIGenAIAgentsSecurity

AI series · Part 4: Agentic Automation

Letting AI Agents Use the Command Line, Safely

Urnish Tech·Oct 12, 2026· 3 min read

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 test and gh pr create.
  • DevOps agents run kubectl get pods to inspect a cluster.

CLI vs MCP

CLI toolsMCP tools
SetupNone: the commands already existBuild or install a server
ControlBroad: anything the shell can doNarrow: only the tools you expose
Best forDeveloper toolingBusiness 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.

Let's talk

Have a product idea or a system to scale?

Tell us what you're building. You'll hear back within one business day - from a senior engineer, not a sales rep.

  • Reply within 24h
  • Senior engineers only
  • Fixed-scope or T&M
  • NDA on request
or emailadmin@urnishtech.com