pause, resume, and cancel operate at the job level, while send_message targets a specific agent within a job. All four functions route transparently across control and runtime nodes, so you do not need to manage cluster topology when calling them.
MirrorNeuron.pause/1
Pauses all agents in a running job. Paused agents stop processing new messages but retain their current state. Messages delivered while paused accumulate in each agent’s mailbox and are processed when the job resumes.
The unique job identifier returned by
run_manifest/2.Return value
Returns:ok on success, or {:error, reason} if the job cannot be found or the pause signal cannot be delivered.
- Success
- Error
Example
You can verify that all agents are paused by calling
inspect_agents/1 and checking the "paused" field in each agent’s metadata. Agents that have already completed their work before the pause signal arrives will not be retroactively marked as paused.MirrorNeuron.resume/1
Resumes a paused job. All agents that were paused begin processing their accumulated mailbox messages immediately after receiving the resume signal.
The unique job identifier of a currently paused job.
Return value
Returns:ok on success, or {:error, reason} if the job cannot be found or the resume signal cannot be delivered.
- Success
- Error
Example
MirrorNeuron.cancel/1
Cancels a running or paused job. The runtime signals all agents to stop processing, transitions the job to the "cancelled" terminal state, and persists the final record in Redis.
The unique job identifier.
Return value
Returns:ok on success, or {:error, reason} if the job cannot be found or is already in a terminal state.
- Success
- Error
Example
MirrorNeuron.send_message/3
Delivers a message directly to a specific agent within a running job, bypassing the normal workflow routing rules. Use this for manual intervention, sensor-style external event injection, or testing agent behavior without running a full upstream pipeline.
The unique job identifier.
The identifier of the target agent within the job. Use
inspect_agents/1 to enumerate available agent IDs.The message payload to deliver. MirrorNeuron wraps this map in a runtime message envelope before dispatching it to the agent’s mailbox. The shape of the
payload field is agent-type and template-specific.Return value
Returns:ok when the message is successfully enqueued in the target agent’s mailbox, or {:error, reason} if the agent cannot be found or the job is not running.
- Success
- Error
Message payload shape
Themessage argument is a map you construct directly. A typical message for an executor or router agent looks like this:
Examples
Inject a task into a specific executor agent:send_message/3 delivers to the agent’s mailbox asynchronously. The agent processes the message according to its own concurrency model. Use inspect_agents/1 or events/1 after delivery to observe the effect.