Skip to main content

A simple HTTP server that lets AI agents (or curl) send shell commands to be executed with elevated privileges and receive the output.

Project description

AI-SystemAssist

A tiny, easy-to-use HTTP server that lets AI agents (or humans with curl/wget) send shell commands to be executed on the machine and receive the output back.

Intended use: Give an LLM / agent the ability to run commands on a machine over HTTP and get results.

⚠️ SECURITY WARNING

  • This server executes arbitrary shell commands.
  • Run it only on machines you control.
  • Default binding is 127.0.0.1 (localhost only).
  • Always use a strong auth token.
  • To execute commands as root/admin, start the server with sudo.
  • Do not expose this on the public internet without strong additional protections (VPN, firewall, TLS reverse proxy, etc.).

Installation

From the source directory (development):

pip install -e .

Or build & install:

pip install .

Quick Start

# Start the server (will generate a token if none provided)
sudo ai-systemassist

# Or with explicit token and options
AI_SYSTEMASSIST_TOKEN=my-super-secret-token ai-systemassist --host 127.0.0.1 --port 8765

Environment variables (also supported):

  • AI_SYSTEMASSIST_TOKEN
  • AI_SYSTEMASSIST_HOST
  • AI_SYSTEMASSIST_PORT

Usage from curl / wget (very easy)

1. With generated or provided token

TOKEN="your-token-here"

# Simple - raw POST body is treated as the command
curl -X POST -d 'whoami && id' \
  -H "X-Agent-Token: $TOKEN" \
  http://127.0.0.1:8765/execute

# JSON body (recommended for complex cases)
curl -X POST \
  -H "Content-Type: application/json" \
  -H "X-Agent-Token: $TOKEN" \
  -d '{"command": "ls -la /", "timeout": 30}' \
  http://127.0.0.1:8765/execute

# Query param (quick and dirty - visible in logs)
curl "http://127.0.0.1:8765/execute?token=$TOKEN&cmd=uptime"

2. Example response

{
  "command": "whoami && id",
  "success": true,
  "returncode": 0,
  "stdout": "root\nuid=0(root) gid=0(root) groups=0(root)\n",
  "stderr": "",
  "duration": 0.012
}

Using wget

wget -qO- --post-data='ls -l' \
  --header="X-Agent-Token: $TOKEN" \
  http://127.0.0.1:8765/execute

Endpoints

Endpoint Method Description
/execute POST Run a command. Auth required.
/execute GET Same as POST (useful for simple queries)
/health GET Basic health + version info
/ GET API information + examples

Request formats supported on /execute

  • JSON: { "command": "ls", "timeout": 30, "cwd": "/tmp" }
  • Form: command=ls or cmd=ls
  • Raw body: echo hello | cat
  • Query params: ?cmd=ls&token=...

Auth can be sent as:

  • Header: X-Agent-Token: xxx
  • Header: Authorization: Bearer xxx
  • Header: X-Auth-Token: xxx
  • Query: ?token=xxx

Running as Admin / Root

sudo ai-systemassist --token "super-secret"
# or
sudo -E ai-systemassist   # preserves env vars including AI_SYSTEMASSIST_TOKEN

All commands will then run as root.

Configuration / CLI

ai-systemassist --help

Options:

  • --host, --port
  • --token
  • --allow-cors

Python usage (advanced)

from ai_systemassist.server import create_app, run_server

app = create_app(auth_token="mytoken")
# then run with your own WSGI server if desired (gunicorn, waitress, etc.)

Development

pip install -e ".[dev]"

For AI Agents

See AGENTS.md for detailed instructions written specifically for AI agents and LLMs on how to use this tool effectively (authentication, request formats, response handling, best practices, and safety guidelines).

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_systemassist-0.2.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_systemassist-0.2.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file ai_systemassist-0.2.0.tar.gz.

File metadata

  • Download URL: ai_systemassist-0.2.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ai_systemassist-0.2.0.tar.gz
Algorithm Hash digest
SHA256 32324136da54a0837cdafba0a99da0f6ff17528a4ca6532616460df7302f4381
MD5 3e12c1383d2402736443091fb58f0ba0
BLAKE2b-256 ba984ddd70f4caa32b4d81f09e9d1776905f2adc9871d8fd1f59cec376671f36

See more details on using hashes here.

File details

Details for the file ai_systemassist-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ai_systemassist-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cdc3d31c65327f4db408dbe6f56e7523e714e11bab9e94ed47242d296a9b1f1f
MD5 6cb04a6183d721583691f3c1e0f9bb1b
BLAKE2b-256 881319120440a9d1a699fee1d647e9479ddb70a2d076a71dc04b86cd0d0602af

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page