Skip to content

android: compact UI tree for agents #351

Closed

Description

@ElbertePlinio

Part of #350.

Problem

android_get_ui_tree returns the raw uiautomator dump XML. A busy screen costs thousands of tokens, and most nodes carry nothing the agent can read or act on. Agents then skip the tree and guess from screenshots.

Acceptance criteria

  • The default output is a compact tree. It keeps the hierarchy, actionable ancestors, and every node with text, a label or a resource id. Raw XML stays available as an option.
  • Bounds stay in pixels for taps, and the output reports the screen density so dp can be derived.
  • The output has an explicit size limit and says when it truncates.
  • Fixtures from Android Settings, a Flutter app and a Compose app keep their actionable labels and hierarchy. The PR records token counts before and after.
  • An empty tree is reported as empty. The output does not claim the window is secure.

Checklist

  • Compare the snapshot modes in callstack/agent-device first. Reuse its approach, or wrap its CLI only if serial selection, install and session isolation fit.
  • Compact format and size limit
  • Fixtures and token measurements
  • Tool description and docs

Out of scope: ref-based taps. File them as a follow-up if agents need them.

Activity

  1. added
    enhancement
    on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions