Skip to content

.Net: Remote Chat Completion Agent Demo #11554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

tommasodotNET
Copy link
Contributor

@tommasodotNET tommasodotNET commented Apr 14, 2025

Motivation and Context

This demo shows how we could implement a RemoteChatCompletionAgent that can be used to interact with a remote Semantic Kernel ChatCompletionAgent.

The new type RemoteChatCompletionAgent implements the ChatHistoryKernelAgent methods using a custom HTTP client to send requests to an API that hosts the ChatCompletionAgent functionality. This allows us to use the same interface as the local ChatCompletionAgent, but with the added benefit of being able to interact with a remote service.

Description

Benefits of having a remote agent

  • Polyglot Support: The remote agent can be implemented with different programming languages and frameworks, allowing for better integration and support for different platforms.
  • Reusability: The remote agent can be reused across different applications and services, allowing for better code reuse and maintainability.
  • Scalability: The remote agent can be hosted on a powerful server, allowing for more complex computations and larger models.
  • Resource Management: The remote agent can be managed and monitored more easily, allowing for better resource allocation and usage tracking.
  • Security: The remote agent can be secured and monitored more easily, allowing for better protection of sensitive data and computations.
  • Cost Efficiency: The remote agent can be hosted on a pay-as-you-go basis, allowing for better cost management and resource allocation.
  • Flexibility: The remote agent can be updated and maintained more easily, allowing for better support for new features and improvements.

Details about the sample

I am using an AgentGroupChat to show how to use different remote agents togethere in the same chat. It's a useful use case. Since theRemoteChatCompletionAgent extends the type ChatHistoryKernelAgent, it can be used in the same way as the local agent.

In thie simple Group Chat, we have two agents:

  • TranslatorAgent: this agent translates the text to English. Program.cs
  • SummaryAgent: this agent summarize the text. Program.cs

The Group Chat will call the TranslatorAgent first, and then the SummaryAgent.

I am also using .NET Aspire to have all the different microservices start and run together. I am also leveraging the .NET Service Discovery to have the correct endpoints for each agent.

.NET Aspire is not required. It just make it easier to run the sample and monitoring all the different microservices. You can run the RemoteChatCompletionAgent in any .NET application.

Contribution Checklist

@tommasodotNET tommasodotNET requested a review from a team as a code owner April 14, 2025 22:30
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code documentation labels Apr 14, 2025
@github-actions github-actions bot changed the title Remote Chat Completion Agent Demo .Net: Remote Chat Completion Agent Demo Apr 14, 2025
@tommasodotNET
Copy link
Contributor Author

The pipelines will break until #11539 is merged, because I'm using a newer version of the Aspire SDK. #11539 updates other Aspire demo's SDK and should solve the build issues.

@adiazcan
Copy link

I was just having a conversation with a colleague about whether it makes sense to implement a remote Agent based on an API, and now I come across this PR.

Is there any plan to include this in the Framework?

adiazcan added a commit to adiazcan/remote-agents that referenced this pull request Apr 24, 2025
@crickman crickman requested review from alliscode and removed request for rogeriorfp May 14, 2025 19:04
@crickman crickman moved this to Sprint: In Review in Semantic Kernel May 14, 2025
@crickman crickman self-requested a review May 14, 2025 19:15
@tommasodotNET
Copy link
Contributor Author

any update on this?

@tommasodotNET
Copy link
Contributor Author

@markwallace-microsoft does #12050 makes this PR obsolete?

@tommasodotNET
Copy link
Contributor Author

Considering there are few emerging standard protocol for agent-to-agent communication, it makes sense to close this PR without merging it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation .NET Issue or Pull requests regarding .NET code
Projects
Status: Sprint: In Review
Development

Successfully merging this pull request may close these issues.

5 participants