Skip to content

fix: prevent CopilotListeners crash when no agents registered#3

Open
HowieG wants to merge 1 commit into
mainfrom
fix/copilot-listeners-no-agents-crash
Open

fix: prevent CopilotListeners crash when no agents registered#3
HowieG wants to merge 1 commit into
mainfrom
fix/copilot-listeners-no-agents-crash

Conversation

@HowieG

@HowieG HowieG commented Feb 24, 2026

Copy link
Copy Markdown
Owner

Summary

Test plan

  • nx run @copilotkit/react-core:build compiles successfully
  • Render <CopilotKit> without a runtime or agents — should no longer crash
  • Verify agent-based flows still work as expected

🤖 Generated with Claude Code

…tKit#3249)

Replace useAgent() hook with copilotkit.getAgent() in CopilotListeners
to avoid throwing when the agents map is empty. This fixes crashes for
users who use CopilotKit without agents (e.g., only for context/tools).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

🐛 [Bug] CopilotListeners throws (via useAgent) when no agents are registered; empty state not handled gracefully

1 participant