Skip to main content

Overview

The Claude adapter connects Broker to a Claude Code CLI subprocess running inside your Devbox. It launches Claude Code with --output-format stream-json and forwards streaming JSONL messages between Broker and the CLI. For the full wire protocol specification, see the Protocol Spec.

Getting started

To try out fully working code examples, check out the axon-broker-agents example repo. Clone the repo and run the test commands. The example will create a Devbox with Claude and start a “hello world” conversation by publishing an Axon event.

Broker mount configuration

How Broker uses Claude JSONL

  • Broker launches Claude Code with --output-format stream-json when the Devbox starts
  • Claude initializes and sets up the session
  • Publish query to the Axon to start a turn
  • Broker translates that event into Claude’s user JSONL input
  • Claude output is republished to Axon. Event event_type represents the Claude message type to deserialize.

Send a simple message to Claude

Create a Devbox with a Claude Broker mount and send a ‘hello world’ message to Claude.
1

Create Devbox with Broker

Create an Axon for communication and launch a Devbox with Claude Code mounted via Broker:
2

Connect to Claude

Open the client connection and complete the handshake before calling send() in the next step so response listeners can be registered first:
3

Print Assistant Response

Subscribe to the Axon stream and print agent responses:

Handling control requests from Claude

During a session, Claude may ask the user a question or request permission before taking an action - these arrive as control request events on the Axon stream. When you receive one, you can either prompt your user for input or respond automatically by publishing a control response.
There are many types of control responses for responding to Claude. See the Protocol Spec for complete details on all available response types and structures.

Interrupt a turn

Stop Claude’s current response by sending an interrupt control request:

Building a complete integration

The examples above cover basic messaging and interrupts. To build a production-ready integration, you should become familiar with the full set of Claude control request and response types — these are the building blocks for handling every interaction Claude can initiate during a session. Claude may emit control requests for a variety of reasons, including:
  • Permission requests — Claude asks for approval before executing commands, writing files, or taking other actions
  • User questions — Claude asks the user for input or clarification
  • MCP server interactions — Claude requests access to MCP tool servers
Each control request type has a corresponding response structure that your application needs to handle. You can respond automatically (e.g., auto-approving safe commands) or route requests to a human for review. See the Claude JSONL Protocol Spec for the complete reference on all control request and response types, output message formats, and session lifecycle events.