How to Deploy Hermes Agent on an Old Android Phone for a 24/7 Private AI Assistant

This guide shows how to turn an idle Android phone into a low-cost, always-on private AI assistant. The core capabilities include local Hermes Agent deployment in Termux, remote maintenance over SSH, self-healing after disconnects, and Feishu message integration. It addresses three common pain points: high server costs, unused legacy devices, and the difficulty of operating mobile-side infrastructure. Keywords: Termux, Hermes Agent, Feishu Bot.

This setup turns an old phone into a low-cost always-on AI node

Parameter Details
Runtime Platform Android + Termux
Primary Languages Python / Shell
Access Protocols SSH, HTTP API, Feishu Bot
Core Dependencies openssh, python, git, rust, nodejs
Deployment Mode Local runtime + background watchdog
Code Source NousResearch/hermes-agent
GitHub Stars Not provided in the source; refer to the live GitHub page

The value of an old Android phone is not raw performance, but persistent uptime. As long as it can reliably run Termux, SSH, and a Python environment, it can serve as a lightweight agent node, message gateway, and entry point for a personal assistant.

The core design is straightforward: the phone runs Hermes Agent, the computer handles remote operations, Feishu provides the messaging interface, and watchdog scripts keep processes alive. Even without a cloud server, you can still get a near-24/7 AI service.

Start by initializing Termux and remote maintenance access

When installing Termux, prefer the GitHub release page over app store versions. Store builds often suffer from outdated package management, failed updates, or incomplete compatibility.

Image

AI Visual Insight: The image shows the completed Termux installation screen on an Android device, confirming that a local Linux user-space environment is available and ready for package management, SSH services, and Python project deployment.

pkg install openssh -y
passwd                 # Set the Termux login password
sshd                   # Start the SSH service
ifconfig               # View the phone's LAN IP address

These commands open a remote maintenance entry point on the phone so that all remaining steps can be completed from a PC.

Once the computer and phone are on the same local network, connect to Termux over SSH using the default port 8022.

ssh 手机用户名@手机IP -p 8022

This command lets you securely take over the phone terminal from your computer, greatly reducing the friction of typing Linux commands on a mobile device.

Hermes Agent requires a complete Termux dependency chain before it can run

Before installing Hermes, update the package sources and prepare the build and runtime dependencies. Using a nearby mirror can significantly reduce package fetch failures.

sed -i 's|deb https://packages.termux.org/apt/termux-main|deb https://mirrors.tuna.tsinghua.edu.cn/termux/apt/termux-main|g' $PREFIX/etc/apt/sources.list
pkg update && pkg upgrade -y
pkg install python git pip nano clang make libffi openssl nodejs -y

This step upgrades the base Termux environment and installs the Python runtime, toolchain, and Node dependencies required by Hermes.

Next, clone the Hermes Agent repository and create a virtual environment. The source project referenced here is NousResearch/hermes-agent.

git clone https://github.com/NousResearch/hermes-agent.git
cd hermes-agent
python -m venv .venv
source .venv/bin/activate
pip install -e '.[termux]'

These commands perform a standard Hermes installation and isolate dependencies inside a virtual environment, making rollback and reinstallation easier.

Missing Rust is the most common installation failure on older Android devices

If installation fails around jiter, maturin, or Rust target-related errors, the root cause is usually a missing Rust toolchain in Termux.

Image

AI Visual Insight: The image corresponds to the post-failure recovery flow and highlights a missing Rust toolchain. This issue is commonly triggered by Python packages with native extensions, especially on Android aarch64 environments.

pkg install rust -y
pip install -U pip setuptools wheel
pip install -e '.[termux]' --no-build-isolation

These recovery commands add the Rust build toolchain and reduce installation failures caused by build isolation.

If that still fails, fall back to the simplified “run from source” path and install only the required Python packages:

cd ~
rm -rf hermes-agent
git clone https://github.com/NousResearch/hermes-agent.git
cd hermes-agent
pip install openai==1.28.0 python-dotenv==1.0.1 --only-binary :all:

This approach lowers the failure rate on older devices by skipping the full editable installation and avoiding more complex dependency builds.

A successful Hermes startup does not mean inference is configured

After installation, first verify that the CLI starts correctly.

python cli.py chat

This command confirms that the Hermes main program, virtual environment, and dependency chain are working correctly.

If you see No inference provider configured, the program itself is runnable, but no model provider or API key has been configured yet. Run the model setup wizard next.

hermes model

This step selects the model provider and writes the inference configuration. It is the key transition from “it runs” to “it can chat.”

Long-term stability depends on dual watchdogs for SSH and the gateway

Screen lock, battery optimization, and system cleanup on Android can kill background processes, so keepalive scripts are required. First protect SSH, then protect the Hermes gateway.

cat > ~/keep-sshd.sh << 'EOF'
#!/data/data/com.termux/files/usr/bin/bash
while true; do
  if ! pgrep -x sshd > /dev/null; then
    sshd  # Restart SSH automatically if the system kills it
  fi
  sleep 30
done
EOF
chmod +x ~/keep-sshd.sh
nohup bash ~/keep-sshd.sh > /dev/null 2>&1 &

This script checks the SSH service every 30 seconds to prevent losing remote access after the phone screen turns off.

Now configure a background watchdog for the Hermes gateway:

cat > ~/watch-hermes.sh << 'EOF'
#!/data/data/com.termux/files/usr/bin/sh
while true; do
  if ! pgrep -f "hermes gateway" > /dev/null; then
    nohup hermes gateway > /dev/null 2>&1 &  # Restart the gateway automatically after an unexpected exit
  fi
  sleep 30
done
EOF
chmod +x ~/watch-hermes.sh
nohup bash ~/watch-hermes.sh > /dev/null 2>&1 &

This script continuously monitors the Feishu gateway process and restores the message channel automatically if it exits unexpectedly.

Feishu integration gives the local agent a usable messaging interface

The key Feishu steps are: create an internal enterprise app, configure the bot, grant message permissions, obtain the App ID and App Secret, and then run the gateway setup wizard on the phone.

Image

AI Visual Insight: The image shows the entry point for creating an internal app in the Feishu Open Platform. This is the first step in bot integration, and all later permissions, credentials, and message events depend on this app.

hermes gateway setup
cat ~/.hermes/.env      # Verify that the configuration was written successfully
pip install lark-oapi   # Install the missing gateway dependency if needed
hermes gateway

These commands initialize the Feishu gateway, verify environment variables, repair missing dependencies, and launch the service.

If the hermes command is not directly available, add it to your PATH:

echo 'export PATH="$HOME/hermes-agent:$PATH"' >> ~/.bashrc
source ~/.bashrc

This configuration ensures the current shell session can resolve the Hermes executable entry point.

The main strength of this architecture is that low cost and maintainability coexist

Its biggest value is not replacing a production server, but turning scattered hardware into a continuously available AI endpoint for learning, testing, and private assistant scenarios. It is especially friendly for solo developers, independent researchers, and lightweight productivity workflows.

Its limitations are equally clear: older devices have limited performance, so complex inference still depends primarily on cloud model APIs; Android background behavior varies widely by vendor, so stability depends heavily on battery optimization whitelists and keepalive settings; and public connectivity still relies more on third-party messaging platforms than on directly exposing services from the phone itself.

FAQ

1. Why does Hermes start successfully but still cannot chat?

Because a successful Hermes startup only means the runtime environment is healthy. It does not mean a model has been configured. If you see No inference provider configured, run hermes model and provide your API key.

2. Why does Termux keep showing Rust-related dependency errors during installation?

A common reason is that some Python packages require native compilation, while older Android environments do not include Rust by default. Run pkg install rust -y first, then upgrade pip setuptools wheel, which usually resolves the issue.

3. How do I keep the Feishu bot online after the phone screen locks?

You need dual keepalive protection: one layer watches sshd so remote maintenance stays available, and another watches hermes gateway so the message channel restarts automatically. Also add Termux to the system battery optimization whitelist.

Core Summary: This article reconstructs a repeatable setup that uses an old Android phone, Termux, SSH keepalive scripts, and Hermes Agent to build a near-24/7 private AI assistant without a server, then connects it to Feishu for real-time conversations. It covers installation, dependency repair, model configuration, background watchdogs, and gateway integration.