Skip to content

fix: require AgentSwarm to run alone#643

Merged
kermanx merged 1 commit into
mainfrom
xtr/agent-swarm-exclusive-tool-call
Jun 11, 2026
Merged

fix: require AgentSwarm to run alone#643
kermanx merged 1 commit into
mainfrom
xtr/agent-swarm-exclusive-tool-call

Conversation

@kermanx

@kermanx kermanx commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue. This PR addresses the need to keep AgentSwarm execution exclusive within a model response.

Problem

AgentSwarm launches many subagents from one tool call. If a model emits AgentSwarm alongside other tools, or emits multiple AgentSwarm calls in the same response, the current batch can start overlapping side effects before the model has observed the first swarm result.

What changed

  • Added a permission policy that denies any tool-call batch containing AgentSwarm unless the batch contains exactly one AgentSwarm call.
  • Passed the full same-response toolCalls list through tool execution hook contexts so permission policies can make batch-level decisions.
  • Updated the AgentSwarm tool description and bilingual tool reference docs to state that an AgentSwarm call must be the only tool call in the response.
  • Added patch changesets for @moonshot-ai/agent-core and @moonshot-ai/kimi-code.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

Verification:

  • pnpm --filter @moonshot-ai/agent-core typecheck
  • pnpm --filter @moonshot-ai/agent-core test
  • pnpm --filter kimi-code-docs build

@changeset-bot

changeset-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5dd51ca

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/agent-core Patch
@moonshot-ai/kimi-code Patch

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

@pkg-pr-new

pkg-pr-new Bot commented Jun 11, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@5dd51ca
npx https://pkg.pr.new/@moonshot-ai/kimi-code@5dd51ca

commit: 5dd51ca

@kermanx kermanx merged commit 4e5043b into main Jun 11, 2026
9 checks passed
@kermanx kermanx deleted the xtr/agent-swarm-exclusive-tool-call branch June 11, 2026 05:58
@github-actions github-actions Bot mentioned this pull request Jun 11, 2026
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.

1 participant