feat(core): subagent registry + useSubagent hook#5873
Draft
mme wants to merge 1 commit into
Draft
Conversation
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>
Contributor
📣 Social Copy GeneratorGenerate social media copies (Twitter/X, LinkedIn, Blog Post) for this PR using Claude.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft. Adds subagent lifecycle tracking to CopilotKit core and a
useSubagenthook.SubagentRegistrydelegate onCopilotKitCore— tracksSUBAGENT_STARTED/FINISHED/ERRORper owning agent (modeled onSuggestionEngine; owns its own per-agentagent.subscribelikeStateManager). Exposed viagetSubagents(agentId)+ anonSubagentsChangedsubscription.useSubagent({ subagentId | subagentName, agentId? })(react-core v2) — resolves a message'ssubagentIdto a friendlyname,description, and runningstatus. Warns once (dev) when asubagentNameis ambiguous.Dependency: consumed via pkg.pr.new (no @Ag-ui release needed)
Requires the AG-UI subagent event schemas +
AgentSubscribercallbacks from ag-ui PR ag-ui-protocol/ag-ui#2137. Rather than wait for a published@ag-ui0.0.58, the feature packages point@ag-ui/client/@ag-ui/coreat that PR's pkg.pr.new preview (https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/*@2137).@copilotkit/corebuilds against it anduse-subagent.tsxtypechecks clean.Reviewer notes:
.npmrcsetsblock-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.@ag-ui0.0.58 to resolve to the same preview — pre-existing migration state on the branch, not introduced here.@ag-uipublishes.🤖 Generated with Claude Code