Skip to content

feat(agent): message another agent's orchestrator through the daemon - #1942

Merged
edenreich merged 1 commit into
mainfrom
feat/agent-peer-messages
Nov 23, 2026
Merged

edenreich merged 1 commit into
mainfrom
feat/agent-peer-messages

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

Summary

An orchestrator could only message its own subagents or its lead, so Agent(to: "tester") from a chat opened as researcher bounced with "you have no lead and no subagents to message". The model then spawned a generic subagent labelled "tester" instead. The desktop listed it under the researcher's chat, and the tester agent itself never saw the message.

Now an agent with no lead can message another Markdown agent by name. The daemon starts that agent in a top-level session of its own, and every session records how it started, so clients can show the agent, the label and the sender.

Changes

  • Messaging another agent (internal/tools/agent_message.go) - when to names no teammate and the caller has no lead, a Markdown agent of that name starts as a peer:
    • It runs as a top-level thread on the daemon. The thread is opened with agent: <name> and resolved the way a chat opened as that agent is, with a plain session id and no subagent spawn. It is placed on the agent's workspace when the agent has one.
    • Its first turn is [Message from <sender>] with the text.
    • The sender follows it as a keep-alive job, so its turns and its Agent(to: "<sender>") replies come back to the sender. The sender's next message continues the same session.
    • A peer's interrupts stay open for whoever opens its chat, while a subagent's are still cancelled.
    • Without the daemon binding the message is refused.
  • Session origin - convdomain.Origin holds parent_session_id, invoked_by, agent, label and sent_by, and is embedded in the conversation metadata and summary.
    • infer conversations list and show --format json emit it.
    • Workers get it through INFER_SESSION_AGENT, INFER_SESSION_LABEL and INFER_SENT_BY.
    • ThreadOptions.Origin carries it across teleports.
    • ResolveThreadAgent records the resolved agent, so a chat opened as an agent lists its agent too.
  • Peer worker - a worker with INFER_SENT_BY reports its turns and gets a team channel the way a subagent does.
  • Relaying - the lead also keeps a message addressed to its own agent name.
  • Docs - the Agent.yaml description and its tool-definitions golden, docs/subagents.md (Messaging Another Agent), and internal/sessions/README.md.
  • Tests - starting and continuing a peer, refusal without the daemon, interrupts left open only for a peer, relaying to the lead's own name, origin stamping and listing, worker env and Portable, and resolver recording.

Impact

inference-gateway/desktop reads agent, label and sent_by from the listing in a follow-up pull request, once this is released and .cli-version moves to it.

Docs ticket draft for inference-gateway/docs:

[DOCS] Document messaging another agent and the session origin fields

The CLI's Agent tool now lets an agent with no lead message another Markdown agent by name. That agent starts in a session of its own on the daemon, and infer conversations list --format json shows each session's agent, label and sent_by. Affected pages: the subagents and teams guide, and the conversations command reference.

An orchestrator's Agent(to: "<agent>") used to bounce unless the name was one
of its own subagents or its lead. Now an agent with no lead can message
another Markdown agent by name. The daemon starts that agent in a top-level
session of its own, the way a chat opened as that agent runs, on its workspace
when it has one, with [Message from <sender>] as its first turn. The sender
follows it like a teammate: its turns and replies come back, and the next
message continues the same session. Its approvals stay open for whoever opens
its chat instead of being cancelled.

Every session now records how it started. The conversation metadata embeds an
Origin value object with the agent it runs as, the label its orchestrator gave
it and the session whose message started it (sent_by), next to
parent_session_id and invoked_by. Thread options carry the origin across
teleports, and conversations list and show emit it.
@edenreich

Copy link
Copy Markdown
Contributor Author

Rooms build on this: room member sessions reuse the session origin added here (it gains room). Tracking issue: #1943.

@edenreich
edenreich merged commit 10d0605 into main Nov 23, 2026
14 checks passed
@edenreich
edenreich deleted the feat/agent-peer-messages branch November 23, 2026 01:23
@edenreich edenreich moved this from Todo to Done in 2026 Nov 23, 2026
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.267.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant