🚀 AgentSSH — AI Agent SSH Client
╭──────────────────────────────────────────────────────────╮
│ │
│ ⚡ AgentSSH ⚡ │
│ AI Agent SSH & SFTP Client │
│ │
│ Developed by Its2Pawan │
│ │
╰──────────────────────────────────────────────────────────╯
Production-ready, terminal-first SSH client specifically designed for AI Coding Agents and DevOps Engineers.
🎯 1. Why AgentSSH?
Traditional SSH clients (like standard OpenSSH) were built for human interactive typing. When terminal-based AI agents (Claude Code, Google Antigravity, Cursor, Codex) run standard SSH commands, they often get stuck:
- ❌ Unattended Password / Host Key Prompts: Stalls agent loops indefinitely.
- ❌ Mixed Output Streams: Interleaved stderr and stdout breaks automated JSON parsers.
- ❌ Lost Exit Codes: Command failures go undetected.
- ❌ Heavy Dependencies: Requires installing monitoring agents on remote servers.
🌟 The AgentSSH Solution:
- 🟢 Machine-Readable JSON (
--json): Every command emits deterministic, schema-validated JSON tostdout. - 🟢 Pure Stream Separation: Output payloads flow to
stdout; diagnostics and warnings flow strictly tostderr. - 🟢 Fail-Fast Non-Interactive Mode: Never hangs on prompts (
AGENTSSH_NON_INTERACTIVE=1). - 🟢 Zero Remote Agent Telemetry: Monitor CPU, RAM, Disks, Uptime, Processes, and Docker using built-in Linux tools.
- 🟢 Hardened Security: Strict SSH host-key verification by default, permissions protection (
0700/0600), and SQLite audit logs. - 🟢 Native MCP Integration: Launch as a Model Context Protocol server (
agentssh --mcp).
🏗️ 2. Architecture Overview
flowchart TD
subgraph AI["🤖 AI Coding Agents & Users"]
A1["Claude Code"]
A2["Google Antigravity"]
A3["Cursor IDE"]
A4["OpenAI Codex"]
A5["DevOps Engineer"]
end
subgraph CLI["⚡ AgentSSH CLI Engine (Typer + Rich)"]
B1["CLI Controller\n`agentssh <cmd>`"]
B2["JSON Mode Formatter\n`--json -> stdout`"]
B3["Audit Logger\n`SQLite history.db`"]
end
subgraph Core["🔐 Security & Transport Layer"]
C1["Paramiko SSH Engine\n`Keepalive + Reconnect`"]
C2["HostKey Policy\n`Strict / Accept-New`"]
C3["Credential Manager\n`Env Vars + Keypairs`"]
C4["SFTP Client\n`Upload / Download / Resume`"]
C5["Metrics Collector\n`CPU / RAM / Disk / Docker`"]
end
subgraph Remote["🐧 Remote Linux Server"]
D1["Remote Shell / PTY"]
D2["Linux System (/proc, df, ps)"]
D3["Docker Daemon"]
D4["Remote Filesystem"]
end
AI --> CLI
CLI --> Core
Core -->|Encrypted SSH2| Remote
📦 3. Installation
From PyPI
pip install agentssh
From Source (Development)
git clone https://github.com/Its2Pawan/agentssh.git
cd agentssh
pip install -e ".[dev]"
🚀 4. How to Use (Step-by-Step)
Step 1: 🏥 Health Check (doctor)
Verify your environment, permissions, and dependencies in one second:
agentssh doctor
Step 2: ➕ Add an SSH Connection Profile (add)
Save remote server connection parameters once under an easy alias:
# Production server with SSH private key
agentssh add production \
--host 192.168.1.100 \
--user root \
--port 22 \
--key ~/.ssh/id_ed25519 \
--alias prod
# Staging server with password in an environment variable
agentssh add staging \
--host 10.0.0.50 \
--user deploy \
--password-env STAGING_PASSWORD \
--policy accept-new
To list all configured profiles:
agentssh list
# Or in JSON:
agentssh list --json
Step 3: ⚡ Execute Remote Commands (exec)
Execute commands without an interactive shell, capturing stdout, stderr, and exit codes:
# Human-readable output
agentssh exec production "uptime"
# Machine-readable JSON output for AI Agents
agentssh exec production "docker ps" --json
JSON Output Example:
{
"success": true,
"action": "exec",
"exit_code": 0,
"data": {
"command": "docker ps",
"exit_code": 0,
"stdout": "CONTAINER ID IMAGE STATUS\n8f3c7e492a10 nginx:alpine Up 3 hours\n",
"stderr": "",
"duration_ms": 22.4,
"timed_out": false,
"profile": "production"
},
"error": null,
"timestamp": "2026-11-22T09:50:00.000000+00:00"
}
Step 4: 📊 Server Monitoring (stats, processes, docker)
Instantly monitor servers without installing any daemon or software on the remote server:
# Full server stats (CPU, RAM, Disks, Uptime, Load)
agentssh stats production --json
# Top running processes sorted by CPU or Memory
agentssh processes production --limit 10 --sort cpu
# Inspect Docker containers
agentssh docker ps production --all --json
Step 5: 📁 SFTP Remote File Manager (upload, download, ls, rm)
# Upload a file
agentssh upload production ./app.py /root/app.py
# Upload a whole directory recursively
agentssh upload production ./dist /var/www/html --recursive
# Download remote logs with transfer speed & progress
agentssh download production /var/log/syslog ./syslog
# List remote files in table or JSON
agentssh ls production /var/www/html --json
# Remote directory and file operations
agentssh mkdir production /root/my-project
agentssh rm production /root/old-file.txt
agentssh rename production /root/old.txt /root/new.txt
Step 6: 💻 Interactive Terminal Shell (shell)
For human operators requiring full interactive access:
agentssh shell production
- Full PTY allocation (
xterm-256color) - Real-time window resizing (
SIGWINCH) - Keyboard forwarding & Ctrl+C trapping
- Clean terminal restoration on exit
Step 7: 🔑 SSH Keypair Generator (keys)
Generate modern, hardened SSH keys with strict 0600 permissions and install them remotely:
# Generate Ed25519 keypair
agentssh keys generate ~/.agentssh/keys/id_ed25519 --type ed25519
# Copy public key to remote authorized_keys
agentssh keys copy-id production
Step 8: 📜 Execution History & Audit Log (history)
Every executed command is audited in SQLite (~/.agentssh/history.db):
agentssh history --limit 20
🤖 5. AI Agent Quick Integration
🔹 Claude Code
Add to .claude/config.json:
{
"system_prompt": "When managing remote servers, use `agentssh` in JSON mode: `agentssh <subcommand> <profile> --json`. Inspect `data.stdout` and `exit_code`."
}
🔹 Google Antigravity
In .gemini/rules/agentssh.md:
## Remote Operations
- Always invoke AgentSSH with `--json`.
- Non-zero exit codes signify remote errors.
- For remote inspection without installing software, use `agentssh stats <target> --json`.
🔹 Cursor Agent
In .cursorrules:
When managing remote servers:
1. Use `agentssh` CLI commands with `--json`.
2. Inspect `agentssh stats <target> --json` before running heavy builds.
🔹 Model Context Protocol (MCP) Server
Launch native MCP stdio server:
agentssh --mcp
📋 6. Full Command Cheat Sheet
| Icon | Command | Description | Example |
|---|---|---|---|
| ➕ | add |
Add an SSH profile | agentssh add prod --host 10.0.0.1 --user root |
| ➖ | remove |
Remove an SSH profile | agentssh remove prod |
| ✏️ | edit |
Update existing profile | agentssh edit prod --port 2222 |
| 📋 | list |
List saved profiles | agentssh list [--json] |
| 🔌 | connect |
Test connection & latency | agentssh connect prod --check [--json] |
| ⚡ | exec |
Execute remote command | agentssh exec prod "uptime" [--json] |
| 💻 | shell |
Open interactive terminal | agentssh shell prod |
| ⬆️ | upload |
SFTP upload (file/folder) | agentssh upload prod ./src /var/www -r |
| ⬇️ | download |
SFTP download (file/folder) | agentssh download prod /var/log ./logs -r |
| 📂 | ls |
List remote directory | agentssh ls prod /root [--json] |
| 📁 | mkdir |
Create remote directory | agentssh mkdir prod /root/data -p |
| 🗑️ | rm |
Delete remote file/folder | agentssh rm prod /root/old -r |
| 🔄 | rename |
Rename remote file | agentssh rename prod /root/a /root/b |
| 📊 | stats |
System stats (CPU/RAM/Disk) | agentssh stats prod [--json] |
| 📈 | processes |
List remote processes | agentssh processes prod --limit 20 |
| 🐳 | docker ps |
List Docker containers | agentssh docker ps prod --all [--json] |
| ⏱️ | history |
Command audit log | agentssh history --limit 50 [--json] |
| 🔑 | keys |
Manage SSH keys | agentssh keys generate |
| 🏥 | doctor |
Health & permissions check | agentssh doctor |
| 📖 | guide |
Agent integration guide | agentssh guide [agent] |
| ℹ️ | version |
Version & brand info | agentssh version [--json] |
🛡️ 7. Security Hardening
- 🔒 Strict Host-Key Verification: Enabled by default to block Man-in-the-Middle attacks.
- 🔒 File Permissions Protection: Config directory enforced to
0700, files and keys to0600. - 🔒 Zero Plaintext Password Storage: Passwords resolved exclusively from environment variables or secure prompts.
- 🔒 Local Audit Trail: Persistent SQLite log tracking execution history.
🧪 8. Automated Tests
pytest -v
34 / 34 Tests Passing (100% Success Rate)
👨💻 9. Brand & License
Developed with precision by Its2Pawan.
Licensed under the MIT License.
Metadata
Release files for agentssh 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agentssh-1.0.0.tar.gz | 55.5 kB | Without provenance | Details for agentssh-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentssh-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for agentssh-1.0.0-py3-none-any.whl |
Total release size: 113.1 kB
Release files / agentssh-1.0.0.tar.gz
| Download URL | agentssh-1.0.0.tar.gz |
|---|---|
| Size | 55.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74af387f37ea5c296ca20b68b62f6e34cb44937b3f3d5307d0de420f6a83e10d
|
|
BLAKE2b-256 checksum How to use checksums |
af08c57a8819aad4abf3654b3f646cffe3453bc3c7c2df4341666692f12dd023
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / agentssh-1.0.0-py3-none-any.whl
| Download URL | agentssh-1.0.0-py3-none-any.whl |
|---|---|
| Size | 57.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b20749f0449a70468cf75347623e35dd19caca58d3bf51f69eb0050dc2cf8fd5
|
|
BLAKE2b-256 checksum How to use checksums |
2397e4eeadbec410a8d28655246794c1b9f34366deaaec463b984453f94d7943
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Security for agentssh 1.0.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.