Skip to content

feat(agentchat): add get_thread() to BaseGroupChat (closes #6085)#7605

Open
seetaram-codebase wants to merge 2 commits intomicrosoft:mainfrom
seetaram-codebase:feature/get-thread-6085
Open

feat(agentchat): add get_thread() to BaseGroupChat (closes #6085)#7605
seetaram-codebase wants to merge 2 commits intomicrosoft:mainfrom
seetaram-codebase:feature/get-thread-6085

Conversation

@seetaram-codebase
Copy link
Copy Markdown

@seetaram-codebase seetaram-codebase commented Apr 19, 2026

Why are these changes needed?

Implements the feature requested in #6085: expose the group chat manager's internal _message_thread as a public async API on BaseGroupChat.

Changes

_events.py — new GroupChatGetThreadEvent RPC message type (empty model, like GroupChatReset).

_base_group_chat_manager.py — new @rpc handler handle_get_thread() that returns list(self._message_thread) (shallow copy to protect internal state).

_base_group_chat.py — new async def get_thread() -> List[BaseAgentEvent | BaseChatMessage] on BaseGroupChat that sends the RPC to the manager and returns the result. Works during a run and after completion; handles both embedded and external runtimes.

tests/test_group_chat_get_thread.py — 4 pytest-asyncio tests (embedded + external runtime fixtures):

  • test_get_thread_after_run — non-empty snapshot matches TaskResult messages
    • test_get_thread_not_initialized_raises — RuntimeError before first run
    • test_get_thread_returns_snapshot — mutating returned list does not affect manager
    • test_get_thread_while_running — concurrent calls during a live run return a growing thread

Related issue number

Closes #6085

Checks

  • I've included tests corresponding to the change (4 new async tests)
  • - [ ] All auto checks have passed (CI pending — get_thread() + get_thread_while_running may need runtime tuning)

@seetaram-codebase
Copy link
Copy Markdown
Author

seetaram-codebase commented Apr 19, 2026

@microsoft-github-policy-service agree

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.

Get current message thread from a group chat team.

1 participant