feat(agent-core-v2): make the AgentSwarm launch ramp configurable - #3125
feat(agent-core-v2): make the AgentSwarm launch ramp configurable#3125Jiliac wants to merge 1 commit into
Conversation
Add a [swarm] config section (initial_launch_limit, launch_interval_ms) owned by the swarm feature and read through IConfigService, replacing the hardcoded 5-immediate / 700ms-interval constants as defaults.
🦋 Changeset detectedLatest commit: c42ecf3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c42ecf3ebe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| export const SwarmConfigSchema = z.object({ | ||
| initialLaunchLimit: z.number().int().min(1).optional(), | ||
| launchIntervalMs: z.number().int().min(0).optional(), |
There was a problem hiding this comment.
Reject launch intervals above Node's timer limit
When launch_interval_ms is 2147483648 or larger, this schema accepts it, but the value is passed directly to setTimeout in AgentRunBatch; on the supported Node.js 24 runtime, an overflowing timeout is reduced to 1 ms. A user requesting a very slow ramp therefore gets an almost immediate ramp instead. Cap the schema at the runtime's maximum timer delay or schedule through the existing setClampedTimeout helper.
Useful? React with 👍 / 👎.
Related Issue
None — opened proactively. Note: CONTRIBUTING states external feature PRs require prior maintainer approval via an issue; happy to open an issue first and link it here if preferred.
Problem
The
AgentSwarmlaunch ramp is hardcoded: 5 subagents launch immediately, then one more every 700 ms. Users running high-concurrency inference backends (e.g. a self-hosted vLLM server sized for tens of parallel sequences) cannot raise it. The existingKIMI_CODE_AGENT_SWARM_MAX_CONCURRENCYenv var only caps concurrent subagents — it does not change the launch ramp, and leaving it unset is already uncapped.What changed
[swarm]config section owned by the swarm feature and registered through the v2 config registry (registerConfigSection):initial_launch_limit(default5) — subagents launched immediately when a batch startslaunch_interval_ms(default700) — delay between subsequent launches;0launches the rest without delayAgentRunBatchaccepts both as options; the previous constants survive as the exported defaults, so behavior is unchanged for users who do not opt in.SessionSwarmServicereads the section throughIConfigServiceon each run, so edits apply to new swarms without a restart.agent-coreis being phased out and keeps the hardcoded ramp).config-manifest.toml; documented[swarm]in the EN/ZH config reference and linked it from theAgentSwarmtool reference.Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.