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.1.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.1.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ai_systemassist-0.1.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.1.0.tar.gz
Algorithm Hash digest
SHA256 2950a4fe91513d4a5fbbde0acba8f3709fe4a558c796d7d4eb204c47b5363d7e
MD5 5bbb3a8af5db24de5506629bb902cef7
BLAKE2b-256 432f267f39111d1e7e5b6011ea715cb4acd49cc25f4ca30582dd779995093748

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ai_systemassist-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 75b4e2896ae2ee453c4cae1f15e5d98970ecaf419bb060a8194eb1336342228f
MD5 c9881f850af2d4a09d048217c8917f19
BLAKE2b-256 1d7e07034631666861110a733d8f7347e3be0af61689844258b8d537f5c0ab8b

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