Skip to main content

UE5 Editor Agent

ci pypi python license dependencies

Drive the Unreal Engine 5 editor from an LLM agent — no C++ plugin, no project changes, nothing to install into your .uproject.

Tell it "add a point light at (500, 0, 300) and show me what it looks like" and it does it inside the running editor, then takes a screenshot so it can check the result itself.

It speaks over Epic's built-in Python Remote Execution channel, which is why there is no plugin to compile and no files dropped into your project. Works with DeepSeek / OpenAI / any OpenAI-compatible model, and exposes the same 31 tools as an MCP server, so Claude Code / Cursor / Codex can drive the editor too.

viewport screenshot taken by the agent The agent can see its own work.
screenshot spawns a temporary SceneCapture2D at your current viewport camera, renders into a transient TextureRenderTarget2D (never saved into the level), exports a PNG, then deletes the actor. No leftover actors, no dirty packages. Works without PIE and without the automation test framework.

Install

pip install ue5-editor-agent      # zero third-party dependencies

Or from source, to hack on it:

git clone https://github.com/rfioly/ue5-editor-agent
cd ue5-editor-agent && pip install -e .

What it can do

Beyond spawning and moving actors, it can rename and duplicate them, read and write properties through dot paths (light_component.intensity), search assets with class filtering, save the level on demand, and move the viewport camera onto an actor — always with an explicit restore_viewport to put it back.

It works on assets, not just level actors: rename, duplicate and delete packages, inspect what an asset actually contains, and — critically — ask who references it before touching it. It works on material instances the same way: enumerate every parameter, write one instance and read every value back, or apply a shared set of values across dozens at once.

And it can act on whatever you have selected in the viewport (get_selection → align_actors), which is the shortest path between a human pointing at something and an agent changing it: no label needs to be typed out.

Destructive operations default to a dry run. Full list in docs/tools.md.

Quick start

1. Turn on the two switches in the editor

Edit → Plugins — enable Python Editor Script Plugin and Editor Scripting Utilities.

Edit → Project Settings (Project Settings, not Editor Preferences) → search Python → under Plugins → Python, tick:

  • ☑ Enable Remote Execution?
  • ☑ Develop Mode

Then restart the editor. It does not take effect without a restart.

2. Check the connection

ue5-agent check
连接成功 [ok]
  engine_version: 5.8.2-56702186+++UE5+Release-5.8
  project_name: <your project>
  current_level: <level path>
  actor_count: <actors in level>
  is_mock: False

3. Give it a task

export LLM_API_KEY=sk-...        # DeepSeek / OpenAI / any compatible endpoint
ue5-agent once "在场景里 (500, 0, 300) 加一盏点光源,然后截图给我看"

python run_demo_live.py          # no API key needed — scripted model, real editor
python run_demo.py               # fully offline: fake engine, fake model

run_demo_live.py swaps in a ScriptedLLM (a canned script) but leaves everything else real: real tools, real transport, real editor. It will genuinely modify your current level, and it deliberately scripts one wrong class name so you can watch the agent read the error and correct itself.

python tests/run_all.py            # 160 tests, zero dependencies
python eval/run_eval.py --self-test
ue5-agent --help                   # demo / check / once / chat

As an MCP server

{
  "mcpServers": {
    "ue5-agent": {
      "command": "python",
      "args": ["-m", "ue5_agent.mcp_server"],
      "cwd": "<absolute path to the install>"
    }
  }
}

Two implementation notes: tool failures are reported with isError rather than as JSON-RPC errors (so the model can read the message and self-correct), and nothing is ever written to stdout except JSON-RPC.

Examples

Four short scripts in examples/ that do the things people actually ask for, written as starting points rather than demos:

python examples/batch_rename_textures.py  --folder /Game/Textures --from "^T_" --to "TEX_"
python examples/audit_material_params.py  --folder /Game/Materials --param Roughness
python examples/align_selected_on_ground.py --mode min --apply
python examples/screenshot_after_change.py --actor DirectionalLight --intensity 12

They share one habit worth copying: the destructive ones default to a dry run, and the one that moves the camera restores the previous camera position in a finally block. tests/test_examples.py runs them so they cannot rot.

Verified

Measured against a live UE 5.8.2 editor on Windows 10, not a mock:

Tools exercised end to end all 31
Tests 160, zero third-party dependencies
CI Windows + Linux × Python 3.9 / 3.11 / 3.13
Installed from the built wheel asserted in CI, imported from a directory outside the checkout
Lines of Python ~8,400 across ue5_agent/ and tests/

Each tool's confirmed behaviour is listed in docs/tools.md; the 35 traps found along the way are in docs/pitfalls.md.

Not yet verified: more than one editor open at a time (the first discovered node wins), operations running for tens of seconds (timeout edges), and screenshots on levels other than the one test level (very large scenes may frame poorly on the bounding-box fallback).

How it works

The short version: the client pings over UDP multicast, the editor answers, and then — the part that surprises everyone — the editor connects out to the client's TCP server. Commands are self-contained Python snippets; results come back behind a sentinel prefix in the log stream.

There is a fake unreal module in tests/ so generated snippets can be executed offline for real, which is the only thing that catches runtime errors without an editor.

→ docs/architecture.md for the full picture, including why the templates use string.Template instead of str.format, and why output trimming happens in one place.

Five protocol traps, dug out of the engine source

The channel is documented almost entirely by example, and the examples are where it goes wrong. Five of them, all visible in the 5.8 source once you know where to look:

Epic ships a working client and the docs never mention it. Engine/Plugins/Experimental/PythonScriptPlugin/Content/Python/remote_execution.py is 649 lines of pure standard-library client for this exact protocol. grep -i remote across the plugin's own SphinxDocs/source/ returns zero hits.

That client has a framing bug at 8192 bytes. It decides a message is complete when recv() returns fewer bytes than DEFAULT_RECEIVE_BUFFER_SIZE (8192). A result of exactly 8192 bytes hangs it forever; a badly split one gives Unterminated string; two queued results give Extra data. Parse by structure, not by size.

The TCP connection goes backwards. The editor is the TCP client — PythonScriptRemoteExecution.cpp:465 calls Connect, not Listen. You listen, send open_connection over UDP, and accept. Give it thirty seconds: the reference client retries 6 × 5s and re-sends open_connection before every attempt.

MulticastBindAddress is used as three things — bind address, join interface, and egress interface — all from one value, which defaults to 127.0.0.1. And RemoteExecutionMulticastTtl defaults to 0, which means local host only. So "remote" execution is machine-local on two independent settings out of the box. This project matches the default by setting the outbound interface to loopback and trying it first (see build_strategies() in ue5_remote.py).

ioctl(SIO_UDP_CONNRESET, 0) is dead code. CPython supports three ioctls and that is not one of them — it raises ValueError, which most except OSError clauses let escape. And the problem it claims to solve mostly does not exist here: ICMP port-unreachable comes from unicast sends, and discovery only ever sends to the multicast group. What actually keeps the loop alive is except ConnectionResetError: continue on the receive side.

All five, with line numbers into the 5.8 source so you can check them instead of trusting me: docs/remote-execution-traps.md.

How this compares

Approach Channel Plugin required Notes
Epic's official Unreal MCP (built into 5.8) HTTP + SSE 127.0.0.1:8000/mcp yes (ModelContextProtocol) Official, still early — 5.8.x has known editor crashes and silent data loss
Most community MCPs (chongdashu/unreal-mcp, ChiR24/Unreal_mcp) C++ plugin + Python bridge yes, compile it Most capable; the cost is a compiled plugin in every project
This project Python Remote Execution (built in) no Zero footprint: no .uproject edit, no files, no build

"No plugin" is not "more powerful" — it buys near-zero setup cost and a project that stays clean, at the price of the deep interfaces a plugin can offer (editing Blueprint graph nodes directly, for instance). When you need those, run_python is the escape hatch, or use a plugin-based project.

There was one earlier project on this channel, runreal/unreal-mcp (MIT), which has not been updated since June 2025 and whose issues go unanswered. The point of this project is to keep that channel maintained and to add the visual feedback loop it never had.

Repository layout

ue5-editor-agent/
├── ue5_agent/
│   ├── tools.py         31 tools + validation + result trimming
│   ├── agent.py         core loop, loop guards, trace recording
│   ├── llm.py           OpenAI-compatible client + ScriptedLLM (zero deps)
│   ├── mcp_server.py    MCP server over stdio, reuses the same tools
│   ├── cli.py           demo / check / once / chat
│   └── backends/        remote_exec (real engine) / mock (offline)
├── ue5_remote.py        Remote Execution client (also published as `ue-remote-exec`)
│                        — discovery + TCP command channel
├── eval/                eval cases + runner (judged by engine state, not an LLM)
├── examples/            small runnable scripts
├── docs/                architecture / tools / screenshot / pitfalls
└── tests/               run_all.py + fake_unreal.py + 160 tests

Zero third-party dependencies — not even requests, all standard library. pytest tests/ works if you have pytest installed.


中文说明

用自然语言操作 Unreal Engine 5 编辑器的 AI agent。输入「在场景里加一盏灯,放到 (500,0,300)」这类指令,agent 会在编辑器里真实执行,而不是给出操作说明;需要确认结果时 它会自己截一张图来看。

已在真实 UE 5.8.2 + Windows 上实测。走 Epic 官方内置的 Python Remote Execution 通道 —— 不需要写 C++ 插件,不需要往 UE 项目里放任何文件,.uproject 一行都不用改。

pip install ue5-editor-agent
ue5-agent check                                                    # 连上编辑器
ue5-agent once "在场景里 (500,0,300) 加一盏点光源,然后截图给我看"    # 需要 LLM_API_KEY
python run_demo_live.py                                            # 没有 API Key 也能跑
python tests/run_all.py                                            # 160 个测试,零依赖

编辑器侧只有两步:编辑 → 插件 勾上 Python Editor Script Plugin 与 Editor Scripting Utilities;编辑 → 项目设置(是项目设置,不是编辑器偏好设置) 搜 Python,勾上 Enable Remote Execution? 与 Develop Mode,然后重启编辑器。

License

Apache-2.0. See LICENSE.

Metadata

Release files for ue5-editor-agent 0.2.2

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

Source distribution (sdist)

Source distribution for ue5-editor-agent 0.2.2
File Size Uploaded Provenance Actions
ue5_editor_agent-0.2.2.tar.gz 114.9 kB With provenance Details for ue5_editor_agent-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ue5-editor-agent 0.2.2
File Interpreter ABI Platform Actions
ue5_editor_agent-0.2.2-py3-none-any.whl Python 3 none any Details for ue5_editor_agent-0.2.2-py3-none-any.whl

Total release size: 201.0 kB

Release files / ue5_editor_agent-0.2.2.tar.gz

Download URL ue5_editor_agent-0.2.2.tar.gz
Size 114.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4fb3b8737b4ede0976af5beb2d3991f901db0a069af8ecfb574009cbad03e1b8
BLAKE2b-256 checksum
How to use checksums
37a284ef92fa53fb33b65588f473d48656bbfdb39fcbd6e7239f9cac39c2cf3f
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 log

Release files / ue5_editor_agent-0.2.2-py3-none-any.whl

Download URL ue5_editor_agent-0.2.2-py3-none-any.whl
Size 86.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7a6c9a7188526ca5cee8421d13ec7736a3d94bacc8b2f85a4981285cd43ef880
BLAKE2b-256 checksum
How to use checksums
80e2dc4181243644dc63eb92b04cb33110c34dfaa1a6a7123a53008c8d656358
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 log

Security for ue5-editor-agent 0.2.2

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.

Select from 2 files

Attestation for ue5_editor_agent-0.2.2.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 log

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.

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