Skip to main content

Connect AI agents to LUI Android devices — 78 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.3.1.tar.gz (12.7 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.3.1-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lui_bridge-0.3.1.tar.gz
  • Upload date:
  • Size: 12.7 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.3.1.tar.gz
Algorithm Hash digest
SHA256 25baa2e5ef3ef2ce55df6c8162ba1a5c87086426991f6d6ffe5c17acf00e29bb
MD5 5e0fa53536f2e2b1c654df57cec6e52e
BLAKE2b-256 a6bbeb64efd567d5809bc326a9232e8a032f708349c6d9f7a1b71d381544a759

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lui_bridge-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 11.7 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.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f67ef79008c7edd75bb94b0ac21935f582bd06c333683adddedd287dae6a9141
MD5 8b37225e20260c36ad74e9fc4dc671c2
BLAKE2b-256 828e242b36c2219599a9e82cfcd907906307cfffc6ca7bc365f5c2ae77fef3ad

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