OptionalafterOptionalappendText appended to the system prompt (whether default or overridden by
systemPrompt) during the initialize handshake. Use this to
inject additional instructions without losing the agent's built-in
prompt.
OptionalbufferWhen true, agent events are buffered until a pull-side generator
(receiveAgentEvents) drains them. Set to false for a
connection consumed only through push-side listeners and request/response
methods: an event is delivered to a generator that is already awaiting it
and otherwise dropped, so the buffer never grows on a long-lived
connection nobody drains.
OptionalmodelAnthropic model identifier to select after initialization
(e.g. "claude-haiku-4-5", "claude-sonnet-4-5").
When provided, initialize() sends
a set_model control request immediately after the initialize
handshake completes.
OptionalonAsync teardown callback invoked by disconnect() (e.g. devbox shutdown).
OptionalonCalled when a non-critical error occurs (e.g. unparseable event,
listener exception). Defaults to console.error.
OptionalreplayWhen true, the connection queries the axon for the current head
sequence and replays all events up to that point without invoking
handlers. Unresolved permission/control requests are dispatched
to handlers after replay completes. Timeline events are emitted
for all replayed events regardless.
Set to false to replay the full history with handlers firing for
every event (legacy behavior).
Combine with afterSequence to bound the replayed range to
(afterSequence, head] instead of the whole channel.
OptionalsourceThe source string attached to every event this client publishes to
the Axon API. Use it to identify which client produced a user prompt
(e.g. distinguishing multiple integrations writing to the same channel).
Defaults to the built-in client identifier ("claude-sdk-client",
"acp-sdk-client", or "codex-sdk-client" depending on the connection
type).
OptionalsystemReplaces the default system prompt sent to Claude Code during the
initialize control handshake. When set, the agent uses only this
text as its system prompt — the built-in prompt is discarded entirely.
Mutually independent of appendSystemPrompt; if both are
provided, systemPrompt replaces the default and
appendSystemPrompt is appended to that replacement.
OptionalverboseWhen true, emit timestamped diagnostic logs to stderr for every
transport read/write and lifecycle event.
Useful during development; too noisy for production.
Axon sequence number to resume from. When set, the initial SSE subscription uses
{ after_sequence }so only events after this sequence are delivered — earlier events are never requested.Omit (or pass
undefined) to start from the beginning of the Axon channel.Composes with replay:
replay: true(the default) — bounded replay. The connection still resolves the channel head and treats the events in(afterSequence, head]as history: timeline listeners receive each one, control/permission requests are paired with their answers, and only the still-unanswered requests reach handlers once the head is passed. If the head is at or belowafterSequencethere is nothing to replay and the first event delivered is live.replay: false— live-only. Every event afterafterSequenceis dispatched to handlers as it arrives, including requests that a later event in the log already answered.Typical usage: persist
AxonEventView.sequencefrom a previous session, or the start of the turn you care about, and pass it here so a long-lived channel does not replay from sequence 0.Codex: with a bound past the
thread/startedframe the connection never observes the thread id, sothreadIdstaysundefinedafterconnect(). Seed it with the CodexthreadIdoption or callresumeThread(threadId).