Operations
Connect a worker
Connect a worker when a loop step needs code that runs in your own process, network, or model stack. The worker opens an outbound connection to Mobius, claims compatible action work, returns results, and heartbeats until it exits.
What you'll build
- A project-scoped API key for a machine identity.
- A local stock worker on the
defaultqueue. - A one-step action loop that calls the stock worker's
printaction.
Prerequisites
- The
mobiusCLI installed. - A project handle. The examples use
platform. - Permission to create API keys and operate workers.
1. Create a worker key
Create a project-scoped key from Govern > Machine identities or follow Create an API key. Export it in the shell that will run the worker:
export MOBIUS_API_KEY="mbx_..."
export MOBIUS_PROJECT="platform"Use a worker-scoped machine identity for production. A personal login works for testing, but it is harder to rotate and audit.
2. Start the stock worker
Run the worker on the default queue:
mobius worker --queues default --concurrency 5The stock worker registers small built-in actions such as print, json,
time, random, and fail. Leave the process running while you start a run.
3. Create a worker-backed loop
Create a loop with one action step:
schema_version: "1"
name: worker-smoke-test
description: Send one print action to a connected worker.
concurrency: allow
triggers:
- key: manual
kind: manual
enabled: true
steps:
- key: print
name: Print message
kind: action
config:
action_name: print
parameters:
message: "Hello from Acme platform."Start the loop manually from the app or the runs API.
4. Check the run
The run should suspend while the worker owns the action, then complete:
run.started
step.started step=print kind=action
action.called action_name=print
action.completed action_name=print
step.completed step=print
run.completedIf the run stays suspended, check the worker process first. It should be
online, heartbeating, and connected to the same project and queue as the action
step.
Operating notes
- Use
--concurrencyfor one process with several in-flight actions. - Use
--workersonly when you need several independently visible worker sessions inside one CLI process. - Split queues when slow actions should not block fast ones.
- Keep API keys narrow. The worker preset should be enough for claiming and completing worker-owned action work.
Next
- Understand worker sessions in workers.
- See worker-owned records in worker loops.
- Attribute machine access through API keys.