An autonomous AI terminal agent for Android that writes code, manages files, and executes shell commands inside Termux. It requires less than 50 MB of memory, providing lightweight agentic workflow on your phone.
Python
0
7 commits
updated Oct 6, 2026
An autonomous AI terminal agent for Android that writes code, manages files, and runs shell commands automatically directly inside Termux. Built specifically to run on 32-bit (armv7l) phones as well as modern 64-bit devices. It requires less than 50 MB of memory, providing lightweight agentic workflow on your phone.
This agent connects directly to the Google Gemini API using only Python's built-in standard libraries. It turns an old or spare Android device into an autonomous programming assistant: describe a task, and the agent writes the code, inspects errors, executes shell commands, and loops automatically until the job is done—all with an interactive (y/n) safety prompt before running any command on your device.
Before getting started, make sure you have:
Choose the right version for your device:
Termux_32bit.apk directly from this repository: https://github.com/termux/termux-app/releases/download/v0.118.1/termux-app_v0.118.1+github-debug_armeabi-v7a.apkOpen the Termux app and run these commands to update package lists and install Git and Python:
pkg update -y && pkg install git python -y
Clone this repository and enter the project folder:
git clone https://github.com/netizen4-bit/agent042.git
cd agent042
⚠️ IMPORTANT: Avoid Billing Account Errors
When creating your key, do not attach a Google Cloud billing account. Projects with depleted prepaid balances will trigger a 402 Payment Required error. A fresh project with no billing attached gives you access to the permanent free tier (1,500 free requests per day).
termux-agent).Export your API key into Termux and start the agent:
export GEMINI_API_KEY="paste_your_api_key_here"
python3 agent.py
Once running, type your request. The agent will respond, generate code, and prompt for confirmation before running any shell commands on your phone.
agent042/
├── agent.py # The core autonomous execution loop (pure Python standard library)
├── Termux_32bit.apk # Offline bundled 32-bit Termux installer for legacy devices
├── README.md # Documentation and setup guide
└── LICENSE # MIT License
The agent is designed to understand natural language instructions and translate them into shell commands and scripts.
The agent wraps all terminal commands in <cmd>...</cmd> tags. Before any command executes, you will see:
[Agent wants to run: uname -m] Allow? (y/n)
y to approve the command and automatically pass the terminal output back to Gemini.n to decline the command. The agent will adapt its strategy or ask for alternative instructions.Distributed under the MIT License. See LICENSE for more information.
If this agent saves you time, and if you use my other open-source workflow tools, consider supporting the development. Your backing helps keep these small AI tools projects completely free.
An autonomous AI terminal agent for Android that writes code, manages files, and executes shell commands inside Termux. It requires less than 50 MB of memory, providing lightweight agentic workflow on your phone.
Python
0
7 commits
updated Oct 6, 2026
An autonomous AI terminal agent for Android that writes code, manages files, and runs shell commands automatically directly inside Termux. Built specifically to run on 32-bit (armv7l) phones as well as modern 64-bit devices. It requires less than 50 MB of memory, providing lightweight agentic workflow on your phone.
This agent connects directly to the Google Gemini API using only Python's built-in standard libraries. It turns an old or spare Android device into an autonomous programming assistant: describe a task, and the agent writes the code, inspects errors, executes shell commands, and loops automatically until the job is done—all with an interactive (y/n) safety prompt before running any command on your device.
Before getting started, make sure you have:
Choose the right version for your device:
Termux_32bit.apk directly from this repository: https://github.com/termux/termux-app/releases/download/v0.118.1/termux-app_v0.118.1+github-debug_armeabi-v7a.apkOpen the Termux app and run these commands to update package lists and install Git and Python:
pkg update -y && pkg install git python -y
Clone this repository and enter the project folder:
git clone https://github.com/netizen4-bit/agent042.git
cd agent042
⚠️ IMPORTANT: Avoid Billing Account Errors
When creating your key, do not attach a Google Cloud billing account. Projects with depleted prepaid balances will trigger a 402 Payment Required error. A fresh project with no billing attached gives you access to the permanent free tier (1,500 free requests per day).
termux-agent).Export your API key into Termux and start the agent:
export GEMINI_API_KEY="paste_your_api_key_here"
python3 agent.py
Once running, type your request. The agent will respond, generate code, and prompt for confirmation before running any shell commands on your phone.
agent042/
├── agent.py # The core autonomous execution loop (pure Python standard library)
├── Termux_32bit.apk # Offline bundled 32-bit Termux installer for legacy devices
├── README.md # Documentation and setup guide
└── LICENSE # MIT License
The agent is designed to understand natural language instructions and translate them into shell commands and scripts.
The agent wraps all terminal commands in <cmd>...</cmd> tags. Before any command executes, you will see:
[Agent wants to run: uname -m] Allow? (y/n)
y to approve the command and automatically pass the terminal output back to Gemini.n to decline the command. The agent will adapt its strategy or ask for alternative instructions.Distributed under the MIT License. See LICENSE for more information.
If this agent saves you time, and if you use my other open-source workflow tools, consider supporting the development. Your backing helps keep these small AI tools projects completely free.