How agent to agent communication works across Cohub Spaces
An agent can send a prompt to another Space with spaces prompt --reply. When that Chat's turn finishes, its final reply comes back to the calling Chat as a message, and the calling agent continues.

- Who
- Teams that run agents in several Spaces and want one agent to use another Space's files or tools.
- When
- The task needs a Space that holds other context or tools, and the first agent should continue with the answer.
- Why
- The reply returns to the Chat that sent the request, so the handoff stays in one thread with its turns on record.
When an agent working in one Cohub Space needs files, checks, or tools that live in another Space, it can delegate that step with cohub spaces prompt --reply. The receiving Space runs its own turn and sends its final answer back to the sending Chat, so the first agent picks up right where it paused.
What one handoff does
A --reply handoff ties a new turn in the target Space back to the exact Chat and turn that called it. In one round trip, four things happen in order:
- Inside its own Chat, the sending agent runs
cohub -s <space> spaces prompt --reply "…". - The receiving Space opens a turn whose
originmetadata records the caller'ssessionIdandturnId. - The receiving agent finishes its turn and returns its final message to the sending Chat.
- That reply wakes the sending agent so it can continue the original task with the returned answer.
A run you can repeat
You can verify the full loop with a minimal check between two Spaces. In a test run from the SEOer Space to a separate test Space, the sending agent ran:
cohub -s <receiving-space-id> spaces prompt --reply "Reply with only the word pong." --jsonThe JSON response returns the new session ID along with the origin block pointing back to the caller:
"session": { "spaceId": "6be2376f-…", "meta": { "origin": { "kind": "prompt", "sessionId": "3eea2d70-…", "turnId": "3fd2bf64-…" } } }Waiting on the remote turn with cohub -s <receiving-space-id> spaces sessions turns wait <sessionId> <turnId> completed and printed pong. Moments later, the sending Chat received the queued reply:
Reply from @[test11](cohub://spaces/6be2376f-…/sessions/9b903982-…): · pongRun a one-word probe like this before wiring a real workflow around --reply, and confirm both that the remote turn finishes and that the reply lands in the calling Chat.
When to hand off, and when to stay
Send work across Spaces when the second Space owns something the current Space cannot read or run—a private repository check, a dedicated lookup, or files outside /workspace—and the next step depends on that answer. Keep the work in the current Chat when all needed files already sit in the local Space, because splitting a local step only adds a boundary you have to brief across.
Write each handoff as one self-contained question with a clear output format. Because the receiving Space starts from your prompt alone, naming the exact inputs and expected response shape avoids a second round trip.
What the sending Chat sees
While the receiving Space executes, the outgoing message in the sending Chat stays marked "awaiting reply". Any commands, reads, or intermediate reasoning the remote agent performs stay inside the receiving Space's own Chat history rather than cluttering the caller's thread.
Once the remote turn ends, only its final reply arrives in the sending Chat as a queued message prefixed with the receiving Space and session link, waking the sending agent to resume.

--reply is a flag on cohub spaces prompt. Run cohub spaces prompt --help to inspect the full option set, or check the CLI doc for each flag's behavior.
Limits of a reply
Three guardrails govern how --reply behaves:
- Incompatible flags: the CLI rejects
--replycombined with--wait,--note, or any scheduled delivery flag. - No shared thread history: the receiving Chat sees only the prompt string you pass, so every file path, identifier, and format requirement has to go into that message.
- Bounded nesting: reply chains cannot wake callers indefinitely. A calling Chat is woken again only while delegation depth stays within
MAX_REPLY_WAKE_DEPTH = 4.
Reference in the docs
This page: Whether a task should go to another Space with --reply, or stay in the current Chat.
Related
- Context network: share context between AI workspaces
Cohub's context network is how you share context between AI workspaces: @mention a Space for one message, mount it as a read-only Mod, fork a Save into a new Space, or hand work to another Space.
- How shared AI context works when a team shares one Cohub Space
Cohub provides shared AI context for teams: Chats in a Space are visible to its members, the agent works on the same files for everyone, and anyone can continue or fork a teammate's thread.
- How to run a multiplayer AI chat in one shared Cohub Space
Cohub turns a multiplayer AI chat into a shared project: friends join one Space, talk to the same agent, see each other's Chats and files, and publish the result as an App.