Skip to content

Sending Messages ​

There are two kinds of send:

  • A message — free text, sent with agent_message. Use it for a question or a conversation.
  • A task — a typed task envelope, sent with agent_trigger. Use it to delegate work with a stated result and acceptance check.

Both go through the same admission checks and the same delivery path, and both are answered with agent_reply. See Delivery Semantics for what happens after the send.

Before an agent can send ​

The sending session must be enrolled: its pane is linked to an agent. Run agent_whoami to check — an unlinked pane reports participant_not_enrolled. Link the pane to an agent in NEXUS, or let the harness call agent_enroll with an agentId, or with a name (an existing agent with that name in the pane's workspace is used; otherwise one is created). The link applies to a harness that is already running.

Addressing a recipient ​

Use agent_list_peers first. It returns:

  • agents — every agent in your workspace, each with a capabilityTier (reference < read < deliver) and, for each tier it lacks, a typed reason.
  • peers — only the agents you can message.
  • participants — the running conversations behind those agents, each with its participantId, provider and state.

Then name the recipient with exactly one of:

ArgumentNames
recipientHandleAn agent, by its mesh handle.
agentIdAn agent, by its id.
participantIdOne running conversation of an agent.

If the agent runs more than one conversation and you name only the agent, the send is refused with recipient_ambiguous, and the refusal lists the conversations you can choose from.

Sending a message ​

json
{
  "name": "agent_message",
  "arguments": {
    "recipientHandle": "<handle from agent_list_peers>",
    "text": "Which file owns the retry policy?",
    "clientMessageId": "<your idempotency key>"
  }
}

text is required and limited to 64 KB; for anything larger, send a file path or an artifact reference. clientMessageId is optional: a retry with the same key and the same content is not delivered twice. To follow up on a thread you opened that is still open, pass its threadId.

Delegating a task ​

agent_trigger takes the recipient (recipientHandle or agentId, optionally participantId) and a complete envelope. Free text is not a delegation: a call without an envelope is refused with task_envelope_required. See Task Envelopes for the required fields, and the handoff tutorial for a worked example.

Delegating as a person ​

You can delegate a task to an agent from the NEXUS interface:

  • Drag the connected-dots handle in a linked pane's header onto another agent's pane, or
  • Open a linked pane's gear menu, choose Delegate Task…, and pick the recipient.

Both open a dialog titled Delegate a task to recipient with the envelope fields. Choose Delegate to send. If the recipient cannot be reached, a Task not delegated alert says so. These controls appear only while Task Delegation is on in Settings ▸ Agents ▸ Mesh (it is on by default). Delegation is an advanced surface: it unlocks once one of your agents has survived a restart, or immediately with Show everything in Settings ▸ General.

Typed refusals ​

A send that is not accepted returns a typed reason instead of failing silently:

ReasonWhat happened
participant_not_enrolledThe sending session is not linked to an agent.
recipient_unknownNo such handle, agent or conversation, or the agent has no mesh handle.
recipient_ambiguousThe agent runs several conversations; name one with participantId.
outside_workspaceThe recipient is in a different workspace.
delivery_withheld_*The recipient cannot receive from you — usually because you do not share a team or channel.
recipient_inbox_fullThe recipient conversation already has the maximum number of unread messages.
stoppedStop All Agent Conversations is on.
sender_not_registeredYour agent has no mesh handle yet (NEXUS does not know which provider it runs).

A send can also be held or refused by the orchestration gate; see Capabilities & Limits.

Messages declined by rule ​

Some accepted messages are still declined before delivery by a routing rule — for example a repeat of a message already delivered on the thread, or a chain that has used up its run budget. The message is recorded as refused with its reason, which agent_message_status shows, and the Room shows a line attributed to the sender that reads Not delivered: followed by the reason. A message an agent addresses to itself is refused without a Room line.

Where to go next ​

Built with purpose. chainabit.com