Skip to content

feat: agent swarm#424

Open
kermanx wants to merge 79 commits into
mainfrom
xtr/agent-swarm-progress-ui
Open

feat: agent swarm#424
kermanx wants to merge 79 commits into
mainfrom
xtr/agent-swarm-progress-ui

Conversation

@kermanx
Copy link
Copy Markdown
Collaborator

@kermanx kermanx commented Jun 4, 2026

Related Issue

No linked issue. Problem explained below.

Problem

Kimi Code already had individual subagents, but there was no first-class workflow for splitting one task across many agents, coordinating the batch, or showing users what each subagent was doing. When many subagents hit provider limits at the same time, the parent session also had no dedicated way to suspend, retry, and surface that state without treating every throttled attempt as a final failure.

The CLI, TUI, SDK, and session replay layers all needed to understand the same swarm lifecycle so a user can start a swarm task, watch queued/running/suspended/completed/failed agents, resume unfinished work, and recover the display after reload.

What changed

  • Added core swarm mode and an AgentSwarm tool that fans out templated item prompts, resumes unfinished subagents by id, preserves swarm item metadata, and returns ordered results with resume hints.
  • Added queued subagent batch execution with staggered launch, readiness tracking, per-task timeout/cancellation behavior, rate-limit suspension events, same-agent retry, and adaptive retry capacity.
  • Added RPC and SDK support for swarm mode and swarm prompts, including swarm mode status and subagent suspension event typing.
  • Added provider rate-limit error normalization in @moonshot-ai/kosong so agent-core can distinguish throttled attempts from ordinary subagent failures.
  • Added /swarm, /swarm on, /swarm off, manual-permission prompting, and the kimi swarm-demo preview path for the CLI/TUI.
  • Added live TUI swarm progress rendering above the input area, including queued, running, suspended, completed, failed, and retry states, plus transcript replay and tool-call presentation updates.
  • Updated English and Chinese user docs for the slash command and tool surfaces.
  • Added and updated tests for the subagent batch scheduler, AgentSwarm tool behavior, rate-limit/error classification, SDK event/status typing, slash command parsing, TUI launch flow, progress rendering, replay, and related message/UI state handling.

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.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 4, 2026

🦋 Changeset detected

Latest commit: 31fa83d

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

This PR includes changesets to release 6 packages
Name Type
@moonshot-ai/agent-core Minor
@moonshot-ai/kosong Minor
@moonshot-ai/kimi-code-sdk Minor
@moonshot-ai/kimi-code Minor
@moonshot-ai/acp-adapter Patch
@moonshot-ai/migration-legacy 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

@kermanx kermanx changed the title feat: add AgentSwarm TUI support feat: agent swarm Jun 4, 2026
kermanx added 10 commits June 4, 2026 18:20
…ess-ui

# Conflicts:
#	apps/kimi-code/src/tui/controllers/session-event-handler.ts
#	apps/kimi-code/test/cli/options.test.ts
#	docs/en/reference/slash-commands.md
#	docs/zh/reference/slash-commands.md
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dc029d586d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/agent-core/src/tools/builtin/collaboration/agent-swarm.ts Outdated
Comment thread packages/agent-core/src/tools/builtin/collaboration/agent-swarm.ts
Comment thread apps/kimi-code/src/tui/commands/swarm.ts Outdated
Comment thread apps/kimi-code/src/tui/components/messages/agent-swarm-progress.ts Outdated
Comment thread packages/agent-core/src/tools/builtin/collaboration/agent-swarm.ts
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b9dc203cae

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/agent-core/src/agent/turn/index.ts Outdated
Comment thread packages/node-sdk/src/rpc.ts
@kermanx
Copy link
Copy Markdown
Collaborator Author

kermanx commented Jun 6, 2026

@codex

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d50b541a4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/kimi-code/src/tui/commands/swarm.ts Outdated
Comment thread packages/agent-core/src/tools/builtin/collaboration/agent-swarm.ts
@kermanx
Copy link
Copy Markdown
Collaborator Author

kermanx commented Jun 6, 2026

@codex

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1dc2a84a4c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/agent-core/src/tools/builtin/collaboration/agent-swarm.ts
Comment thread apps/kimi-code/src/tui/commands/swarm.ts
Comment thread apps/kimi-code/src/tui/commands/undo.ts
@kermanx
Copy link
Copy Markdown
Collaborator Author

kermanx commented Jun 6, 2026

@codex

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5c22fa98e8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/agent-core/src/session/subagent-batch.ts
Comment thread packages/agent-core/src/tools/builtin/collaboration/agent-swarm.ts
Comment thread packages/node-sdk/src/rpc.ts
@kermanx
Copy link
Copy Markdown
Collaborator Author

kermanx commented Jun 6, 2026

@codex

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 31fa83d549

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/node-sdk/src/rpc.ts
Comment thread packages/agent-core/src/rpc/events.ts
Comment thread packages/agent-core/src/tools/builtin/collaboration/agent-swarm.ts
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