Sign In

@codmir/agent-mobile-sdk

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codmir/agent-mobile-sdk

Device-as-a-tool SDK — let AI agents control mobile apps via Socket.IO

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

@codmir/agent-mobile-sdk

Device-as-a-tool — Let AI agents control mobile apps.

The first SDK that lets an AI agent running on your server reach into a user's phone and perform actions: navigate screens, fill forms, press buttons, read content, trigger calls. The inverse of how mobile apps work today.

Install

npm install @codmir/agent-mobile-sdk

Quick Start

Mobile Client (React Native)

import { MobileAgentBridge, ALL_PRESETS } from "@codmir/agent-mobile-sdk/react-native";
import { io } from "socket.io-client";
import { Alert } from "react-native";
import { router } from "expo-router";

const bridge = new MobileAgentBridge({
  serverUrl: "https://your-server.com",
  authToken: "user-jwt-token",
  projectId: "project-123",

  // User sees a prompt before dangerous actions execute
  onApprovalRequired: async (request) => {
    return new Promise((resolve) => {
      Alert.alert(
        "AI wants to act",
        `${request.description}\n\n${JSON.stringify(request.params)}`,
        [
          { text: "Deny", onPress: () => resolve(false) },
          { text: "Allow", onPress: () => resolve(true) },
        ]
      );
    });
  },
});

// Register action handlers
bridge
  .registerAction(ALL_PRESETS[0], async (params) => {
    // NAVIGATE
    router.push(params.route as string);
    return { navigated: true };
  })
  .registerAction(ALL_PRESETS[1], async (params) => {
    // FILL_FIELD — your app state management fills the field
    return { filled: true };
  })
  .registerAction(ALL_PRESETS[3], async () => {
    // READ_SCREEN — return current screen state
    return {
      route: "/project/123/tasks",
      fields: [],
      buttons: [{ id: "create-task", label: "Create Task", enabled: true }],
    };
  });

// Connect to workroom
await bridge.connect(io);

Server Side (NestJS / Node.js)

import {
  createMobileActionTool,
  createReadScreenTool,
} from "@codmir/agent-mobile-sdk/server";

// Register as tools in your agent's tool registry
const tools = [
  createMobileActionTool(),
  createReadScreenTool(),
  // ... your other tools
];

// When the agent calls mobile_action, forward to the connected device
socket.emit("mobile:command", {
  id: crypto.randomUUID(),
  type: "navigate",
  params: { route: "/project/123/tasks" },
  timestamp: Date.now(),
});

// Listen for results
socket.on("mobile:result", (result) => {
  // Feed back to the agent's tool_use response
  console.log(result.success, result.data);
});

Architecture

┌──────────────────┐     Socket.IO      ┌──────────────────┐
│   AI Workroom    │◄──────────────────►│   Mobile App     │
│                  │                     │                  │
│  Agent calls     │  mobile:command     │  Bridge receives │
│  mobile_action   │────────────────────►│  & executes      │
│                  │                     │                  │
│  Agent reads     │  mobile:result      │  Handler returns │
│  tool result     │◄────────────────────│  result          │
│                  │                     │                  │
│                  │  mobile:read_screen │  Screen reader   │
│                  │────────────────────►│  returns state   │
│                  │  mobile:screen_state│                  │
│                  │◄────────────────────│                  │
└──────────────────┘                     └──────────────────┘

Action Types

ActionDangerDescription
navigatesafeNavigate to a screen
fill_fieldsafeFill a text input
press_buttonconfirmPress a button (prompts user)
read_screensafeRead current screen state
scrollsafeScroll the view
show_notificationsafeShow a local notification
trigger_callconfirmJoin a voice room
set_statussafeUpdate online status
customvariesApp-specific actions

Danger Levels

  • safe — Executes immediately, no user prompt
  • confirm — Shows approval dialog on device before executing
  • dangerous — Requires explicit user confirmation with action details

Custom Actions

bridge.registerAction(
  {
    type: "custom",
    description: "Create a new task in the current project",
    danger: "confirm",
    params: {
      title: { type: "string", required: true },
      priority: { type: "string", enum: ["low", "medium", "high"] },
    },
  },
  async (params) => {
    const task = await createTask(params.title, params.priority);
    return { taskId: task.id };
  }
);

What Can the AI Do?

The user says to the AI workroom:

"Create a task called 'Fix login bug' with high priority in the mobile app"

The agent:

  • Calls mobile_read_screen → sees user is on the project dashboard
  • Calls mobile_action({ action: "navigate", params: { route: "/tasks/new" } })
  • Calls mobile_action({ action: "fill_field", params: { fieldId: "title", value: "Fix login bug" } })
  • Calls mobile_action({ action: "select", params: { fieldId: "priority", value: "high" } })
  • Calls mobile_action({ action: "press_button", params: { buttonId: "create" } }) → user sees approval prompt → approves
  • Task created.

License

Apache-2.0

Keywords

ai

FAQs

Package last updated on 31 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts