Skip to content

feat(core): subagent registry + useSubagent hook#5873

Draft
mme wants to merge 1 commit into
mainfrom
mme/subagents
Draft

feat(core): subagent registry + useSubagent hook#5873
mme wants to merge 1 commit into
mainfrom
mme/subagents

Conversation

@mme

@mme mme commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Draft. Adds subagent lifecycle tracking to CopilotKit core and a useSubagent hook.

  • SubagentRegistry delegate on CopilotKitCore — tracks SUBAGENT_STARTED/FINISHED/ERROR per owning agent (modeled on SuggestionEngine; owns its own per-agent agent.subscribe like StateManager). Exposed via getSubagents(agentId) + an onSubagentsChanged subscription.
  • useSubagent({ subagentId | subagentName, agentId? }) (react-core v2) — resolves a message's subagentId to a friendly name, description, and running status. Warns once (dev) when a subagentName is ambiguous.

Dependency: consumed via pkg.pr.new (no @Ag-ui release needed)

Requires the AG-UI subagent event schemas + AgentSubscriber callbacks from ag-ui PR ag-ui-protocol/ag-ui#2137. Rather than wait for a published @ag-ui 0.0.58, the feature packages point @ag-ui/client/@ag-ui/core at that PR's pkg.pr.new preview (https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/*@2137). @copilotkit/core builds against it and use-subagent.tsx typechecks clean.

Reviewer notes:

  • .npmrc sets block-exotic-subdeps=false — required because pkg.pr.new packages carry url inter-deps (@ag-ui/client → @ag-ui/encoder). Flag if a different consumption path is preferred.
  • A fully-green whole-workspace install additionally needs this branch's other packages (examples) that already expect @ag-ui 0.0.58 to resolve to the same preview — pre-existing migration state on the branch, not introduced here.
  • Swap the pkg.pr.new urls for the released version once @ag-ui publishes.

🤖 Generated with Claude Code

Track subagent lifecycle (SUBAGENT_STARTED/FINISHED/ERROR) per owning agent
in a new SubagentRegistry delegate on CopilotKitCore, exposed via
getSubagents(agentId) and an onSubagentsChanged subscription. Add a
useSubagent({ subagentId | subagentName, agentId? }) hook to resolve a
message's subagentId to a name, description, and running status, warning
once (dev) when a subagentName is ambiguous.

Requires @ag-ui/client + @ag-ui/core >= 0.0.58; bumps the pins accordingly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

📣 Social Copy Generator

Generate social media copies (Twitter/X, LinkedIn, Blog Post) for this PR using Claude.

  • Generate social media copies

@mme mme force-pushed the mme/subagents branch from 1fbf370 to 2a6b0ee Compare July 8, 2026 15:20
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