Agent Bridge: Let Terminal Coding Agents Drive the Editor
Nineteen HTTP endpoints behind those commands, all documented, all returning compact ... Never blocks the main thread: work is queued to the editor loop and answered with 503 ... ALSO INCLUDED
by ShipYourGame
Price History +
2022.3+ (verified on 6000.6.0f1), editor-only, C# source only (no DLLs, no native plugins), assembly definition ShipYourGame.AgentBridge.Editor
Editor: 27 scripts (HTTP listener on a worker thread, main-thread queue, router, JSON, token, compile tracker, test runner bridge, scene guard, snippet compiler, frame stats, window)
Clients: Tools/agentbridge.sh (bash, curl; jq optional), Tools/agentbridge.ps1 (PowerShell 5.1+). No plugin or protocol server needed on the agent side
Endpoints: GET /, /status, /compile, /tests, /logs, /hierarchy, /stats, /scene; POST /compile, /tests, /tests/reset, /exec, /logs/clear, /play, /stop, /pause, /step, /screenshot
Files written in the project (do not commit): Library/AgentBridge/{token, bridge.json, compile.json, tests.json, screenshot.png, snippets/, scene-backup/}, UserSettings/AgentBridgeSettings.json; tools/agentbridge.* when you press the copy button
Network: binds the numeric IPv4 loopback address only, default port 17330 (configurable), no listener in batch mode
Safe Mode on by default: /exec refused (403) until disabled in the window with a confirmation dialog
Dependencies: com.unity.test-framework (default in every project). Nothing else
Supported OS: Windows, macOS, Linux (editor)
52 EditMode tests in the source repository; manual smoke test documented
Close the loop your terminal coding agent is missing: edit a script, compile, read the real errors, run the tests, look at the game, fix, repeat, without a human alt-tabbing to press Play.
Agent Bridge is a small, editor-only package that runs a token-protected HTTP/JSON server on the loopback interface inside the editor. Any terminal coding agent (or any script) talks to it through the bundled command line client: one bash script, one PowerShell script, no plugin, no protocol server, nothing to install on the agent side. Full C# source, no DLLs, 52 EditMode tests behind it.
WHAT THE AGENT CAN DO
compile: refresh assets, compile, wait through the domain reload, print errors as file:line:col (exit 2 on errors).
tests: run EditMode or PlayMode tests with a regex filter or exact names; pass/fail counts and failure messages.
logs: read recent Console entries with levels, ids and a since cursor; stack traces on request.
hierarchy / scene: dump the loaded scenes as a tree with components; dirty state, prefab stage, build scene list.
play / stop / pause / resume / step: control Play Mode; the player loop keeps stepping while the editor is unfocused.
screenshot: render any camera to a PNG the agent can open, in Edit Mode or Play Mode.
stats: FPS, frame-time average and p95, draw calls, batches, triangles, GC allocation per frame.
status: everything an agent needs to decide what to do next, answered from a cache that never waits on the main thread.
exec: compile and run a C# snippet inside the live editor, refused until you turn Safe Mode off.
Nineteen HTTP endpoints behind those commands, all documented, all returning compact JSON with an ok flag, an error code and a hint an agent can act on. Exit codes 0 / 1 / 2 / 3 (ok / error / failures / busy) so the agent knows whether to fix, wait or ask.
SAFETY MODEL, IN PLAIN WORDS
Loopback only: the server binds to the numeric IPv4 loopback address; another machine cannot connect. A new random 256-bit token every editor session, required on every request, compared in constant time, deleted when the editor quits, rotatable from the window. Safe Mode is on by default: exec, the only endpoint that runs arbitrary C#, answers 403 until you switch Safe Mode off in the window and confirm a dialog. No CORS, ever: requests carrying a browser Origin header are refused and the Host header must be loopback. Every request is logged to the Console with the [AgentBridge] prefix and listed in the window. Request size limit (1 MB), JSON-only bodies, no path traversal, screenshot paths confined to the project or temp folder, no listener in batch mode, nothing in player builds.
BUILT FOR THE EDITOR'S SHARP EDGES
Survives domain reloads: the listener re-arms after every compile, and compile results and test progress are persisted. Test-run lock with stale-run recovery: no asset refresh while the Test Runner is mid-run, no overlapping runs, a stuck run can be reset. Scene guard: the "save changes?" modal that the Test Runner opens on dirty scenes is prevented; the agent is told which scenes are dirty and can opt in to a silent save. Never blocks the main thread: work is queued to the editor loop and answered with 503 if the editor is busy.
ALSO INCLUDED
Editor window (Window > ShipYourGame > Agent Bridge): status, address, token copy/rotate, Safe Mode toggle, port and limits, recent requests, one-click copy of the clients into tools/. Documentation: install, a two-minute agent quick start with a ready-made instructions block for the agent's project file, endpoint reference, security and threat model, troubleshooting, manual smoke test.
REQUIREMENTS
2022.3 or newer (verified on 6000.6.0f1). Test Framework package (installed by default). curl for the bash client (macOS, Linux, Git Bash) or PowerShell 5.1+ for the Windows client.
WHAT IT IS NOT
Not an agent, not a model, not a protocol server: it is an HTTP door into the editor plus a script any agent with a shell can call. Not a network service: it cannot be reached from another machine and must never be port-forwarded or tunnelled. Not a sandbox: with Safe Mode off, an agent can run any C# in the editor with your user permissions; keep Safe Mode on unless you are actively using exec. Not a runtime component: nothing from the package ends up in a player build.
Full source, XML-documented public API, one editor assembly definition.