Connect AI agents to LUI Android devices — 78 tools, MCP protocol, bidirectional communication
Project description
lui-bridge
Connect AI agents to LUI Android devices. 78 phone tools, MCP protocol, bidirectional communication.
Install
pip install lui-bridge
CLI
# Connect as an agent (interactive — receives instructions from phone)
lui bridge connect --url ws://PHONE_IP:8765 --token TOKEN --agent my-bot --mode echo
# Connect with Hermes as the backend
lui bridge connect --url ws://PHONE_IP:8765 --token TOKEN --agent hermes --mode hermes
# Connect with Claude Code as the backend
lui bridge connect --url ws://PHONE_IP:8765 --token TOKEN --agent claude-code --mode claude-code
# List all available tools on the phone
lui bridge tools --url ws://PHONE_IP:8765 --token TOKEN
# Call a single tool
lui bridge call --url ws://PHONE_IP:8765 --token TOKEN --tool battery
lui bridge call --url ws://PHONE_IP:8765 --token TOKEN --tool get_location
lui bridge call --url ws://PHONE_IP:8765 --token TOKEN --tool toggle_flashlight --args '{"state":"on"}'
# Check device status
lui bridge status --url ws://PHONE_IP:8765 --token TOKEN
# Start a relay server (for remote access beyond LAN)
lui relay start --port 9000
Python API
from lui import LuiBridge
# Connect to phone
bridge = LuiBridge("ws://PHONE_IP:8765", "YOUR_TOKEN")
bridge.connect() # returns tool count
# Call tools
print(bridge.call_tool("battery")) # "Battery is at 73%, not charging."
print(bridge.call_tool("get_location")) # "You're at 123 Main St..."
print(bridge.call_tool("get_time")) # "It's 3:42 PM."
print(bridge.call_tool("read_notifications")) # "Slack: new message..."
print(bridge.call_tool("wifi_info")) # "Connected to MyWifi (5GHz, 702 Mbps)"
# Control the phone
bridge.call_tool("toggle_flashlight", {"state": "on"})
bridge.call_tool("set_volume", {"direction": "up"})
bridge.call_tool("send_sms", {"number": "Mom", "message": "On my way"})
bridge.call_tool("navigate", {"destination": "the airport"})
bridge.call_tool("open_app_search", {"app": "Spotify", "query": "Despacito"})
# Vision — trigger camera or gallery remotely
bridge.call_tool("take_photo") # captures photo via Camera2 API
bridge.call_tool("pick_image") # opens gallery picker on phone
bridge.call_tool("analyze_image") # describe what's in the last captured/selected image
# Get device state
print(bridge.get_device_state())
# Time: 3:42 PM
# Battery: 73%
# Network: Wi-Fi
# ...
# List tools
for name in bridge.list_tools():
print(name)
bridge.disconnect()
Bidirectional Agent
Register as a named agent so the phone user can send you instructions:
from lui import LuiBridge
def handle_instruction(instruction):
"""Called when user says 'tell my-bot to ...' on the phone."""
print(f"Got: {instruction}")
# Process the instruction with your agent logic
return "Done!"
def handle_event(event_type, data):
"""Called for phone events (notifications, calls, 2FA codes)."""
if event_type == "notification_2fa":
print(f"2FA code: {data['code']}")
elif event_type == "notification":
print(f"Notification: {data['title']}")
bridge = LuiBridge(
url="ws://PHONE_IP:8765",
token="YOUR_TOKEN",
agent_name="my-bot",
on_instruction=handle_instruction,
on_event=handle_event
)
bridge.connect()
print("Listening...")
# On the phone, user can say:
# "patch me to my-bot" → enters direct chat mode
# "@my-bot deploy" → sends one-off instruction
# "tell my-bot to run tests" → LLM forwards instruction
while bridge.connected:
time.sleep(1)
Relay Server
For access beyond the local network:
# Start relay
lui relay start --port 9000
# Phone connects to relay (configure in LUI Connection Hub)
# Agent connects via relay
lui bridge connect --url ws://RELAY_HOST:9000/agent?device_token=TOKEN --token TOKEN --agent my-bot
Requirements
- Python 3.9+
- A phone running LUI with the BYOS bridge enabled
- Phone and agent on the same Wi-Fi (or use relay for remote)
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
lui_bridge-0.2.0.tar.gz
(11.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lui_bridge-0.2.0.tar.gz.
File metadata
- Download URL: lui_bridge-0.2.0.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5743d960a28ddfdfb31e3c310196dc697283a09b64cdb04b1ae288c6649b5973
|
|
| MD5 |
92d5052ac2fd79a7c769408496665573
|
|
| BLAKE2b-256 |
9c95ac4ec9ab037ab5f36da750ee02dac48707dba675506d3966dbd8cf9288a0
|
File details
Details for the file lui_bridge-0.2.0-py3-none-any.whl.
File metadata
- Download URL: lui_bridge-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4d1dc3a5251ceb779ce1c45eb92811eab53df38e1f83233817d5809c469e30a
|
|
| MD5 |
9e5c9c288176b83c1937cfbc267a8732
|
|
| BLAKE2b-256 |
31349ffb6f094096bfbe8c3df607d70860c72cb65b00ad2b4fa81f5f5773c414
|