Skip to main content

Connect AI agents to LUI Android devices — 106 tools, MCP protocol, bidirectional communication

Project description

lui-bridge

Connect AI agents to LUI Android devices. 106 phone tools (including health ring + wellness mode), 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

# Health ring (Colmi R09) — requires ring connected via Connection Hub
bridge.call_tool("get_heart_rate")            # live heart rate from ring
bridge.call_tool("get_spo2")                  # blood oxygen level
bridge.call_tool("get_stress")                # stress level (0-100)
bridge.call_tool("get_health_summary")        # all vitals in one call
bridge.call_tool("get_health_trend", {"metric": "stress", "hours": "24"})  # 24h trend

# Wellness — ambient sounds + wellness mode
bridge.call_tool("play_relaxing_sound", {"type": "rain"})   # rain, ocean, forest, piano, etc.
bridge.call_tool("start_wellness_mode")       # sound + DND + dim (auto-picks by time/stress)
bridge.call_tool("stop_wellness_mode")        # restores prior state

# 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 wss://RELAY_HOST/agent --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.4.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

lui_bridge-0.4.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file lui_bridge-0.4.0.tar.gz.

File metadata

  • Download URL: lui_bridge-0.4.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for lui_bridge-0.4.0.tar.gz
Algorithm Hash digest
SHA256 538285bbd4f0e04ead9d9a43e7f773c2123c6bc1439518aff0584ed913c79039
MD5 b850d1ecba02ab450e5ae288a64857ba
BLAKE2b-256 99c6e3b6c1dd38383856aaa86b43933b3fd3ec861d4a5ff97b376b7b11562e7b

See more details on using hashes here.

File details

Details for the file lui_bridge-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: lui_bridge-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for lui_bridge-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bd534726e9c11c10df23c6bd248ec5b58de385d128f28c7321e27c84046c03ef
MD5 14a239f0c37417214fcece9994f9876b
BLAKE2b-256 6ad36694542855ffcfec3d173045d0d16f84f2c6ea1e2732b858fb42921dcfc0

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