---
title: "Inter-Organization Communication"
description: "Delegate tasks to specialized assistants in other organizations to build secure, multi-agent workflows."
updated: 2026-06-09
---

# Inter-Organization Communication

As your organization grows, a single monolithic assistant becomes difficult to manage. You might want an IT bot that manages AWS, an HR bot that handles payroll queries, and a DevOps bot that deploys code. Each is its own assistant, with its own tools and credentials.

Inter-Organization Communication allows these isolated assistants to talk to each other. An orchestrator bot can receive a complex user request, break it down, and spawn parallel tasks in specialized assistants — gathering the results without ever exposing the underlying credentials or tools of one assistant to another.

## Why use multi-agent workflows?

:::cards 2

===card
title: Security & Isolation
icon: shield-check

**Keep credentials separated.** An HR bot doesn't need AWS keys, and a DevOps bot doesn't need payroll access. Sub-chats ensure tools, data, and credentials remain isolated in their respective assistants.

===card
title: Parallel Execution
icon: git-branch

**Run tasks concurrently.** An orchestrator can ask the Sales bot for Q3 metrics and the Marketing bot for Q3 spend simultaneously, wait for both to finish, and synthesize the final report — all in one turn.

:::

## How it works

In Toolbelt, cross-organization delegation is implemented through **Sub-Chats**. A sub-chat is a targeted, single-turn prompt sent from one assistant (the "caller") to another assistant (the "target").

The interaction is headless and asynchronous:

1. The caller sends a prompt to the target assistant using the `create_sub_chat` action.
2. The target assistant executes the task using its own tools, memory, and databases.
3. The target returns its final text response back to the caller.

> **Note:** Sub-chats are strictly request-and-response. The caller only receives the final output string — it does not see the intermediate tool calls, the internal reasoning, or any files belonging to the target assistant.

## Implementation guide

### Step 1: Create the sub-chat

Use the `create_sub_chat` Toolbelt action to spawn a task in the target assistant. You need two things:

- `targetAssistantId` — the UUID of the assistant you want to call.
- `content` — the prompt you want to send.

```json
{
  "action": "create_sub_chat",
  "params": {
    "targetAssistantId": "12345678-abcd-efgh-ijkl-1234567890ab",
    "content": "Generate a summary of Q3 marketing spend. Return only the total number and the top three categories."
  }
}
```

The action returns immediately with a `correlationId` and a `status` of `"pending"`. The target assistant begins working in the background.

> **Tip:** You can call `create_sub_chat` multiple times before calling `sleep` — all the tasks run in parallel. This is the recommended pattern for fan-out workflows.

### Step 2: Wait for completion

Because sub-chats run asynchronously, the orchestrator must pause and wait. Use the `sleep` action to suspend execution until one or more tasks finish.

```json
{
  "action": "sleep",
  "params": {
    "timeoutSeconds": 45,
    "wakeOnAnyComplete": true
  }
}
```

The orchestrator suspends. It wakes up when either:

- One or more sub-chats complete (`wokeReason: "sub_chat_complete"`).
- The timeout elapses (`wokeReason: "timeout"`).

### Step 3: Process the result

When `sleep` returns, the response includes a `subChats` array. Each completed entry has the target's response in `lastMessage`.

```json
{
  "wokeReason": "sub_chat_complete",
  "subChats": [
    {
      "correlationId": "dlg_abc123",
      "status": "completed",
      "calleeOrganizationName": "Marketing Assistant",
      "lastMessage": "Q3 Marketing Spend: $45,000. Top categories: 1. Ads ($20k) 2. Events ($15k) 3. Software ($10k)."
    }
  ]
}
```

The orchestrator can now incorporate this response into its own reasoning, pass it to another tool, or format it for the user.

### Handling still-running tasks

If `sleep` times out before a sub-chat finishes, that entry will still show `"status": "in_progress"`. You have two options:

1. **Call `sleep` again** to continue waiting.
2. **Use `get_pending_sub_chats`** to poll for the latest status without blocking.

> **Warning:** Do not assume a timed-out sub-chat has failed. Specialist tasks that involve heavy database queries or external API calls may simply need more time. Always check the `status` field before treating a result as missing.

---

## Parallel fan-out pattern

The most powerful use of Inter-Organization Communication is running multiple specialist tasks in parallel and merging the results. Here is the full pattern:

```
# 1. Spawn tasks in parallel
create_sub_chat → Sales Assistant     (correlationId: dlg_111)
create_sub_chat → Marketing Assistant (correlationId: dlg_222)
create_sub_chat → Finance Assistant   (correlationId: dlg_333)

# 2. Wait for all to complete
sleep(timeoutSeconds: 60)

# 3. Merge all three lastMessage values into a unified report
```

Because all three `create_sub_chat` calls happen before `sleep`, Toolbelt runs them concurrently. The total wait time is roughly the slowest of the three — not the sum of all three.

---

## Best practices

### Write self-contained prompts

Target assistants do not share the conversational context of the orchestrator. Every prompt you send via `create_sub_chat` must include all the information the target needs to succeed. Never assume the target remembers earlier parts of the conversation.

```
❌ "What were the numbers we discussed earlier?"
✅ "What was the total revenue for Q3 2025 from the sales_data.duckdb database? Return only the number."
```

### Constrain the output format

Ask the target to return JSON, a number, a bulleted list, or another machine-readable format. This makes it far easier for the orchestrator to parse and merge responses from multiple bots.

```
"Return your answer as JSON: { total: number, categories: string[] }"
```

### Set realistic timeouts

Choose a `timeoutSeconds` value based on what you expect the target to do. A simple lookup might finish in 5 seconds; a multi-step analysis across a large database might take 60 or more.

> **Tip:** If you are unsure how long a task will take, set a generous timeout (90–120 seconds) and let `wakeOnAnyComplete: true` return early when results are ready.

---

## Related pages

- [Sub-Chats](https://docs.apexti.com/features/sub-chats.md) — Full reference for the `create_sub_chat`, `sleep`, and `get_pending_sub_chats` actions.
- [Wrenches](https://docs.apexti.com/features/wrenches.md) — Package repeatable MCP workflows into reusable scripts.
- [Scheduled Tasks](https://docs.apexti.com/features/scheduled-tasks.md) — Trigger orchestrator workflows on a schedule.
