Skip to main content

AutoControl

English | 繁體中文 | 简体中文

AutoControl is a Python framework for automating desktop applications. Control the mouse and keyboard, capture screens, and find interface elements with images, OCR or accessibility APIs. Use it from Python, JSON action files, the desktop GUI or an MCP client.

Get started

Requires Python 3.11 or later.

python -m pip install je_auto_control

Read the screen dimensions without sending input:

import je_auto_control as ac

print(ac.screen_size())

To use the desktop app:

python -m pip install "je_auto_control[gui]"
python -c "import je_auto_control; je_auto_control.start_autocontrol_gui()"

While the window is open, the app collects Python's cyclic garbage on the GUI thread, from a timer, with automatic collection switched off; it is switched back on when the app quits. This keeps a worker thread from reaching a Qt object that PySide6 6.12 would then delete late, which has aborted the process on Windows. Scripts that only import je_auto_control are unaffected.

What you can do

  • Automate mouse, keyboard and window operations.
  • Locate controls with image matching, OCR, accessibility APIs or optional vision models.
  • Save repeatable workflows as JSON action files.
  • Connect AI clients through MCP, or integrate through REST and Python.
  • Use recording, scheduling and remote-desktop tools through the optional GUI.

The TCP socket server (je_auto_control start-server, port 9938) now requires authentication. Each connection opens with AUTH <token> and is answered AUTH_OK before its command runs. The token is --token, else JE_AUTOCONTROL_SOCKET_TOKEN, else a random one written owner-only to ~/.je_auto_control/socket_server_<port>.token (--token-file changes it) and deleted when the server stops. Under RBAC only users' tokens are accepted: running actions needs drive_input and quit_server needs manage_hosts. A connection gets 10 seconds and 3 tries, and failures are rate-limited per address. ac.send_socket_command([["AC_screen_size"]]) reads the token and authenticates for you. An existing client must send the AUTH line first, or the server must be started with --no-auth, which logs a warning that any local process can then run any command. See integrations. The standalone driver (autocontrol_driver/) is no longer committed as a prebuilt binary: the Driver workflow builds it with Nuitka (one windowless AutoControlDriver.exe on Windows, one AutoControlDriver binary on Linux), checks that it refuses a command without the token, and attaches both to each GitHub release; python autocontrol_driver/build_driver.py builds it locally.

The Image Detection page runs matching in the background and owns its mouse-button selection. Its Actions menu can stop a pending search; closing the page discards late results and reopening resets its inputs. Cancellation prevents later move/click steps, but cannot interrupt a native call already in progress.

Auto Click, Record and Script Executor own their controls and background tasks. Closing them stops local work; reopening creates fresh inputs. The shared recorder continues after its page closes, and a reopened page reads backend status (unknown when unsupported). This status does not verify native hook health. Ctrl+4 still stops scripts and auto-clicking.

Of the three tabs open at start, only Record is built then; Script Builder and Remote Desktop are built the first time they are selected, which roughly halves start-up time and memory.

View → Execution details (Ctrl+Shift+D) opens a collapsible right pane. Diagnostics publishes its actual progress, stop, result and error state there, and so does every other page that runs work in the background (a model request, a USB listing, a broadcast, a DAG run, a journal read): running, stopping, then completed, cancelled or the error, with progress where the work reports it. A page that has run nothing yet says details are unavailable. A background stop that fails (a session, recorder or host a page let go of) is kept rather than only logged: Diagnostics lists each one with its error, and Actions › Retry failed stops runs them again under the authority they were queued with. Switching or closing a page disconnects its updates. Embedders can supply a TabRegistry to WorkspaceShell; AutoControlGUIWidget(parent) remains supported.

Every page opens with a title and a one-line description, groups its controls on cards, and draws check boxes and radio buttons in the theme's accent so they stay visible in the dark theme. Controls shrink with the window instead of forcing it wide: long drop-down entries no longer set a page's width, form labels move above their fields when both do not fit, and long notes wrap. An empty table, list or tree says Nothing to show yet until its first row arrives, instead of showing a blank grid. A banner under the page title says when the page's last run failed (the next run clears it) and, when the GUI runs inside an RBAC scope, which of the page's commands the active role cannot run; it has a Dismiss link. The window rearranges itself by width: from 1,200 px the navigation and the execution details sit beside the tabs; below that the details open as a drawer over them; below 800 px the navigation becomes a narrow rail, and its menu button or Ctrl+K opens the feature list as a drawer (Escape or a click beside it closes it). Hiding the navigation for width does not change the saved preference.

Under RBAC every tab checks the role before a privileged command, as the executor does, and says in the tab why one is refused; with RBAC off nothing changes. Token and secret fields of the remote-desktop, Quick Connect, WebRTC and REST pages are masked, with a Show toggle. Enter or Escape on the Quick Connect approval dialog denies the viewer. Vault commands, plugin loading, configuration export and import, audit-log reads, Data Source loads and Trace Replay frames run off the GUI thread, and Trace Replay refuses frame files outside the recording. So do the file and store operations of the DAG, Flow, Script Builder and Recording editors, Run History, Test Suites, Self-Healing, the REST users panel, USB ACL, the admin console and the remote-desktop trust list, address book and known hosts; each tab shows that it is busy and reports errors in place. Remote-desktop frames and result images are decoded on a thread of each view's own (the newest frame wins), and TLS certificates load on the connect or start worker.

WebRTC statistics polling starts in the background and discards late samples after it stops.

Windows, macOS, X11 and Wayland use different backends. Available features depend on system permissions and optional dependencies; Windows ARM64 has additional limitations. See the installation guide before choosing a deployment target.

Wayland NORMAL input runs libei and portal calls in an owned helper process. Timeouts, cancellation and uncertain replies retire that helper without replay or automatic provider fallback. The direct LibeiBackend API remains in-process. Helper retirement is not proof that a compositor released input; native acceptance remains pending.

Managed agent tasks and cross-host transfers include experimental features. See the implementation notes and project progress before relying on them in production.

Host-selected semantic targets support a semantic completion condition that compares fresh state with the recorded target identity and expected fields. It does not grant memory access or enable a native target. See semantic completion.

Documentation

License

MIT © JE-Chen. Third-party licenses.

Closing Remote Desktop releases its page. Reopening creates fresh controls without reattaching shared sessions. Registry TCP/WebSocket sessions remain available to scripts; page-owned WebRTC sessions and audio retire in the background. Pending approvals are denied, and late callbacks are discarded. A file transfer already sending stops at its next chunk when the page closes, the session is dropped or the upload is cancelled, and the host discards the partial file (TCP, WebSocket and WebRTC alike).

Remote-desktop hosts (TCP and WebSocket) keep connections that are still authenticating out of the max_clients viewer slots. max_pending_handshakes (default 8) caps how many may be authenticating at once, and more are refused at accept. auth_timeout (default 10 s, at most 60) covers TLS, the WebSocket upgrade and the challenge-response together, so a silent connection is dropped after 10 s instead of holding a slot for up to 60 s. A connection takes a viewer slot only after its credentials verify; if the slots fill while it is authenticating, its viewer gets AUTH_FAIL "host full". Both settings are accepted by RemoteDesktopHost, the registry's start_host / start_ws_host, AC_start_remote_host, AC_start_ws_host, ac_remote_host_start and the host tab's Advanced section. An H.264 viewer that falls behind now skips ahead to a fresh keyframe instead of decoding P-frames whose reference it missed; the host asks the encoder for that keyframe, at most once a second for the whole host. JPEG streams are unchanged.

WebRTC host/viewer stop() waits up to three seconds for software teardown. PeerStopPending retains the same running attempt; explicit retry waits on it. PeerStopFailed retains failed resources for explicit retry, and restarting is blocked until cleanup succeeds. Multi-viewer hosts retain failed sessions and their shared source. FolderSyncEngine.stop_confirmed() returns False while the original worker remains alive. These outcomes do not prove native device release; recovery after page destruction still needs durable ownership and retry integration.

Host-requested file sends remain owned until their sender worker exits, including after repeated stop requests. Stop signals cancellation and waits for that original worker; an uninterruptible backend operation can still leave stop pending.

MCP read-only hints do not grant viewer access. Reviewed live-screen and caller-data tools use read_screen; stored files, device data and unknown tools require read_data. Aliases share canonical policy and stronger overrides take precedence. Optional image sources, environment-backed config fields and file open plans require read_data. Anchor locators permit live accessibility/OCR; image templates require read_data and VLM requests require drive_input. Read-only invocation rejects capture artifacts and VLM branches, and its catalogue excludes caller-selected ADB executables. MCP CI annotations return formatted lines without writing to stdout. Unreviewed plugin and WebRunner initialization tools are omitted from read-only catalogues and require dependency-specific review.

An MCP tools/call runs as a stoppable run listed as mcp-…. notifications/cancelled stops it: an action list from ac_execute_actions halts before its next action, and ac_wait_for_image / ac_wait_for_pixel wake mid-poll; the call is answered with -32800. ac_stop_execution and other stop requests end it the same way, reported as a tool error. A command already inside a backend still finishes first, except a captured shell command (ac_shell, AC_shell_to_var), whose process tree is killed, an HTTP request (AC_http_request, ac_http_request, and the other clients built on the shared HTTP client), whose sockets are shut, and a template-match, OCR pass, VLM locator request or read-only accessibility walk, which the call stops waiting for (the native pass or request finishes in the background and its result is discarded); in each case the call ends. Pacing inside one gesture also wakes: the interval between click_mouse clicks, the step and settle rests of a tween drag (the button is released where the pointer stopped), and the per-step and per-key delays of humanized motion and typing.

An image search that cannot run on its input raises ImageSearchInputException: a missing or unreadable template, a single-colour template, a threshold outside 0–1, NaN or not a number, or an image OpenCV cannot match. ImageNotFoundException now means only that the search ran and the template is not on screen. The two are siblings, not parent and child, so AC_assert_image with present: false, AC_wait_image_gone and the else branch of AC_if_image_found fail on a misspelled template path instead of passing; an image trigger with such a template is disabled and logged, and observer rules, state-machine guards and anchor locators raise. Code that caught ImageNotFoundException to handle a bad path must catch ImageSearchInputException as well.

A command that raises an error from outside the framework family (cv2.error, sqlite3.Error, a plugin's own exception class) no longer aborts the action list: it is recorded as that action's failure, wrapped in AutoControlForeignException (the original is its original and its __cause__), and AC_try, AC_retry, AC_loop and AC_parallel treat it like any other failed action. With raise_on_error=True the wrapper is raised. Never contained: assertion failures (AutoControlAssertionException and a plugin's own AssertionError), AC_break / AC_continue, stop requests, cancellation, KeyboardInterrupt and SystemExit.

Over the MCP HTTP transport, resources/subscribe belongs to the session that sent it (the Mcp-Session-Id returned by initialize), and notifications/resources/updated is delivered on that session's standing GET stream; an update that arrives while no stream is open is dropped. Ending the session releases its subscriptions. A request without a session has no stream to deliver on and is refused with -32600. The stdio transport is unchanged.

REST host-data reads now follow the matching MCP authority: jobs, remote sessions, USB passthrough status and loopback/remote inventories, and diagnostics require read_data. The corresponding registered status commands, AC_probe_capabilities and AC_diagnose enforce it before providers run. A read-only hint is not viewer access; operator/admin callers retain access. USB enumeration/events, retained inspector statistics and process metrics also require read_data, as do AC_list_usb_devices, AC_usb_recent_events, AC_inspector_recent and AC_inspector_summary. Dashboard panels report missing capabilities independently and clear stale rows. A successful session refresh also clears its previous error status. Unlisted executor-command authorization remains a separate audit scope.

Voice commands (AC_voice_register) and macros (AC_define_macro) keep the authority of whoever registered them: when one is dispatched or called, each step runs only if both that registrant and the current caller may run it, so a stored list neither borrows an administrator's rights nor runs unchecked from the GUI or Python. Only a macro's owner, or trusted local code, may redefine it. Anonymous MCP sessions run as a restricted operator principal, so this applies to them even with RBAC off; without RBAC and outside MCP nothing changes. Each named executor registry (the stores, windows, bulkheads, trackers and outboxes behind AC_cas_put, AC_dedup_check, AC_idempotency_begin, AC_bulkhead_run, AC_sequence_observe and AC_outbox_enqueue) holds at most 1,024 names (MAX_REGISTRY_NAMES): existing names keep working, a new one raises RegistryFullError, and names are released only when the process ends. AC_generate_sop and AC_generate_code substitute known ${var} placeholders but write ${secrets.NAME} and names not yet bound (such as loop variables) exactly as written. env:// values from AC_resolve_ref / AC_resolve_refs are still returned to the caller, but are masked for the rest of the run in logs, the journal and the MCP audit, and in the logged result and the Script Builder result pane.

Host read-only mode applies the same restrictions to explicitly supplied registries and later registrations. Both admission and refreshed invocation check mixed arguments. Configured MCP failure screenshots require a writable tool and a refreshed caller with drive authority; readonly calls and viewers never trigger them. This does not promise that every dependency or diagnostic read has no initialization side effects.

Internal Windows process-memory preparation can now measure a selected process image file through retained read-only handles, with bounded hashing and retryable cleanup. This is observed file evidence, not loaded-code or fixture attestation; native acceptance remains incomplete and arbitrary-address memory tools remain unavailable. See the contract.

A host-managed fixture profile binds a fixed packaged worker to a reviewed config path and digest through the existing target-management API and GUI JSON editor. Registration is inert; bootstrap and configure both verify the deployment binding. The explicit probe checks static artifacts in a bounded background helper and reports static_artifacts_ready, fixture_execution=not_run and native_evidence=not_recorded. Runtime shutdown retains ownership until inspection helpers retire. The fixture is acquired only during managed readiness. Config/image checks do not attest Python source or DLLs. Native execution remains paused; the private delivery format and limits are documented in the same contract.

WebRTC peers also retain failed media constructors and children, observe live disable completion, and bind deferred renegotiation to its original peer. Media producer shutdown now reports pending or uncertain cleanup and retains original resources. Audio and recorder failures are never turned into success by unsafe close or flush replay. LAN close supports explicit retry; application caretaker and GUI integration remain pending. See the retirement contract.

HostBrowser also rejects late publications and retains unfinished thread/close ownership; dialog integration remains pending.

MultiViewerHost can return an owned offer or capture an original-session retirement receipt, so delayed cleanup cannot stop a replacement peer or screen source. GUI adoption remains pending.

Host-selected semantic adapters can return multi-source reports through the existing observation API. The fixture combines reviewed memory reads with its owned read-only IPC snapshot and rechecks both before commit. Report version 3 fixes the required fields in host code and preserves valid fields separately from per-field failures. Missing sources, conflicts and best-effort captures cannot authorize actions or completion. Versions 1 and 2 are rejected.

A separate owned UI observation fixture can be built with test/fixtures/native_memory/build_fixture.py --kind uia; its static manifest remains schema 2. The internal launcher binds startup to the retained process and window owner. The scoped UIA reader checks that window, process and root identity, limits tree traversal, and protects password fields. Its read-only managed adapter creates COM lazily and preserves partial fields through the shared observation API.

Injected calls and hidden Python helpers cover scoped reads, reporting and timeout retirement. Native deployment trust, DOM integration and desktop acceptance remain pending. No native UI fixture execution or desktop noninterference is claimed.

The internal owned UI target retains its launcher and both image leases before attestation, attempts every owner during cleanup, and retains failed cleanup for retry. A publication lock prevents late source installation after shutdown. The native factory only constructs owners; native deployment trust and native acceptance remain pending.

Host management can register a uia_fixture profile with empty allowed_tools, roots and apps, and only config_path/config_sha256 settings. It uses a fixed isolated worker and validates deployment, profile and target pins before acquisition. Both endpoints refuse commands. External tasks may use an empty tool scope only without planned actions; completion criteria remain required and an empty plan cannot prove completion. UI partial/best-effort reports remain diagnostic. Registration and probe acquire nothing; probe reports not_supported and native_evidence=not_recorded. The existing target API, CLI and GUI JSON editor carry this profile. Injected and hidden-helper tests do not establish native trust.

Host-selected in-process service adapters can use the closed service_state criterion: {"kind":"service_state","tool":"AC_service_start","state":"running"} or STOP/stopped. It requires the matching confirmed acceptance and a new SCM report from the same retained owner after acceptance. A passing result reports SCM state, not atomic completion, health or desktop noninterference. These tool names are adapter-scoped, not global executor commands. Existing task APIs and the GUI JSON editor carry the criterion. The host-reviewed service profile pins config_path, config_sha256 and a service_key. Non-ASCII keys are case-folded with Windows' own NT upcase table, never Python's case mapping, so every spelling SCM treats as one service shares one lock. Its fixed worker checks the deployment's service and operation ceiling before accepting task scope. Registration, reload and probe do not read the deployment or access SCM; native acceptance remains pending. Every pinned path (each profile's config_path and the image a deployment names) must be a local drive path: UNC shares, \\.\pipe\ names, \\?\ device paths and .. segments are refused, so registering a profile cannot make the host send its credentials to another machine. A browser profile may also declare host-reviewed semantic_fields: up to 64 {name, selector, frame?, property} entries whose property is text, value or visible. Each browser observation then carries a semantic_report in the shared observation-report schema. The source is bound to the managed browser context, so a new session is a new target lifetime; an absent element is not_found, a value the SDK refuses to read back (password, hidden, file or data-secret controls) is protected, and a navigation during the read makes the source inconsistent_snapshot. Capture IDs and times are left out, so an unchanged page fingerprints the same before an action. Selectors must be unique, because the SDK retires the session on an ambiguous one. DOM reads have no revision and stay best-effort; real-browser acceptance remains pending. An android target profile (settings serial, physical_id, package, optional adb_port, user, idle_seconds; one app; tools AC_android_tap / AC_android_swipe / AC_android_key) drives one device through the device-side helper, which must already be installed and running. Real-device acceptance remains pending. After a Wayland portal refusal or revocation, reset_native_input() (AC_reset_native_input, ac_reset_native_input, Diagnostics → Actions) retires the cached input session so the next input asks for consent again; it requests nothing itself. For iOS Simulators, use_ios_simulator(udid) (AC_ios_use_simulator) routes install, files, pasteboard and recording through xcrun simctl; list_ios_simulators() lists the booted ones. Before a fixture image runs, its lease also refuses a location another account could change: every directory from the drive root down must be a real directory (no junction or symlink) that only SYSTEM, Administrators, TrustedInstaller and the running user may rename, delete, re-ACL or add files to, and the leased file's final path must be the configured one. Deploy fixtures under a protected directory such as %LOCALAPPDATA%; a drive root that grants Authenticated Users Modify (common on secondary drives) or a shared %TEMP% is refused. The fixture starts in its own directory with a minimal environment: a system-only PATH and none of the host's tokens or keys.

Metadata

Release files for je-auto-control-dev 0.0.212

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for je-auto-control-dev 0.0.212
File Size Uploaded Provenance Actions
je_auto_control_dev-0.0.212.tar.gz 3.0 MB Without provenance Details for je_auto_control_dev-0.0.212.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for je-auto-control-dev 0.0.212
File Interpreter ABI Platform Actions
je_auto_control_dev-0.0.212-py3-none-any.whl Python 3 none any Details for je_auto_control_dev-0.0.212-py3-none-any.whl

Total release size: 6.8 MB

Release files / je_auto_control_dev-0.0.212.tar.gz

Download URL je_auto_control_dev-0.0.212.tar.gz
Size 3.0 MB
Tags Source
SHA-256 checksum
How to use checksums
4244db0df7a20e4d2f6a11ee43b803f13b8dfff083e052bb86600d28a6084f88
BLAKE2b-256 checksum
How to use checksums
e91b5ac926b854128f9d1b547d52d36b86b48b4577a8055c75cfe3d248f2a344
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / je_auto_control_dev-0.0.212-py3-none-any.whl

Download URL je_auto_control_dev-0.0.212-py3-none-any.whl
Size 3.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
8bb38cd746eaa5db2f99650042e489bda17c1c85730f6322fed7daacf750ffc9
BLAKE2b-256 checksum
How to use checksums
f228cb6b568a0b289cd649da6817d7764542a38f4f6c0fccd780f1d63ea1140c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for je-auto-control-dev 0.0.212

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.212 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page