Runtime and Worker
What this page shows, how to connect a machine as a Worker that can receive tasks, and why a task never reached an engine.
The platform does not run business code. Reading and writing code, running tests, and opening pull requests all happen inside an engine process on some device; the platform only queues tasks, dispatches them, and collects results. This page explains the three layers (device, runtime, engine), then covers the three ways to connect a machine, the checks to run before connecting, and the order to diagnose problems in.
This page is about managing the execution side. For installing the seven engines and configuring models, see Engine overview.
What this page is for
| Object | What it is | What to check on the page |
|---|---|---|
| Worker / device | A machine plus one credential (rta_ token) |
Device name, IP, owner, scope, credential status, last seen, hosted engines |
| Agent Runtime | The resident runtime-agent process on the machine: registers the machine, scans local engines, reports heartbeats, claims and executes tasks |
Whether the device is online and when it last reported; it stays online even with no engines |
| Engine instance | The Agent CLI that actually executes tasks, one row per instance | Engine type, version, device, health status and health score, model, role tags, scene tags, installed |
The platform schedules; the Worker executes. A task does not run "in the page" — the page shows where it runs and why it does not.
Two rules to keep in mind:
- A revoked credential cannot be reused; generate a new one. A device that stays offline for more than about six days is marked "to be reclaimed", so reconnect it if you want to keep it.
- Online does not mean executable: an online device only proves its heartbeat is working. Whether it can take tasks depends on engine health, role tags, and scene tags.
Scope decides who the device serves: Personal is usable only by the owner's own tasks; Repository serves the specified owner/repo; Global is shared across the organization. Use Personal or Repository for private code.
| Engine card field | Purpose |
|---|---|
| Engine type / version / device | Identifies which instance this is |
| Health status / health score | Offline engines receive no tasks; a low score is down-weighted, and the score can be reset from the details panel |
| Model | The model configured for this instance; the most recently used model is shown when none is configured |
| Role tags | The stages it can take (VOD, Issue, Coding, QA, SRE, Chat, or "all"); when every role is disabled the card shows "disabled" and no task will select it |
| Scene tags | The scenes it belongs to; they only affect nodes that select engines by scene, and an engine with none falls into default |
| Installed | Whether the runtime found the CLI on this machine; a discovered CLI that fails --version still registers, but receives no tasks |
Before you connect
All three connection methods share this chapter: check the machine and environment, and decide which address to use, before opening the Add device panel.
Typical reasons to run your own Worker: code cannot leave the intranet, the platform pool is queueing, you need a specific engine or a private model, or you need to narrow the scope to yourself or one repository. For the decision checklist, see Hands-on walkthrough; if the built-in engine pool is enough, you do not need to connect anything.
Check the machine and network
Run these commands on the target machine:
python3 --version # 3.10+
curl --version
df -h /tmp # at least 1G recommended (the runtime package is about 100M)
curl -sS -m 8 https://<platform-domain>/api/health | head -c 200
/api/health returns the platform's self-description. A healthy response looks like this:
{"server":"ok","server_base_url":"https://www.grapedev.cn","worker_connect_url":"https://www.grapedev.cn","agent_runtime":"online", ...}
Two criteria: returning JSON means the path works (DNS, TLS, and HTTP all fine); worker_connect_url is the value for --server, and it wins when it differs from the address in your browser.
What happens if you skip this step:
| Symptom | Actual cause |
|---|---|
curl: (6) could not resolve host or (7) failed to connect |
Domain or network unreachable, often mistaken for a token error |
curl: (28) timeout |
Security group or proxy blocking the request |
curl: (60) SSL certificate problem |
Private CA or a gateway intercepting TLS |
| HTTP 200 but the body is HTML | A WAF or gateway fallback page, which makes the install script fail with a bash -s syntax error |
Reachable but --server is wrong |
The package downloads, but registration keeps returning 401 or cannot connect |
curl -sI(HEAD) only proves connectivity and cannot readworker_connect_url; some gateways also answer HEAD with 405. Use GET here.
Choose the platform domain
- Browser address bar: the workbench URL without the path and without
/api.grapedev.cnredirects with 301 towww.grapedev.cn, so use the final address. /api/healthself-description:server_base_urlis the public base URL;worker_connect_urlis the address a Worker should use (authoritative);browser_callback_urlis only for login callbacks and must not be given to a Worker.- An existing Worker:
grep -E '^RUNTIME_SERVER_URL=' /etc/grape/runtime.env(root installation) or~/.grape/runtime.env(user installation). - Self-hosted environments:
server_base_urlinconfigs/server-config.json, theserver_base_urlrow in themetatable, and the nginxserver_name.
| Target machine location | --server |
|---|---|
| Public ECS, office network, home network | The public domain |
| Same VPC or dedicated line | The internal domain or internal IP and port; verify with curl on that machine first |
| Cloud hosts whose DNS resolves through the public internet | Prefer the internal address to avoid traffic charges and security group rules |
There is only one criterion: an address that returns the JSON above from the target machine.
Add a device
+ Add device opens a side panel with three cards. Each targets a different object, and picking the wrong one sends later troubleshooting in the wrong direction. Find your case in this table first, then read the matching subsection.
| Entry | What it connects | What it produces |
|---|---|---|
+ Generate credential |
One plain machine (ECS, intranet host, GPU host, desktop) | One plain device under Workers; one row per CLI under Engines |
Generate sandbox credential |
The access identity of one cloud sandbox platform | One device marked "sandbox platform" under Workers; its artifacts live on the Cloud Sandboxes page, and Engines has no plain engine rows |
☁ AI Devspace |
One Huawei Cloud cloud development environment | The platform creates the environment, generates the credential, and registers the Worker |
Generate a credential (plain machine)
This is the default path for Issue and pipeline tasks.
1. Generate: Agent Runtime → + Add device → + Generate credential.
| Field | Value |
|---|---|
| Credential name | Globally unique; use model-purpose-index (for example gpu-a100-coding-01) and keep it aligned with the device name |
| Owner | Filled automatically with the current account |
| Scope | Personal / Repository (enter owner/repo) / Global |
Choose the scope carefully: use Repository or Personal for private repositories, and Global only for machines that genuinely serve the whole organization.
2. Install: after generation the page shows the token and a one-click command, with the notice the token is shown only once, save it now.
# Linux / macOS (no root required)
curl -fsSL https://<platform-domain>/api/runtime/install | bash -s -- --token rta_xxx --server https://<platform-domain>
- Windows: click Copy Windows command and run it in PowerShell on the target machine; Python 3.10+ must be installed.
- Manual start (debugging): run it inside the unpacked runtime directory, not inside
src:
bash
RUNTIME_TOKEN=rta_xxx RUNTIME_SERVER_URL=https://<platform-domain> \
python -m src.domains.runtime.engine.agent
Running engines as root additionally requires GRAPE_ALLOW_ROOT_ENGINE=1.
3. Availability: confirm every item in the acceptance list below. You can install engines before or after connecting. Installing later does not require a restart: the runtime does a lightweight discovery every 15 seconds (PATH lookup only), re-registers immediately when it finds a new CLI, and opens a 60-second first-probe window, so in the normal case the engine appears within a minute.
Generate a sandbox credential (cloud sandbox platform)
The object here is the access identity of one sandbox platform. The platform uses it to create and destroy sandboxes and to sync templates; this machine does not run regular tasks.
Three prerequisites: the target platform is already in the sandbox platform list; you have its API URL (required); and you have an API key if the platform requires authentication, plus a certificate PEM for a private CA.
1. Generate: pick the platform (an unknown one fails with the sandbox credential must specify a valid platform), then fill in the API URL (missing values fail with enter the platform API URL), the API key, and the certificate PEM. The API key and certificate are stored with the credential on the platform side; the install command does not carry them.
2. Install: run the one-click command on the Linux machine that hosts the sandbox platform. That machine needs the platform SDK and preinstalled engines, otherwise the template list cannot be reported. Sandbox credentials do not support Windows and have no manual installation path.
3. Artifacts and constraints:
- The device name is prefixed with the platform, in the form
{platform}-{name}; theWorkerscard shows "sandbox platform" and the platform name, and the filter bar can filter by sandbox platform. - Platforms, templates, and sandboxes all live on the Cloud Sandboxes page;
Engineshas no plain engine rows for this device, so an empty list is expected. - Clear running sandboxes before deleting the credential, otherwise they leave management and keep incurring charges.
AI Devspace (no machine available)
When no machine is available, let the platform open a cloud development environment on Huawei Cloud and register it as a Worker automatically.
Four prerequisites: Huawei Cloud AK/SK configured in General Settings; the template published and whitelisted; the CodeArts development environment service agreement signed; the environment count below the limit.
1. Create: pick a template and a specification, then create. The platform provisions the machine, generates the credential, and registers the Worker, usually within 2 to 3 minutes.
2. States and constraints:
- State machine: Creating → Running / Ready → Stopping → Deleted.
- A running environment cannot be deleted; shut it down first (the message is
a running environment cannot be deleted, shut it down first). - Billing is pay-as-you-go; shut down or delete the environment when finished.
- Engines must still be installed inside the environment before it can take tasks; it behaves like any other device, so use the same troubleshooting order.
Failure messages map to these causes: already used / count limit, not signed agreement, Template not published.
Acceptance checks
All three entries share these checks, and missing one means the connection is incomplete.
# Root installation: systemd unit; the unit name may be runtime-agent or runtime-agent-<instance key>
systemctl list-units --state=running | grep runtime-agent
# User installation: a nohup background process
pgrep -af "runtime.engine.agent"
opencode --version ; hermes --version ; codex --version # engines are executable
- The device appears under
Workerswith status "online", and thehosted enginescolumn shows engine badges. Enginesshows one row per CLI on that machine, with thedevicefield pointing at it (sandbox credentials report on the Cloud Sandboxes page, per the constraint above).- The
role tagsin the engine details match expectations; nodes that select engines by scene also need the matching scene ticked underscene tags— a new engine has no scene bound by default.
How a task reaches an engine
Scene node (Agent / Skill)
→ Select an available engine
→ The scheduler matches scope, role tags, scene tags, and engine_runtime_ids
→ The Worker claims the task
→ The engine starts the Agent and executes the Skill
→ Logs and status are written back to the pipeline
| Stage | Where to configure | Description |
|---|---|---|
| Which Agent / Skill the node uses | Scene node | Determines what the task does |
| Which engines may claim the task | Scene node / engine role tags | Without configuration, the task is broadcast to the global pool |
| Which engine must claim the task | Scene node engine_runtime_ids |
When configured, only engines in the list may claim the task |
| What happens when an engine is offline | strict_scene_engines in configs/engine-selection.json |
Strict by default: an empty candidate set fails without falling back to the global pool |
Target a specific engine
engine_runtime_ids on a scene node is a hard dispatch constraint:
{"id": "vod", "tag": "vod", "skill": "vod-cli", "mode": "emit", "next": "issue", "engine_runtime_ids": [17042]}
- Configured: only engines in the list may claim the task. If all listed engines are offline, their heartbeats time out, or they are unregistered, the task fails explicitly with a reason and does not fall back to the global pool. When a bound engine is online but its health score is too low, Grape waits 120 seconds (
HEALTH_STALE_QUEUED_THRESHOLD, default 120) and then converges: tasks on engines you bound explicitly fail, while tasks on system-selected engines have their allowlist cleared and are queued again. - Not configured: any matching online engine may claim the task, which is the default broadcast behavior.
Strict mode lives in configs/engine-selection.json:
{"strict_scene_engines": true}
The default is true, also when the key is absent from the file: an empty candidate set fails. Only false falls back to the global pool, and that also leaves a warning in the logs.
A single machine runs at most 20 tasks concurrently by default (RUNTIME_MAX_CONCURRENT_TASKS). Tasks beyond that limit queue on that engine and are not moved to another machine, unless the engine is outside the dispatch range.
No engine, or tasks are not dispatched
Premise: an online device does not necessarily have an engine. Check in order and stop at the first match.
| Step | Check | Action |
|---|---|---|
| 0 | Did you connect with a sandbox credential? | Sandbox artifacts live on the Cloud Sandboxes page; no plain engine rows under Engines is expected |
| 1 | Device status under Workers |
If offline, check the runtime process, outbound network, and whether the credential was revoked |
| 2 | Is the engine installed locally? | which opencode; which hermes; which codex; install it if empty. No runtime restart is needed afterwards |
| 3 | Installed but invisible on the platform | The runtime discovers engines using the service process PATH, which is usually shorter than a login shell. Link the CLI into a PATH directory or ~/.local/bin, then restart the runtime (see below) |
| 4 | Engine shows "unhealthy" or red | The CLI was found but --version fails (timeout, missing dependencies, ACP handshake failure, failed model or provider check): run opencode --version, then journalctl -u runtime-agent -n 200 \| grep -Ei 'engine\|probe\|discover'. Such engines register but receive no tasks |
| 5 | Engine healthy but no task is dispatched | Check in order: every role tag disabled or the required role missing; no scene tag on nodes that select by scene; scope not matching the task repository; leftover filters in the filter bar (click ✕ Clear); low health score or concurrency full (see "max concurrent" in the details) |
| 6 | It existed and then disappeared | Offline for more than about six days and marked "to be reclaimed"; credential revoked; filtered out after switching repository or organization |
Handling step 3:
# Root / systemd installation: link into the system PATH, then restart the matching unit
# (the unit name may be runtime-agent or runtime-agent-<instance key>; check systemctl list-units)
sudo ln -sfn "$(which opencode)" /usr/local/bin/opencode
sudo ln -sfn "$(which hermes)" /usr/local/bin/hermes
sudo systemctl restart runtime-agent
# User installation: link into the discovery fallback directory, then rerun the one-click command so the process rescans
mkdir -p ~/.local/bin && ln -sfn "$(which opencode)" ~/.local/bin/opencode
Common pitfalls
A Worker can register without engines
RuntimeAgent registered: [] in the logs is not an error. After installing an engine there is no need to restart the Worker; it registers within a minute. If the engine lives outside the service process PATH, only the 10-minute periodic probe will find it, so handle step 3 in the previous section instead.
codearts exits immediately in a non-terminal environment
Under systemd or nohup, the codearts CLI folder-trust gate exits with code 1 when it meets an untrusted directory, and the symptom is "the engine is online but every task fails". Grape merges the task working directory into trustedFolders automatically; only a manually installed codearts needs the fix in Error codes: folder-trust.
| Problem | Consequence | Action |
|---|---|---|
| Installing a runtime as both root and a regular user | Two processes fight over one credential and overwrite each other's registration | One credential and one runtime per machine |
| Not saving the token | The platform cannot reissue it | Save it at generation time; revoke and recreate if it leaks |
| Always choosing the Global scope | Private code may land on someone else's machine | Use Repository or Personal for private repositories |
| Restarting the whole machine or unrelated services | Running tasks are interrupted | Restart only runtime-agent |
| Keeping devices for machines that stay asleep | Offline nodes that make tasks queue | Revoke devices you no longer use |
Engines and Agent roles
| Engine | Installation | Can it be installed on your own machine? | Role |
|---|---|---|---|
opencode |
npm install -g opencode-ai |
Yes | All roles by default |
hermes |
Install Hermes Agent from its official documentation | Yes | All roles by default |
codex |
npm install -g @openai/codex |
Yes | All roles by default |
codearts |
pip install codearts-cli |
Yes | All roles by default |
atomcode |
npm install -g @atomgit.com/atomcode |
Yes | All roles by default |
dsh |
Install the dsh CLI; add the plugin with dsh plugin --profile <profile> add @grape-dev/grape-dsh |
Yes | All roles by default |
AI Shell |
Registered automatically by an AI Devspace environment | No (cloud environment) | Follows the scene |
Roles are not mapped from the engine type: capabilities are independent of engine type. When a new engine has no role configuration at all, the runtime adds the "all" row, which is why roles are unrestricted by default. To narrow them, tick roles under "role tags" in the engine details, for example
["coding","issue","qa"]. Disabling every role makes the card show "disabled", and then no task will select that engine. "VOD must use hermes" is therefore a recommended pairing, not a platform rule.
Related
Scenes and engine configuration | Engine overview | Error codes

