Skip to main content
Orchestration

Agent-to-Agent Communication

Use host tools to let agents communicate with each other.

Agents communicate through host tools. You define a toolkit that lets one agent send work to another, and the agent calls it like any other CLI command.

Example: code writer + reviewer

This example creates a writer agent with a review tool. When the writer calls the tool, it reads the file from the writer’s VM, writes it to a separate reviewer VM, and sends a review prompt.

The writer agent sees the review tool as a CLI command:

agentos-review submit --path /home/user/api.ts

When the writer calls this, the host tool reads the file from the writer’s VM, writes it to the reviewer’s VM, and sends a prompt to the reviewer. The review result is returned to the writer as JSON.

Why host tools?

Host tools are the natural communication layer between agents because:

  • The agent doesn’t need to know about other agents. It just calls a tool. You can swap the implementation without changing the agent’s behavior.
  • No credentials in the VM. The host tool executes on the server, so it can access other agents directly without exposing connection details.
  • Composable. Chain any number of agents by adding more tools. Each tool is a self-contained bridge to another agent.

Recommendations

  • Each agent has its own isolated VM and filesystem. Use readFile/writeFile in host tools to pass files between them.
  • Use Queues when agents need to process work asynchronously.
  • Use Workflows to make multi-agent pipelines durable across restarts.