Skip to main content

🖥️ terminal-agent

A plain-English terminal agent. Tell it what you want done — it plans the shell commands, runs them, and adapts based on what happens. No more copy-pasting commands out of a chatbot.

Python 3.10+ Groq Llama 3.3 Cross-platform MIT License


📋 Table of Contents


💡 Why this exists

Copy-pasting shell commands out of an LLM chat window into your terminal is slow, breaks your flow, and is easy to get wrong. terminal-agent closes that loop:

You: "set up docker"
         ↓
Agent proposes a command → you approve (if risky) → it runs → output feeds back
         ↓
Agent decides the next step, or says it's done

No copy-paste. No context-switching between a chat tab and your terminal.

⚙️ How it works

┌─────────────┐      ┌──────────────┐      ┌───────────────┐
│  Your task   │ ───▶ │  agent.py    │ ───▶ │  executor.py  │
│ (plain text) │      │  (asks LLM   │      │  (runs command │
└─────────────┘      │  for next    │      │  safely)       │
                      │  command)    │      └───────┬───────┘
                      └──────▲───────┘              │
                             │        output         │
                             └────────────────────────┘
                          (loops until task is done,
                           or 12-step safety cap is hit)

The agent never runs blind — every command passes through a safety classifier before execution.

🛡️ Safety model

Every command gets classified into one of three tiers before it runs:

Tier Behavior Example commands
🟢 AUTO Runs immediately ls, cat, docker --version, dir
🟡 CONFIRM Asks before running sudo, rm, chmod, del, git push --force
🔴 BLOCKED Never runs — no override rm -rf /, format c:, fork bombs

A hard 12-step limit per task also prevents runaway loops.

📦 Install

git clone https://github.com/AnuragBel/terminal-agent.git
cd terminal-agent

Get a free Groq API key → console.groq.com

cp .env.example .env      # then paste your key into .env

See Cross-platform support below for OS-specific setup.

🚀 Usage

tagent "check disk usage and list the top 5 largest folders in home"
Task: check disk usage and list the top 5 largest folders in home

[AUTO] du -h --max-depth=1 ~ | sort -rh | head -5
  reason: list top 5 largest folders by size
/home/user/Downloads    4.2G
/home/user/Projects     1.8G
...

✓ Done — Found and listed the 5 largest folders in your home directory.

Auto-approve CONFIRM-tier steps (use with care):

tagent "install nodejs and check the version" --yes

🌐 Cross-platform support

The agent auto-detects the OS at runtime and adjusts its command vocabulary and safety patterns accordingly — one codebase, no manual flags needed.

WSL Ubuntu Native Ubuntu Native Windows
Create venv python3 -m venv venv python3 -m venv venv python -m venv venv
Activate source venv/bin/activate source venv/bin/activate venv\Scripts\activate
Install pip install -e . pip install -e . pip install -e .
Env file cp .env.example .env cp .env.example .env copy .env.example .env
Agent proposes df -h, ls df -h, ls dir, wmic

Each environment needs its own venv/ and .env — these aren't shared across OSes.

🗂️ Project structure

terminal-agent/
├── terminal_agent/
│   ├── __init__.py
│   ├── agent.py       # LLM decision loop + OS auto-detection
│   ├── executor.py     # 3-tier safety-gated command execution
│   └── cli.py          # tagent entry point
├── pyproject.toml       # pip-installable packaging
├── .env.example
└── README.md

⚠️ Limitations

  • Requires an internet connection (cloud LLM via Groq — no local model support yet)
  • CONFIRM/BLOCKED detection is pattern-based, not exhaustive — always read a command before approving it
  • Tested primarily on WSL2 Ubuntu; native Windows and native Ubuntu support is newer and less battle-tested

🗺️ Roadmap

  • --dry-run flag to preview the full plan before executing anything
  • Docker sandbox mode for isolated execution
  • Local model support via Ollama
  • --platform override flag for edge cases (e.g. WSL running Windows-style commands)

👤 Author

Anurag Belgudri — Agentic AI Engineer Intern @ Entra Innovation GitHub · LinkedIn


Built as a hands-on exploration of agentic AI systems — LLM decision loops, tool use, and safety-first automation.

Metadata

Release files for tagent-cli 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tagent-cli 0.1.0
File Size Uploaded Provenance Actions
tagent_cli-0.1.0.tar.gz 7.1 kB Without provenance Details for tagent_cli-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tagent-cli 0.1.0
File Interpreter ABI Platform Actions
tagent_cli-0.1.0-py3-none-any.whl Python 3 none any Details for tagent_cli-0.1.0-py3-none-any.whl

Total release size: 15.2 kB

Release files / tagent_cli-0.1.0.tar.gz

Download URL tagent_cli-0.1.0.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f049cb5cce2b0a6f38c28ed5698a42d01ed8b4b3fa8d25657541315cd787bf88
BLAKE2b-256 checksum
How to use checksums
8a00bbd7ca2a16b21881f50021fb25e047f191dcea45d66879a35fe7fafa43ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / tagent_cli-0.1.0-py3-none-any.whl

Download URL tagent_cli-0.1.0-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c87e041b89ec95ee2fec4f71e9597bb22f92ef9e43053368eec8b89f1a67aec2
BLAKE2b-256 checksum
How to use checksums
349fcf5da8cb2978ed7703b20afc5b2f70d92cec184a423eb0c9cb820901caf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for tagent-cli 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page