Skip to main content

Overview

Broker sits between an Axon and an agent process running inside a Devbox. The Axon is the system of record and Broker is the bridge that turns stream events into serialized agent work - managing the agent lifecycle, forwarding events, and recording output back to the stream.

Start an ACP Agent

Set up any agent that implements the Agent Client Protocol.

Launch and run Claude

See how broker can launch and interface directly with Claude Code CLI.

Understand the Event Flow

Understand how events move between Axon, Broker, and your agent.
Broker’s job is to:
  • start and manage the agent process
  • receive user and external events from the Axon stream
  • forward them to the agent through the configured protocol adapter
  • publish agent output back to the same Axon stream
  • enforce serial turn execution so only one turn runs at a time
This separation is what lets Axon act as the shared event bus while agents remain isolated behind a stable event interface.

Supported Protocols

Runloop currently supports the following Broker protocols:
  • acp for agents that implement the Agent Client Protocol over stdin/stdout
  • claude_json for Claude Code CLI in streaming JSON Lines mode
Configure a broker_mount on your Devbox to select the protocol adapter and attach Broker to an Axon stream.

Event Flow

Broker owns the turn lifecycle:
  1. It reads inbound events from Axon.
  2. It starts a turn when it receives a user or external event.
  3. While that turn is running, additional inbound turn-starting events are queued.
  4. It publishes turn output back into Axon as structured events.
  5. When the turn completes, it moves back to idle and processes the next queued event.

Responsibilities

Message Forwarding

Broker consumes inbound events from Axon and forwards them to the attached agent. The event_type indicates the protocol method (e.g., query for Claude, session/prompt for ACP).

Turn Serialization

Broker enforces one active turn at a time. This prevents overlapping agent turns and gives downstream consumers a clear ordered stream of turn output.

Event Publishing

Broker republishes agent and turn lifecycle output back into Axon so clients can subscribe to the same stream they published into. Each agent will publish events native to their Protocol schema. Separately, broker sends a set of standardized events:
Event TypeOriginDescription
turn.startedSYSTEM_EVENTA new turn has begun
turn.completedSYSTEM_EVENTThe turn is completed

Loop Prevention

Broker ignores agent- and system-originated events when reading from Axon so it does not re-consume its own output.

Protocol Forwarding

Broker is protocol-agnostic. It launches agent binaries, understands each protocol to manage turn lifecycle, and forwards protocol-specific messages between the Axon stream and the agent process. Events published to and from Axon remain protocol-specific—Broker does not normalize them into a common schema. Clients should send and receive events in the format defined by the agent’s protocol.