feat: add skipRelayPrompt flag to skip MCP injection on spawn#532
feat: add skipRelayPrompt flag to skip MCP injection on spawn#532khaliqgant merged 6 commits intomainfrom
Conversation
When spawning agents for minor tasks where relay messaging isn't needed, the relay MCP configuration and protocol prompt injection can now be skipped by setting skipRelayPrompt: true. This saves time and tokens for lightweight worker agents. Changes: - Rust broker: skip MCP config args and relay env vars when flag is set - TypeScript SDK: add skipRelayPrompt to spawn options and client API - Python SDK: add skip_relay_prompt to spawn methods - Protocol: add skip_relay_prompt to spawn_agent payload Closes #419 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…Rust type - Add missing skipRelayPrompt passthrough in spawner's headless spawnProvider call - Change skip_relay_prompt from Option<bool> to bool with serde(default) in SpawnPayload Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
khaliqgant
left a comment
There was a problem hiding this comment.
Review: skipRelayPrompt flag
Overall well-structured PR — clean propagation across Rust broker, TypeScript SDK, and Python SDK.
Fixed (pushed to branch)
-
Bug: Missing
skipRelayPromptpassthrough in spawner headless path (relay.ts:~1253)
Thespawner()method's headlessspawnProvidercall was missing theskipRelayPromptoption. Callingspawner().spawn({ skipRelayPrompt: true })with a headless provider would silently ignore the flag. Fixed in 643121d. -
Simplified
Option<bool>toboolinSpawnPayload(main.rs:~450)
Sinceskip_relay_promptalways defaults tofalseand was unwrapped with.unwrap_or(false)at the single usage site, changed toboolwith#[serde(default)]to remove unnecessaryOptionwrapper.
Suggestions (not blocking)
-
Protocol type completeness (
protocol.ts:52): TheSdkToBrokerspawn_agentpayload is still missingidle_threshold_secsandcontinue_fromfields that the RustSpawnPayloadaccepts andclient.tssends. Good opportunity to add them while touching this type. -
Tests: No tests were added or updated. An integration test verifying that
skip_relay_prompt: trueresults in noRELAY_AGENT_NAMEenv var would increase confidence.
LGTM with the fixes pushed.
…n in broker 1. Add skip_relay_prompt parameter to AgentSpawner.spawn() in the Python SDK so callers can pass it through to spawn_pty (fixes TypeError when using relay.claude.spawn(skip_relay_prompt=True)). 2. Skip Relaycast agent pre-registration in the broker's spawn_agent handler when skip_relay_prompt is true. There is no need to register an agent that will not use relay messaging, and a registration failure should not abort a spawn that explicitly opted out. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
skipRelayPromptflag to agent spawn configuration across the Rust broker, TypeScript SDK, and Python SDKtrue, the relay MCP server configuration and relay env vars are not injected into the spawned agent processCloses #419
Changes
src/main.rs): Addedskip_relay_promptfield toSpawnPayload, conditionally skip MCP config args and relay env vars inWorkerRegistry::spawnpackages/sdk/): AddedskipRelayPromptoption toSpawnPtyInput,SpawnHeadlessInput,SpawnProviderInput,SpawnOptions, and protocol typespackages/sdk-py/): Addedskip_relay_promptparameter tospawn_pty,spawn_headless,spawn_providermethods andSpawnOptionsdataclassTest plan
skipRelayPrompt: trueand verify no MCP config is injectednpx tsc --noEmit)cargo check)🤖 Generated with Claude Code