Skip to content

Backwards compat for Copilot Studio Client#798

Merged
benbrown merged 13 commits intomainfrom
users/benbro/csc-backcompat
Dec 3, 2025
Merged

Backwards compat for Copilot Studio Client#798
benbrown merged 13 commits intomainfrom
users/benbro/csc-backcompat

Conversation

@benbrown
Copy link
Copy Markdown
Contributor

@benbrown benbrown commented Dec 1, 2025

In order to avoid a breaking change in the syntax of CopilotStudioClient, we introduce:

startConversationStreaming -> returns AsyncGenerator
startConversationAsync -> marked as deprecated, still returns Promise<Activity[]> as before

sendActivityStreaming -> returns AsyncGenerator
sendActivity -> marked as deprecated, still returns Promise<Activity[]>

askQuestionAsync -> marked as deprecated, returns Promise<Activity[]>

Copy link
Copy Markdown
Collaborator

@ceciliaavila ceciliaavila left a comment

Choose a reason for hiding this comment

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

LGTM

@benbrown benbrown marked this pull request as ready for review December 1, 2025 17:50
Copilot AI review requested due to automatic review settings December 1, 2025 17:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces streaming-based methods to maintain backwards compatibility for CopilotStudioClient while deprecating promise-based methods, aligning usage in WebChat and tests with the new APIs.

  • Add startConversationStreaming and sendActivityStreaming that return AsyncGenerator.
  • Keep startConversationAsync and sendActivity returning Promise<Activity[]> and mark them as deprecated, with tests updated accordingly.
  • Introduce a question helper, but it currently has an API naming inconsistency.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
packages/agents-copilotstudio-client/test/copilotStudioClient.test.ts Adds tests for deprecated promise-based methods and new streaming methods to validate behavior and headers.
packages/agents-copilotstudio-client/src/copilotStudioWebChat.ts Updates WebChat to use streaming APIs via for-await for conversation start and activity sending.
packages/agents-copilotstudio-client/src/copilotStudioClient.ts Implements streaming methods, wraps deprecated methods to return promises, but introduces a naming inconsistency for askQuestionAsync.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/agents-copilotstudio-client/src/copilotStudioClient.ts
Comment thread packages/agents-copilotstudio-client/src/copilotStudioClient.ts
Comment thread packages/agents-copilotstudio-client/src/copilotStudioClient.ts Outdated
@benbrown benbrown merged commit 8285af6 into main Dec 3, 2025
7 checks passed
@benbrown benbrown deleted the users/benbro/csc-backcompat branch December 3, 2025 17:27
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.

4 participants