Skip to content

feat: add skipRelayPrompt flag to skip MCP injection on spawn#532

Merged
khaliqgant merged 6 commits intomainfrom
fix/419-skip-relay-prompt
Mar 10, 2026
Merged

feat: add skipRelayPrompt flag to skip MCP injection on spawn#532
khaliqgant merged 6 commits intomainfrom
fix/419-skip-relay-prompt

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

@khaliqgant khaliqgant commented Mar 10, 2026

Summary

  • Adds a skipRelayPrompt flag to agent spawn configuration across the Rust broker, TypeScript SDK, and Python SDK
  • When set to true, the relay MCP server configuration and relay env vars are not injected into the spawned agent process
  • This saves time and tokens for lightweight worker agents that don't need relay messaging capabilities

Closes #419

Changes

  • Rust broker (src/main.rs): Added skip_relay_prompt field to SpawnPayload, conditionally skip MCP config args and relay env vars in WorkerRegistry::spawn
  • TypeScript SDK (packages/sdk/): Added skipRelayPrompt option to SpawnPtyInput, SpawnHeadlessInput, SpawnProviderInput, SpawnOptions, and protocol types
  • Python SDK (packages/sdk-py/): Added skip_relay_prompt parameter to spawn_pty, spawn_headless, spawn_provider methods and SpawnOptions dataclass

Test plan

  • Spawn an agent with skipRelayPrompt: true and verify no MCP config is injected
  • Spawn an agent without the flag (default) and verify relay MCP config is still injected as before
  • Verify TypeScript SDK compiles cleanly (npx tsc --noEmit)
  • Verify Rust broker compiles cleanly (cargo check)

🤖 Generated with Claude Code


Open with Devin

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>
devin-ai-integration[bot]

This comment was marked as resolved.

…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>
Copy link
Copy Markdown
Member Author

@khaliqgant khaliqgant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: skipRelayPrompt flag

Overall well-structured PR — clean propagation across Rust broker, TypeScript SDK, and Python SDK.

Fixed (pushed to branch)

  1. Bug: Missing skipRelayPrompt passthrough in spawner headless path (relay.ts:~1253)
    The spawner() method's headless spawnProvider call was missing the skipRelayPrompt option. Calling spawner().spawn({ skipRelayPrompt: true }) with a headless provider would silently ignore the flag. Fixed in 643121d.

  2. Simplified Option<bool> to bool in SpawnPayload (main.rs:~450)
    Since skip_relay_prompt always defaults to false and was unwrapped with .unwrap_or(false) at the single usage site, changed to bool with #[serde(default)] to remove unnecessary Option wrapper.

Suggestions (not blocking)

  • Protocol type completeness (protocol.ts:52): The SdkToBroker spawn_agent payload is still missing idle_threshold_secs and continue_from fields that the Rust SpawnPayload accepts and client.ts sends. Good opportunity to add them while touching this type.

  • Tests: No tests were added or updated. An integration test verifying that skip_relay_prompt: true results in no RELAY_AGENT_NAME env var would increase confidence.

LGTM with the fixes pushed.

devin-ai-integration[bot]

This comment was marked as resolved.

…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>
devin-ai-integration[bot]

This comment was marked as resolved.

@khaliqgant khaliqgant merged commit 85eff97 into main Mar 10, 2026
1 check passed
@khaliqgant khaliqgant deleted the fix/419-skip-relay-prompt branch March 10, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Relay protocol prompt is injected by the relay daemon for every spawn, not needed for minor tasks

1 participant