ue-remote-exec
Talk to a running Unreal Engine 5 editor from plain Python, over the editor's built-in Python Remote Execution channel. No C++ plugin, no project changes, no editor restart beyond enabling the built-in switch.
This is the transport layer extracted from ue5-editor-agent, where it drives 31 editor tools and is tested against a live UE 5.8.2 editor on Windows. It is published separately because the transport is the part other people need to vendor, and because every other implementation of this channel I could find was either abandoned or a hundred lines that stopped at "it pinged once".
from ue_remote_exec import EditorSession
with EditorSession() as session:
data = session.run("""
import unreal
sub = unreal.get_editor_subsystem(unreal.EditorActorSubsystem)
for actor in sub.get_all_level_actors()[:5]:
print(actor.get_actor_label())
""")
print(data["success"])
for entry in data["output"]:
print(entry["type"], entry["output"])
Install
The long version of all five traps — with line numbers into the 5.8 source, and a note on which ones nobody else has written down — is in docs/remote-execution-traps.md.
When discovery finds nothing
Five traps produce the same error message, so guessing which one you hit is a bad use of an afternoon. Bisect it instead:
curl -sO https://raw.githubusercontent.com/rfioly/ue-remote-exec/main/docs/diagnose-discovery.py
python diagnose-discovery.py
Standard library only, no install, one file — it has to run inside whatever broken environment you are already in. Eight stages, in order, each printing what it proved and stopping being informative at the first failure:
[ok ] 0 this platform filters group traffic by bind address (Linux-like)
[ok ] 1 bind 0.0.0.0:6766 (as SO_REUSEPORT)
[ok ] 2 join 239.0.0.1 on 127.0.0.1
[ok ] 3 IP_MULTICAST_TTL = 1
[ok ] 4 IP_MULTICAST_LOOP = 1
[ok ] 5 IP_MULTICAST_IF = 127.0.0.1 (readback 127.0.0.1)
[ok ] 6 AN EDITOR ANSWERED from 127.0.0.1:6766
node_id 23A4A9E443F3EDC3B3AB91AE8D2E5971
project_root C:/Users/rfioly/Documents/Unreal Projects/AiNpcGame 5.8/
engine_version 5.8.2-56702186+++UE5+Release-5.8
[ok ] 7 the editor dialled back from 127.0.0.1:34035
TCP direction confirmed: the editor is the client,
so you must be listening before you ask.
Exit code 2 means your own socket is broken and the editor was never involved.
1 means the network is fine and the editor did not answer. 0 means the
protocol works on this machine, so the bug is in your tool.
Two things in it are worth stealing. It checks that IP_MULTICAST_IF is
usable, not merely accepted — on Windows, setsockopt returns success and
getsockopt echoes the address back for an interface that cannot carry the
datagram. And its stage 7 sends dest: "", not dest: "*":
PassesReceiveFilter treats an empty destination as "everyone" and a literal
asterisk as a node whose id is an asterisk, which matches nothing. A wildcard
there produces a diagnostic that silently tests nothing.
pip install ue-remote-exec
Editor setup (once per project)
- Edit → Plugins, enable Python Editor Script Plugin and Editor Scripting Utilities.
- Edit → Project Settings (project settings, not editor preferences), search
for
Python, enable Enable Remote Execution? and Develop Mode. - Restart the editor. These settings are read at startup.
Then:
ue-remote discover
ue-remote exec "import unreal; print(unreal.SystemLibrary.get_engine_version())"
The five things that go wrong
These are not bugs in this library; they are properties of the channel. All five were established by reading the 5.8 source rather than the documentation, which covers none of them. Each one cost me an afternoon.
1. The TCP direction is inverted
You do not connect to the editor. The editor connects to you.
- You listen on a local TCP port (you are the server).
- You send
open_connectionover UDP: "connect to me atx:y". - The editor connects out as a TCP client — in the source it is literally
CommandChannelSocket->Connect(*CommandEndpoint.ToInternetAddr()). - Only then can you send
commandand receivecommand_result.
Any implementation that tries to socket.connect() to the editor will hang.
2. MulticastBindAddress is one value used as three things
The editor builds its discovery socket like this:
.BoundToAddress(MulticastBindAddress)
.JoinedToGroup(MulticastGroupEndpoint.Address, MulticastBindAddress)
.WithMulticastInterface(MulticastBindAddress)
Bind address, join interface, and egress interface — from a single value, which
defaults to 127.0.0.1 in 5.8. So a default install only joins the multicast
group on the loopback NIC, and a ping sent from your real NIC reaches nobody.
ue-remote-exec handles this by trying loopback first (build_strategies()), so
it works on a default install with no configuration. If discovery still returns
nothing, set Project Settings → Plugins → Python → Advanced → Multicast Bind
Address to 0.0.0.0 and restart — that is the configuration the engine treats
as "normal networking".
Two corollaries worth knowing:
- The TTL is also
0by default (RemoteExecutionMulticastTtl = 0), and per the engine's own header comment, 0 is limited to the local host. So "remote" execution is machine-local on two independent settings out of the box. For LAN use you must change both the bind address and the TTL, then restart. - The editor's
pongis broadcast back to the multicast group, not unicast to the requester. You must callIP_ADD_MEMBERSHIPyourself and bind port 6766. Multicast delivery matches on group address plus port, so binding a random port receives nothing.
3. The same bind address filters group delivery on Linux and does not on Windows
BoundToAddress decides what your socket accepts, and the two platforms disagree
about what that means for multicast. Measured five times per cell, same code,
same group, only the receiving bind() address changing:
| Receiver bound to | Windows 10 | Kali / Linux 7.1.5 |
|---|---|---|
0.0.0.0 |
5/5 | 5/5 |
127.0.0.1 |
5/5 | 0/5 |
| the machine's own NIC address | 0/5 | 0/5 |
Windows hands a group datagram to a member socket whatever it bound to. Linux
drops it unless the socket is bound to 0.0.0.0 or to the interface the datagram
arrived on. The datagram's destination address really is 239.0.0.1 — you can
see it with IP_PKTINFO — so binding 127.0.0.1 and joining the group is a
contradiction Linux resolves by dropping the packet, silently, with no error and
with ss -ulpn still showing the socket listening.
This is why the engine's default (RemoteExecutionMulticastBindAddress = 127.0.0.1) survived for years: it works on the platform most people test on.
SO_REUSEADDR versus SO_REUSEPORT makes no difference to any of it; neither
does ip maddr show lo, which lists the membership either way.
If discovery works for your colleague on Windows and not for you on Linux with
the same project settings, this is the first thing to rule out: set Multicast
Bind Address to 0.0.0.0 and restart.
4. ioctl(SIO_UDP_CONNRESET, 0) does not work, and mostly is not needed
The folklore fix for Windows UDP is sock.ioctl(SIO_UDP_CONNRESET, 0). It cannot
work: CPython's socket.ioctl() accepts exactly three control codes —
SIO_RCVALL, SIO_KEEPALIVE_VALS, SIO_LOOPBACK_FAST_PATH — and raises
ValueError: invalid ioctl command 2550136844 for anything else. The except OSError that usually wraps it does not even catch that.
And the problem it claims to solve barely exists here. ICMP port-unreachable
comes from unicast sends; discovery only ever sends to the multicast group.
So the thing that actually keeps the receive loop alive is treating
ConnectionResetError as "nothing yet" on the recvfrom side — which is what
this library does. _disable_udp_conn_reset() still calls WSAIoctl directly
for the unicast cases, but it is belt-and-braces, not the mechanism.
5. The reference client hangs on a message of exactly 8192 bytes
remote_execution.py — Epic's own client, shipped inside the plugin — reads a
frame with recv(8192) and stops when it gets back fewer than 8192 bytes.
A command_result of exactly 8192 bytes therefore never terminates the loop; a
result split across reads gives Unterminated string; two queued results give
Extra data. extract_json_objects() here counts braces instead, so it does not
care how the bytes land.
API
EditorSession(group, port, command_ip, timeout, verbose) |
context manager; connect() on entry, close() on exit |
session.connect() -> EditorNode |
discover, start the TCP server, ask the editor to connect back, accept |
session.run(code, exec_mode="ExecuteFile", timeout=120.0) -> dict |
send one command, return the command_result payload |
find_editor() -> EditorNode | None |
discovery only, no session |
discover(group, port, timeout, verbose) -> list[dict] |
discovery with human-readable output |
extract_json_objects(buffer) -> (list[dict], bytes) |
the framing function, if you are writing your own transport |
exec_mode is ExecuteFile (a whole script), ExecuteStatement (one statement),
or EvaluateStatement (an expression whose value you want).
session.run() returns the raw command_result data: success, command,
result, and output (a list of {type, output} where type is Info,
Warning, or Error). success is about whether the code raised, not whether
it did what you wanted — a script that silently does nothing still reports
success: True. Check the state you care about, not the flag.
Framing
Command channel frames have no length prefix and no terminator: bare JSON, one
object per send, Strlen bytes. TCP coalesces and fragments them anyway, so
extract_json_objects() counts braces while skipping string literals and escape
characters, and hands back the incomplete remainder for the next read. That
detail matters — a command_result whose result is itself dict-shaped used to
swallow the rest of the stream.
It takes bytes, not str: pass it the raw buffer and append whatever leftover
it returns to the next read. Do not decide completeness by size — that is exactly
the bug described in trap 4 above.
What this is not
- Not a tool layer. It sends strings of Python and returns stdout. If you want typed tools, validation, and a model loop on top, that is ue5-editor-agent.
- Not a plugin. Everything it can do is what the Python API exposes; it cannot edit Blueprint graph nodes directly, for instance.
- Not for PIE or packaged builds. The Python plugin only runs inside the editor, which is the engine's design, not a limitation of this library.
- Not multi-editor. The first discovered node wins.
Tests
python tests/run_all.py # 30 tests, zero dependencies
The suite covers payload shapes, GUID source ids, JSON framing under every chunking from 1 byte to 100 KB (concatenated objects, partial reads, braces and escaped quotes inside strings), the loopback-first strategy order, and a real multicast socket bind. It does not need an editor; nothing in it fakes a discovery reply, because a fake reply would prove nothing about whether the real one is parsed correctly.
Several tests exist only to keep a mistake from coming back: one asserts the
source contains no socket.ioctl() call carrying SIO_UDP_CONNRESET, another
asserts extract_json_objects() returns exactly one object for a frame larger
than 8192 bytes no matter how it is split, and the nine in test_diagnose.py keep
the diagnostic script honest — same constants as the library, no wildcard dest,
standard library only, and a stage 0 verdict cross-checked against a second,
independently written measurement of the same question.
License
Apache-2.0. See LICENSE.
Metadata
Release files for ue-remote-exec 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ue_remote_exec-0.3.0.tar.gz | 45.6 kB | With provenance | Details for ue_remote_exec-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ue_remote_exec-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for ue_remote_exec-0.3.0-py3-none-any.whl |
Total release size: 65.6 kB
Release files / ue_remote_exec-0.3.0.tar.gz
| Download URL | ue_remote_exec-0.3.0.tar.gz |
|---|---|
| Size | 45.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eb184c4591a8207988e85fc22461f0bbe16f3750aafbb7ffafded3d51a4ac25b
|
|
BLAKE2b-256 checksum How to use checksums |
bbd05e890a041f798481cfe8db3547787e80c5819cb0e7ab198aa2da8f60e496
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / ue_remote_exec-0.3.0-py3-none-any.whl
| Download URL | ue_remote_exec-0.3.0-py3-none-any.whl |
|---|---|
| Size | 20.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6ad2c6bc12d22a2345ae40d14ea6f35d515a6f8bd22927cc7ea4fd8911590a49
|
|
BLAKE2b-256 checksum How to use checksums |
fdf8f303fdb14c548798bb5944c00838cf41613d8ee4cb0e923f9df2912c74bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logSecurity for ue-remote-exec 0.3.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for ue_remote_exec-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logA 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.