From d1813120b819615021111c653ea08cdddaa83b26 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 27 May 2025 12:01:25 +0000
Subject: [PATCH 01/11] Initial plan for issue
From b169030c525e680f64344675326405fe92cd735c Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 27 May 2025 12:04:43 +0000
Subject: [PATCH 02/11] Add documentation comments to climate, hotel and
synthesizer activities
Co-authored-by: 07JP27 <11060273+07JP27@users.noreply.github.com>
---
.../Agent/GetClimateAgent/GetClimateActivity.cs | 4 ++++
.../Agent/GetHotelAgent/GetHotelActivity.cs | 4 ++++
.../Agent/Synthesizer/SynthesizerActivity.cs | 4 ++++
.../Synthesizer/SynthesizerWithAdditionalInfoActivity.cs | 4 ++++
4 files changed, 16 insertions(+)
diff --git a/DurableMultiAgentTemplate/Agent/GetClimateAgent/GetClimateActivity.cs b/DurableMultiAgentTemplate/Agent/GetClimateAgent/GetClimateActivity.cs
index cb0f101..2196b12 100644
--- a/DurableMultiAgentTemplate/Agent/GetClimateAgent/GetClimateActivity.cs
+++ b/DurableMultiAgentTemplate/Agent/GetClimateAgent/GetClimateActivity.cs
@@ -4,6 +4,10 @@
namespace DurableMultiAgentTemplate.Agent.GetClimateAgent;
+///
+/// Activity class responsible for retrieving climate information for a specified location.
+/// Part of the multi-agent travel concierge system.
+///
public class GetClimateActivity(ChatClient chatClient,
ILogger logger)
{
diff --git a/DurableMultiAgentTemplate/Agent/GetHotelAgent/GetHotelActivity.cs b/DurableMultiAgentTemplate/Agent/GetHotelAgent/GetHotelActivity.cs
index dd04435..5cd7d5b 100644
--- a/DurableMultiAgentTemplate/Agent/GetHotelAgent/GetHotelActivity.cs
+++ b/DurableMultiAgentTemplate/Agent/GetHotelAgent/GetHotelActivity.cs
@@ -4,6 +4,10 @@
namespace DurableMultiAgentTemplate.Agent.GetHotelAgent;
+///
+/// Activity class responsible for retrieving hotel information for a specified location.
+/// Part of the multi-agent travel concierge system.
+///
public class GetHotelActivity(ChatClient chatClient,
ILogger logger)
{
diff --git a/DurableMultiAgentTemplate/Agent/Synthesizer/SynthesizerActivity.cs b/DurableMultiAgentTemplate/Agent/Synthesizer/SynthesizerActivity.cs
index e975e7d..97d519d 100644
--- a/DurableMultiAgentTemplate/Agent/Synthesizer/SynthesizerActivity.cs
+++ b/DurableMultiAgentTemplate/Agent/Synthesizer/SynthesizerActivity.cs
@@ -7,6 +7,10 @@
namespace DurableMultiAgentTemplate.Agent.Synthesizer;
+///
+/// Activity class responsible for synthesizing results from multiple agent calls into a unified response.
+/// Processes and formats agent outputs into coherent and user-friendly content.
+///
public class SynthesizerActivity(ChatClient chatClient, ILogger logger)
{
[Function(AgentActivityName.SynthesizerActivity)]
diff --git a/DurableMultiAgentTemplate/Agent/Synthesizer/SynthesizerWithAdditionalInfoActivity.cs b/DurableMultiAgentTemplate/Agent/Synthesizer/SynthesizerWithAdditionalInfoActivity.cs
index 4df8df2..f1684f8 100644
--- a/DurableMultiAgentTemplate/Agent/Synthesizer/SynthesizerWithAdditionalInfoActivity.cs
+++ b/DurableMultiAgentTemplate/Agent/Synthesizer/SynthesizerWithAdditionalInfoActivity.cs
@@ -10,6 +10,10 @@
namespace DurableMultiAgentTemplate.Agent.Synthesizer;
+///
+/// Activity class responsible for synthesizing results from multiple agent calls into a unified response
+/// with additional information. Handles formatting and processing responses with supplementary data.
+///
public class SynthesizerWithAdditionalInfoActivity(ChatClient chatClient, ILogger logger)
{
[Function(AgentActivityName.SynthesizerWithAdditionalInfoActivity)]
From 32313bbf381f9bf4cf60658c6ac4e4affced3c6c Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 27 May 2025 12:05:23 +0000
Subject: [PATCH 03/11] Add documentation comments to destination, sightseeing
and reservation activities
Co-authored-by: 07JP27 <11060273+07JP27@users.noreply.github.com>
---
.../GetDestinationSuggestActivity.cs | 4 ++++
.../GetSightseeingSpotAgent/GetSightseeingSpotActivity.cs | 4 ++++
.../Agent/SubmitReservationAgent/SubmitReservationActivity.cs | 4 ++++
3 files changed, 12 insertions(+)
diff --git a/DurableMultiAgentTemplate/Agent/GetDestinationSuggestAgent/GetDestinationSuggestActivity.cs b/DurableMultiAgentTemplate/Agent/GetDestinationSuggestAgent/GetDestinationSuggestActivity.cs
index c8aa221..f249b75 100644
--- a/DurableMultiAgentTemplate/Agent/GetDestinationSuggestAgent/GetDestinationSuggestActivity.cs
+++ b/DurableMultiAgentTemplate/Agent/GetDestinationSuggestAgent/GetDestinationSuggestActivity.cs
@@ -4,6 +4,10 @@
namespace DurableMultiAgentTemplate.Agent.GetDestinationSuggestAgent;
+///
+/// Activity class responsible for suggesting travel destinations based on user preferences.
+/// Provides recommendations for both domestic and international locations.
+///
public class GetDestinationSuggestActivity(ChatClient chatClient,
ILogger logger)
{
diff --git a/DurableMultiAgentTemplate/Agent/GetSightseeingSpotAgent/GetSightseeingSpotActivity.cs b/DurableMultiAgentTemplate/Agent/GetSightseeingSpotAgent/GetSightseeingSpotActivity.cs
index 377ab37..265b591 100644
--- a/DurableMultiAgentTemplate/Agent/GetSightseeingSpotAgent/GetSightseeingSpotActivity.cs
+++ b/DurableMultiAgentTemplate/Agent/GetSightseeingSpotAgent/GetSightseeingSpotActivity.cs
@@ -4,6 +4,10 @@
namespace DurableMultiAgentTemplate.Agent.GetSightseeingSpotAgent;
+///
+/// Activity class responsible for providing information about sightseeing spots at a specified location.
+/// Delivers details about temples, natural attractions, beaches, cultural experiences, and activities.
+///
public class GetSightseeingSpotActivity(ChatClient chatClient,
ILogger logger)
{
diff --git a/DurableMultiAgentTemplate/Agent/SubmitReservationAgent/SubmitReservationActivity.cs b/DurableMultiAgentTemplate/Agent/SubmitReservationAgent/SubmitReservationActivity.cs
index d456769..f27aa41 100644
--- a/DurableMultiAgentTemplate/Agent/SubmitReservationAgent/SubmitReservationActivity.cs
+++ b/DurableMultiAgentTemplate/Agent/SubmitReservationAgent/SubmitReservationActivity.cs
@@ -3,6 +3,10 @@
namespace DurableMultiAgentTemplate.Agent.SubmitReservationAgent;
+///
+/// Activity class responsible for handling hotel reservation submissions.
+/// Creates a reservation record and returns confirmation details.
+///
public class SubmitReservationActivity(ChatClient chatClient)//, CosmosClient cosmosClient)
{
[Function(AgentActivityName.SubmitReservationAgent)]
From a484221903379c81cdac27451374dbbbb89d6b17 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 27 May 2025 12:05:56 +0000
Subject: [PATCH 04/11] Add documentation comments to AgentDeciderActivity and
AgentOrchestrator
Co-authored-by: 07JP27 <11060273+07JP27@users.noreply.github.com>
---
.../Agent/AgentDecider/AgentDeciderActivity.cs | 4 ++++
.../Agent/Orchestrator/AgentOrchestrator.cs | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/DurableMultiAgentTemplate/Agent/AgentDecider/AgentDeciderActivity.cs b/DurableMultiAgentTemplate/Agent/AgentDecider/AgentDeciderActivity.cs
index 7409c2d..aa47ad8 100644
--- a/DurableMultiAgentTemplate/Agent/AgentDecider/AgentDeciderActivity.cs
+++ b/DurableMultiAgentTemplate/Agent/AgentDecider/AgentDeciderActivity.cs
@@ -8,6 +8,10 @@
namespace DurableMultiAgentTemplate.Agent.AgentDecider;
+///
+/// Activity class responsible for determining which agent(s) should be called based on user request.
+/// Analyzes user input and decides appropriate agent routing for the multi-agent system.
+///
public class AgentDeciderActivity(ChatClient chatClient, ILogger logger)
{
[Function(AgentActivityName.AgentDeciderActivity)]
diff --git a/DurableMultiAgentTemplate/Agent/Orchestrator/AgentOrchestrator.cs b/DurableMultiAgentTemplate/Agent/Orchestrator/AgentOrchestrator.cs
index 1c0ea9f..01b7ac6 100644
--- a/DurableMultiAgentTemplate/Agent/Orchestrator/AgentOrchestrator.cs
+++ b/DurableMultiAgentTemplate/Agent/Orchestrator/AgentOrchestrator.cs
@@ -8,6 +8,11 @@
namespace DurableMultiAgentTemplate.Agent.Orchestrator;
+///
+/// Orchestrator class that coordinates the entire multi-agent workflow.
+/// Manages the flow of requests through agent decision, worker agent activities, and result synthesis.
+/// Implements retry policies and handles parallel agent execution.
+///
public class AgentOrchestrator()
{
private static TaskOptions DefaultTaskOptions { get; } = new(
From ea3071ac2f47b21260d95f165940ac3df745ef7c Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 28 May 2025 09:30:32 +0000
Subject: [PATCH 05/11] Add documentation to request classes in Agent directory
Co-authored-by: runceel <79868+runceel@users.noreply.github.com>
---
.../Agent/GetClimateAgent/GetClimateRequest.cs | 4 ++++
.../GetDestinationSuggestRequest.cs | 4 ++++
.../Agent/GetHotelAgent/GetHotelRequest.cs | 4 ++++
.../GetSightseeingSpotAgent/GetSightseeingSpotRequest.cs | 4 ++++
.../Agent/SubmitReservationAgent/SubmitReservationRequest.cs | 4 ++++
5 files changed, 20 insertions(+)
diff --git a/DurableMultiAgentTemplate/Agent/GetClimateAgent/GetClimateRequest.cs b/DurableMultiAgentTemplate/Agent/GetClimateAgent/GetClimateRequest.cs
index 255b8b2..5de8b80 100644
--- a/DurableMultiAgentTemplate/Agent/GetClimateAgent/GetClimateRequest.cs
+++ b/DurableMultiAgentTemplate/Agent/GetClimateAgent/GetClimateRequest.cs
@@ -2,6 +2,10 @@
namespace DurableMultiAgentTemplate.Agent.GetClimateAgent;
+///
+/// Record representing a request to retrieve climate information.
+/// Used as input for the GetClimateActivity.
+///
public record GetClimateRequest(
[property: Description("場所の名前。例: ボストン, 東京、フランス")]
string Location);
diff --git a/DurableMultiAgentTemplate/Agent/GetDestinationSuggestAgent/GetDestinationSuggestRequest.cs b/DurableMultiAgentTemplate/Agent/GetDestinationSuggestAgent/GetDestinationSuggestRequest.cs
index 75efc12..efdd4dd 100644
--- a/DurableMultiAgentTemplate/Agent/GetDestinationSuggestAgent/GetDestinationSuggestRequest.cs
+++ b/DurableMultiAgentTemplate/Agent/GetDestinationSuggestAgent/GetDestinationSuggestRequest.cs
@@ -2,6 +2,10 @@
namespace DurableMultiAgentTemplate.Agent.GetDestinationSuggestAgent;
+///
+/// Record representing a request to suggest travel destinations.
+/// Used as input for the GetDestinationSuggestActivity.
+///
public record GetDestinationSuggestRequest(
[property: Description("行き先に求める希望の条件")]
string SearchTerm);
diff --git a/DurableMultiAgentTemplate/Agent/GetHotelAgent/GetHotelRequest.cs b/DurableMultiAgentTemplate/Agent/GetHotelAgent/GetHotelRequest.cs
index 4cb77ff..ccde1a7 100644
--- a/DurableMultiAgentTemplate/Agent/GetHotelAgent/GetHotelRequest.cs
+++ b/DurableMultiAgentTemplate/Agent/GetHotelAgent/GetHotelRequest.cs
@@ -2,6 +2,10 @@
namespace DurableMultiAgentTemplate.Agent.GetHotelAgent;
+///
+/// Record representing a request to retrieve hotel information.
+/// Used as input for the GetHotelActivity.
+///
public record GetHotelRequest(
[property: Description("場所の名前。例: ボストン, 東京、フランス")]
string Location);
diff --git a/DurableMultiAgentTemplate/Agent/GetSightseeingSpotAgent/GetSightseeingSpotRequest.cs b/DurableMultiAgentTemplate/Agent/GetSightseeingSpotAgent/GetSightseeingSpotRequest.cs
index 84a1640..d1b85a7 100644
--- a/DurableMultiAgentTemplate/Agent/GetSightseeingSpotAgent/GetSightseeingSpotRequest.cs
+++ b/DurableMultiAgentTemplate/Agent/GetSightseeingSpotAgent/GetSightseeingSpotRequest.cs
@@ -2,6 +2,10 @@
namespace DurableMultiAgentTemplate.Agent.GetSightseeingSpotAgent;
+///
+/// Record representing a request to retrieve sightseeing spot information.
+/// Used as input for the GetSightseeingSpotActivity.
+///
public record GetSightseeingSpotRequest(
[property: Description("場所の名前。例: ボストン, 東京、フランス")]
string Location);
diff --git a/DurableMultiAgentTemplate/Agent/SubmitReservationAgent/SubmitReservationRequest.cs b/DurableMultiAgentTemplate/Agent/SubmitReservationAgent/SubmitReservationRequest.cs
index fdca8be..99554e7 100644
--- a/DurableMultiAgentTemplate/Agent/SubmitReservationAgent/SubmitReservationRequest.cs
+++ b/DurableMultiAgentTemplate/Agent/SubmitReservationAgent/SubmitReservationRequest.cs
@@ -2,6 +2,10 @@
namespace DurableMultiAgentTemplate.Agent.SubmitReservationAgent;
+///
+/// Record representing a request to submit a hotel reservation.
+/// Used as input for the SubmitReservationActivity.
+///
public record SubmitReservationRequest(
[property: Description("行き先のホテルの名前。")]
string Destination,
From ae211c7c17b275b1db69a30dc44b63a074c2ecb2 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 28 May 2025 09:32:37 +0000
Subject: [PATCH 06/11] Add documentation to prompt classes in Agent directory
Co-authored-by: runceel <79868+runceel@users.noreply.github.com>
---
.../Agent/AgentDecider/AgentDeciderPrompt.cs | 4 ++++
.../Agent/Synthesizer/SynthesizerPrompt.cs | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/DurableMultiAgentTemplate/Agent/AgentDecider/AgentDeciderPrompt.cs b/DurableMultiAgentTemplate/Agent/AgentDecider/AgentDeciderPrompt.cs
index 89d32d5..78aa3c3 100644
--- a/DurableMultiAgentTemplate/Agent/AgentDecider/AgentDeciderPrompt.cs
+++ b/DurableMultiAgentTemplate/Agent/AgentDecider/AgentDeciderPrompt.cs
@@ -1,5 +1,9 @@
namespace DurableMultiAgentTemplate.Agent.AgentDecider;
+///
+/// Static class containing prompt templates for the AgentDecider.
+/// Provides the system prompt used to guide the agent's decision-making process.
+///
internal static class AgentDeciderPrompt
{
// Orchestrator Agent functions
diff --git a/DurableMultiAgentTemplate/Agent/Synthesizer/SynthesizerPrompt.cs b/DurableMultiAgentTemplate/Agent/Synthesizer/SynthesizerPrompt.cs
index d2a491a..9bfaf44 100644
--- a/DurableMultiAgentTemplate/Agent/Synthesizer/SynthesizerPrompt.cs
+++ b/DurableMultiAgentTemplate/Agent/Synthesizer/SynthesizerPrompt.cs
@@ -1,5 +1,9 @@
namespace DurableMultiAgentTemplate.Agent.Synthesizer;
+///
+/// Static class containing prompt templates for the Synthesizer.
+/// Provides the system prompt used to guide the synthesizer's response generation process.
+///
internal static class SynthesizerPrompt
{
// Orchestrator Agent functions
From 1fa98a188564eb6debc79d145b6936f82beeff34 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 28 May 2025 09:34:09 +0000
Subject: [PATCH 07/11] Add documentation to extension and model classes in
main project
Co-authored-by: runceel <79868+runceel@users.noreply.github.com>
---
.../AgentRequestMessageItemExtension.cs | 10 +++++
DurableMultiAgentTemplate/Model/AppConfig.cs | 41 +++++++++++++++++++
.../Model/SourceGenerationContext.cs | 5 +++
3 files changed, 56 insertions(+)
diff --git a/DurableMultiAgentTemplate/Extension/AgentRequestMessageItemExtension.cs b/DurableMultiAgentTemplate/Extension/AgentRequestMessageItemExtension.cs
index ac6d636..072b65a 100644
--- a/DurableMultiAgentTemplate/Extension/AgentRequestMessageItemExtension.cs
+++ b/DurableMultiAgentTemplate/Extension/AgentRequestMessageItemExtension.cs
@@ -3,8 +3,18 @@
namespace DurableMultiAgentTemplate.Extension;
+///
+/// Extension methods for AgentRequestMessageItem.
+/// Provides conversion functionality between the application's message format and OpenAI's chat message format.
+///
public static class AgentRequestMessageItemExtension
{
+ ///
+ /// Converts a collection of AgentRequestMessageItem objects to ChatMessage objects.
+ ///
+ /// The collection of message items to convert.
+ /// A collection of ChatMessage objects.
+ /// Thrown when an unsupported role is encountered.
public static IEnumerable ConvertToChatMessageArray(this IEnumerable messages)
{
return messages.Select(m =>
diff --git a/DurableMultiAgentTemplate/Model/AppConfig.cs b/DurableMultiAgentTemplate/Model/AppConfig.cs
index 7b647f9..43689e0 100644
--- a/DurableMultiAgentTemplate/Model/AppConfig.cs
+++ b/DurableMultiAgentTemplate/Model/AppConfig.cs
@@ -1,21 +1,62 @@
namespace DurableMultiAgentTemplate.Model;
+///
+/// Configuration class for the application.
+/// Contains settings for OpenAI and Cosmos DB services.
+///
public class AppConfig
{
+ ///
+ /// Gets or initializes the OpenAI configuration.
+ ///
public required OpenAIConfig OpenAI { get; init; }
+
+ ///
+ /// Gets or initializes the Cosmos DB configuration.
+ ///
public required CosmosDbConfig CosmosDb { get; init; }
}
+///
+/// Configuration class for OpenAI services.
+/// Includes endpoint, API key, and model deployment names.
+///
public class OpenAIConfig
{
+ ///
+ /// Gets or initializes the endpoint URL for the OpenAI API.
+ ///
public required string Endpoint { get; init; }
+
+ ///
+ /// Gets or initializes the API key for authentication with OpenAI services.
+ ///
public string? ApiKey { get; init; }
+
+ ///
+ /// Gets or initializes the deployment name for the chat model.
+ ///
public required string ChatModelDeployName { get; init; }
+
+ ///
+ /// Gets or initializes the deployment name for the embedding model.
+ ///
public required string EmbeddingModelDeployName { get; init; }
}
+///
+/// Configuration class for Cosmos DB.
+/// Includes endpoint and API key settings.
+///
public class CosmosDbConfig
{
+ ///
+ /// Gets or initializes the endpoint URL for Cosmos DB.
+ ///
public required string Endpoint { get; init; }
+
+ ///
+ /// Gets or initializes the API key for authentication with Cosmos DB.
+ ///
public string? ApiKey { get; init; }
}
diff --git a/DurableMultiAgentTemplate/Model/SourceGenerationContext.cs b/DurableMultiAgentTemplate/Model/SourceGenerationContext.cs
index 7c5a2d0..684cfa2 100644
--- a/DurableMultiAgentTemplate/Model/SourceGenerationContext.cs
+++ b/DurableMultiAgentTemplate/Model/SourceGenerationContext.cs
@@ -9,6 +9,11 @@
namespace DurableMultiAgentTemplate.Model;
+///
+/// Source generation context for JSON serialization.
+/// Configures the JSON serialization options and declares serializable types
+/// for performance optimization through source generation.
+///
[JsonSourceGenerationOptions(PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase, PropertyNameCaseInsensitive = true)]
[JsonSerializable(typeof(GetClimateRequest))]
[JsonSerializable(typeof(GetDestinationSuggestRequest))]
From 286e16fb2e31caac6fe0fc56bf82d787619f42a4 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 28 May 2025 09:37:39 +0000
Subject: [PATCH 08/11] Add documentation to client model and HTTP handler
classes
Co-authored-by: runceel <79868+runceel@users.noreply.github.com>
---
...sApiKeyAuthenticationHttpMessageHandler.cs | 10 ++++
.../Model/ChatInput.cs | 11 +++++
.../Model/ChatMessage.cs | 47 +++++++++++++++++++
3 files changed, 68 insertions(+)
diff --git a/DurableMultiAgentTemplate.Client/Http/AzureFunctionsApiKeyAuthenticationHttpMessageHandler.cs b/DurableMultiAgentTemplate.Client/Http/AzureFunctionsApiKeyAuthenticationHttpMessageHandler.cs
index 416a39d..aa6757a 100644
--- a/DurableMultiAgentTemplate.Client/Http/AzureFunctionsApiKeyAuthenticationHttpMessageHandler.cs
+++ b/DurableMultiAgentTemplate.Client/Http/AzureFunctionsApiKeyAuthenticationHttpMessageHandler.cs
@@ -2,8 +2,18 @@
namespace DurableMultiAgentTemplate.Client.Http;
+///
+/// HTTP message handler that adds Azure Functions API key authentication to requests.
+/// Implements the delegating handler pattern to inject authentication headers.
+///
public class AzureFunctionsApiKeyAuthenticationHttpMessageHandler(IOptions backendOptions) : DelegatingHandler
{
+ ///
+ /// Sends an HTTP request to the inner handler after adding the API key header if configured.
+ ///
+ /// The HTTP request message to send.
+ /// A cancellation token to cancel the operation.
+ /// The HTTP response message.
protected override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
if (!string.IsNullOrEmpty(backendOptions.Value.ApiKey))
diff --git a/DurableMultiAgentTemplate.Client/Model/ChatInput.cs b/DurableMultiAgentTemplate.Client/Model/ChatInput.cs
index 499c551..383c908 100644
--- a/DurableMultiAgentTemplate.Client/Model/ChatInput.cs
+++ b/DurableMultiAgentTemplate.Client/Model/ChatInput.cs
@@ -1,7 +1,18 @@
namespace DurableMultiAgentTemplate.Client.Model;
+///
+/// Represents user chat input in the client application.
+/// Contains the message text and a flag indicating whether additional information is required.
+///
public class ChatInput
{
+ ///
+ /// Gets or sets a value indicating whether the response should include additional information.
+ ///
public bool RequireAdditionalInfo { get; set; }
+
+ ///
+ /// Gets or sets the message content entered by the user.
+ ///
public string Message { get; set; } = "";
}
diff --git a/DurableMultiAgentTemplate.Client/Model/ChatMessage.cs b/DurableMultiAgentTemplate.Client/Model/ChatMessage.cs
index a6961af..985cf3c 100644
--- a/DurableMultiAgentTemplate.Client/Model/ChatMessage.cs
+++ b/DurableMultiAgentTemplate.Client/Model/ChatMessage.cs
@@ -2,20 +2,67 @@
namespace DurableMultiAgentTemplate.Client.Model;
+///
+/// Abstract record representing a chat message in the conversation.
+/// Base class for different types of messages in the chat interface.
+///
+/// The role of the message sender.
+/// Indicates whether the message is a target for a request.
public abstract record ChatMessage(Role Role, bool IsRequestTarget);
+
+///
+/// Record representing a message from the user.
+///
+/// The content of the user's message.
public record UserChatMessage(string Message) : ChatMessage(Role.User, true);
+
+///
+/// Record representing a message from the agent.
+/// Contains the response data including any additional information.
+///
+/// The agent's response data.
public record AgentChatMessage(AgentResponseWithAdditionalInfoDto Message) : ChatMessage(Role.Assistant, true);
+
+///
+/// Record representing an informational message in the chat.
+/// Used for system messages and status updates.
+///
+/// The informational text.
+/// Indicates whether to display progress information.
public record InfoChatMessage(string Info, bool IsShowProgress) : ChatMessage(Role.Info, false);
+///
+/// Enum defining the possible roles in a conversation.
+///
public enum Role
{
+ ///
+ /// Represents a human user.
+ ///
User,
+
+ ///
+ /// Represents an AI assistant.
+ ///
Assistant,
+
+ ///
+ /// Represents an informational system message.
+ ///
Info
}
+///
+/// Extension methods for the Role enum.
+///
public static class RoleExtensions
{
+ ///
+ /// Converts a Role enum value to its string representation.
+ ///
+ /// The role to convert.
+ /// String representation of the role.
+ /// Thrown when an unsupported role is provided.
public static string ToRoleName(this Role role) => role switch
{
Role.User => "user",
From 53681a2d1c25713e60ca444a5841e8cc48e6363e Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 28 May 2025 09:40:58 +0000
Subject: [PATCH 09/11] Add documentation to remaining client classes
Co-authored-by: runceel <79868+runceel@users.noreply.github.com>
---
.../Components/Pages/Home.razor.cs | 11 ++++++++++
.../Utilities/ScrollToBottomContext.cs | 15 ++++++++++++++
.../Utilities/ExecutionTracker.cs | 20 +++++++++++++++++++
3 files changed, 46 insertions(+)
diff --git a/DurableMultiAgentTemplate.Client/Components/Pages/Home.razor.cs b/DurableMultiAgentTemplate.Client/Components/Pages/Home.razor.cs
index 2ee9528..16bdc1b 100644
--- a/DurableMultiAgentTemplate.Client/Components/Pages/Home.razor.cs
+++ b/DurableMultiAgentTemplate.Client/Components/Pages/Home.razor.cs
@@ -7,6 +7,10 @@
namespace DurableMultiAgentTemplate.Client.Components.Pages;
+///
+/// Main home page component for the chat interface.
+/// Handles user interactions and communication with agent services.
+///
public partial class Home(AgentChatService agentChatService, ILogger logger)
{
private const int _chatTimeoutMs = 60000;
@@ -17,6 +21,10 @@ public partial class Home(AgentChatService agentChatService, ILogger logge
private readonly List _messages = [];
private readonly List _additionalInfo = [];
+ ///
+ /// Sends a message to the agent and processes the response.
+ /// Manages the UI state during the request/response cycle.
+ ///
private async Task SendMessageAsync()
{
void handleError(string originalInputMessage, string errorMessage)
@@ -105,6 +113,9 @@ static string createStatusMessage(AgentOrchestratorStatus status)
}
}
+ ///
+ /// Resets the chat interface by clearing all messages and additional information.
+ ///
private void Reset()
{
_messages.Clear();
diff --git a/DurableMultiAgentTemplate.Client/Components/Utilities/ScrollToBottomContext.cs b/DurableMultiAgentTemplate.Client/Components/Utilities/ScrollToBottomContext.cs
index b20cdde..51c8161 100644
--- a/DurableMultiAgentTemplate.Client/Components/Utilities/ScrollToBottomContext.cs
+++ b/DurableMultiAgentTemplate.Client/Components/Utilities/ScrollToBottomContext.cs
@@ -1,14 +1,29 @@
namespace DurableMultiAgentTemplate.Client.Components.Utilities;
+///
+/// Context class for managing scroll-to-bottom operations in the UI.
+/// Used to communicate scroll requests between components.
+///
public class ScrollToBottomContext
{
+ ///
+ /// Gets a value indicating whether a scroll to bottom operation has been requested.
+ ///
public bool IsRequestScrollToBottom { get; private set; }
+ ///
+ /// Requests a scroll to bottom operation.
+ /// Sets the IsRequestScrollToBottom flag to true.
+ ///
public void RequestScrollToBottom()
{
IsRequestScrollToBottom = true;
}
+ ///
+ /// Resets the scroll request.
+ /// Sets the IsRequestScrollToBottom flag to false.
+ ///
public void Reset()
{
IsRequestScrollToBottom = false;
diff --git a/DurableMultiAgentTemplate.Client/Utilities/ExecutionTracker.cs b/DurableMultiAgentTemplate.Client/Utilities/ExecutionTracker.cs
index eac7477..b4bfe86 100644
--- a/DurableMultiAgentTemplate.Client/Utilities/ExecutionTracker.cs
+++ b/DurableMultiAgentTemplate.Client/Utilities/ExecutionTracker.cs
@@ -1,9 +1,22 @@
namespace DurableMultiAgentTemplate.Client.Utilities;
+///
+/// Tracks the execution state of operations.
+/// Helps prevent concurrent operations by maintaining a flag for operations in progress.
+///
public class ExecutionTracker
{
+ ///
+ /// Gets a value indicating whether an operation is currently in progress.
+ ///
public bool IsInProgress { get; private set; }
+ ///
+ /// Starts tracking an execution and returns a disposable scope.
+ /// When the scope is disposed, the execution is marked as completed.
+ ///
+ /// A disposable scope that, when disposed, marks the execution as completed.
+ /// Thrown if an execution is already in progress.
public Scope Start()
{
if (IsInProgress)
@@ -15,8 +28,15 @@ public Scope Start()
return new Scope(this);
}
+ ///
+ /// Represents a scope of execution.
+ /// When disposed, marks the associated execution tracker's operation as completed.
+ ///
public struct Scope(ExecutionTracker executionTracker) : IDisposable
{
+ ///
+ /// Marks the execution as completed.
+ ///
public void Dispose() => executionTracker.IsInProgress = false;
}
}
From 609db0fd0001a307d482bbf0ad97d768619ddc8f Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 30 May 2025 02:36:52 +0000
Subject: [PATCH 10/11] Add method documentation to Activity classes and JSON
utilities
Co-authored-by: runceel <79868+runceel@users.noreply.github.com>
---
.../Agent/AgentDecider/AgentDeciderActivity.cs | 6 ++++++
.../Agent/GetClimateAgent/GetClimateActivity.cs | 6 ++++++
.../GetDestinationSuggestActivity.cs | 6 ++++++
.../Agent/GetHotelAgent/GetHotelActivity.cs | 6 ++++++
.../GetSightseeingSpotActivity.cs | 6 ++++++
.../Agent/Orchestrator/AgentOrchestrator.cs | 6 ++++++
.../SubmitReservationActivity.cs | 6 ++++++
.../Agent/Synthesizer/SynthesizerActivity.cs | 6 ++++++
.../SynthesizerWithAdditionalInfoActivity.cs | 6 ++++++
.../Json/JsonSchemaGenerator.cs | 17 ++++++++++++++---
10 files changed, 68 insertions(+), 3 deletions(-)
diff --git a/DurableMultiAgentTemplate/Agent/AgentDecider/AgentDeciderActivity.cs b/DurableMultiAgentTemplate/Agent/AgentDecider/AgentDeciderActivity.cs
index aa47ad8..9b19add 100644
--- a/DurableMultiAgentTemplate/Agent/AgentDecider/AgentDeciderActivity.cs
+++ b/DurableMultiAgentTemplate/Agent/AgentDecider/AgentDeciderActivity.cs
@@ -14,6 +14,12 @@ namespace DurableMultiAgentTemplate.Agent.AgentDecider;
///
public class AgentDeciderActivity(ChatClient chatClient, ILogger logger)
{
+ ///
+ /// Executes the agent decision logic to determine which agents should be called.
+ /// Analyzes user messages and uses OpenAI function calling to route to appropriate agents.
+ ///
+ /// Request data containing user messages and configuration
+ /// Agent decision result indicating whether agent calls are needed and which agents to call
[Function(AgentActivityName.AgentDeciderActivity)]
public async Task Run([ActivityTrigger] AgentRequestDto reqData)
{
diff --git a/DurableMultiAgentTemplate/Agent/GetClimateAgent/GetClimateActivity.cs b/DurableMultiAgentTemplate/Agent/GetClimateAgent/GetClimateActivity.cs
index 2196b12..46ec0b5 100644
--- a/DurableMultiAgentTemplate/Agent/GetClimateAgent/GetClimateActivity.cs
+++ b/DurableMultiAgentTemplate/Agent/GetClimateAgent/GetClimateActivity.cs
@@ -11,6 +11,12 @@ namespace DurableMultiAgentTemplate.Agent.GetClimateAgent;
public class GetClimateActivity(ChatClient chatClient,
ILogger logger)
{
+ ///
+ /// Retrieves climate information for the specified location.
+ /// Simulates a network call with potential failures and returns detailed climate data.
+ ///
+ /// Request containing the location for which to retrieve climate information
+ /// Detailed climate information for the specified location in Japanese
[Function(AgentActivityName.GetClimateAgent)]
public async Task RunAsync([ActivityTrigger] GetClimateRequest req)
{
diff --git a/DurableMultiAgentTemplate/Agent/GetDestinationSuggestAgent/GetDestinationSuggestActivity.cs b/DurableMultiAgentTemplate/Agent/GetDestinationSuggestAgent/GetDestinationSuggestActivity.cs
index f249b75..037172d 100644
--- a/DurableMultiAgentTemplate/Agent/GetDestinationSuggestAgent/GetDestinationSuggestActivity.cs
+++ b/DurableMultiAgentTemplate/Agent/GetDestinationSuggestAgent/GetDestinationSuggestActivity.cs
@@ -11,6 +11,12 @@ namespace DurableMultiAgentTemplate.Agent.GetDestinationSuggestAgent;
public class GetDestinationSuggestActivity(ChatClient chatClient,
ILogger logger)
{
+ ///
+ /// Generates travel destination suggestions based on the provided search criteria.
+ /// Simulates a network call with potential failures and returns categorized destination recommendations.
+ ///
+ /// Request containing search terms and criteria for destination suggestions
+ /// Categorized destination suggestions (domestic and international) in Japanese
[Function(AgentActivityName.GetDestinationSuggestAgent)]
public async Task RunAsync([ActivityTrigger] GetDestinationSuggestRequest req)
{
diff --git a/DurableMultiAgentTemplate/Agent/GetHotelAgent/GetHotelActivity.cs b/DurableMultiAgentTemplate/Agent/GetHotelAgent/GetHotelActivity.cs
index 5cd7d5b..1e8b652 100644
--- a/DurableMultiAgentTemplate/Agent/GetHotelAgent/GetHotelActivity.cs
+++ b/DurableMultiAgentTemplate/Agent/GetHotelAgent/GetHotelActivity.cs
@@ -11,6 +11,12 @@ namespace DurableMultiAgentTemplate.Agent.GetHotelAgent;
public class GetHotelActivity(ChatClient chatClient,
ILogger logger)
{
+ ///
+ /// Retrieves hotel information for the specified location.
+ /// Simulates a network call with potential failures and returns hotel recommendations.
+ ///
+ /// Request containing the location for which to retrieve hotel information
+ /// Detailed hotel recommendations for the specified location in Japanese
[Function(AgentActivityName.GetHotelAgent)]
public async Task Run([ActivityTrigger] GetHotelRequest req)
{
diff --git a/DurableMultiAgentTemplate/Agent/GetSightseeingSpotAgent/GetSightseeingSpotActivity.cs b/DurableMultiAgentTemplate/Agent/GetSightseeingSpotAgent/GetSightseeingSpotActivity.cs
index 265b591..5cccef3 100644
--- a/DurableMultiAgentTemplate/Agent/GetSightseeingSpotAgent/GetSightseeingSpotActivity.cs
+++ b/DurableMultiAgentTemplate/Agent/GetSightseeingSpotAgent/GetSightseeingSpotActivity.cs
@@ -11,6 +11,12 @@ namespace DurableMultiAgentTemplate.Agent.GetSightseeingSpotAgent;
public class GetSightseeingSpotActivity(ChatClient chatClient,
ILogger logger)
{
+ ///
+ /// Retrieves detailed information about sightseeing spots at the specified location.
+ /// Simulates a network call with potential failures and returns comprehensive attraction recommendations.
+ ///
+ /// Request containing the location for which to retrieve sightseeing information
+ /// Detailed information about temples, nature spots, beaches, cultural experiences, and activities in Japanese
[Function(AgentActivityName.GetSightseeingSpotAgent)]
public async Task RunAsync([ActivityTrigger] GetSightseeingSpotRequest req)
{
diff --git a/DurableMultiAgentTemplate/Agent/Orchestrator/AgentOrchestrator.cs b/DurableMultiAgentTemplate/Agent/Orchestrator/AgentOrchestrator.cs
index 01b7ac6..b976218 100644
--- a/DurableMultiAgentTemplate/Agent/Orchestrator/AgentOrchestrator.cs
+++ b/DurableMultiAgentTemplate/Agent/Orchestrator/AgentOrchestrator.cs
@@ -22,6 +22,12 @@ public class AgentOrchestrator()
1,
TimeSpan.FromSeconds(10))));
+ ///
+ /// Orchestrates the complete multi-agent workflow execution.
+ /// Coordinates agent decision, parallel agent execution, and result synthesis with retry policies.
+ ///
+ /// Orchestration context for managing workflow state and activities
+ /// Aggregated response from all executed agents, with or without additional information
[Function(nameof(AgentOrchestrator))]
public async Task RunOrchestrator(
[OrchestrationTrigger] TaskOrchestrationContext context)
diff --git a/DurableMultiAgentTemplate/Agent/SubmitReservationAgent/SubmitReservationActivity.cs b/DurableMultiAgentTemplate/Agent/SubmitReservationAgent/SubmitReservationActivity.cs
index f27aa41..bde0117 100644
--- a/DurableMultiAgentTemplate/Agent/SubmitReservationAgent/SubmitReservationActivity.cs
+++ b/DurableMultiAgentTemplate/Agent/SubmitReservationAgent/SubmitReservationActivity.cs
@@ -9,6 +9,12 @@ namespace DurableMultiAgentTemplate.Agent.SubmitReservationAgent;
///
public class SubmitReservationActivity(ChatClient chatClient)//, CosmosClient cosmosClient)
{
+ ///
+ /// Processes a hotel reservation request and generates a confirmation.
+ /// Simulates reservation processing and returns booking details with a unique reservation number.
+ ///
+ /// Request containing reservation details including destination, dates, and guest count
+ /// Reservation confirmation with booking details and reservation number in Japanese
[Function(AgentActivityName.SubmitReservationAgent)]
public async Task RunAsync([ActivityTrigger] SubmitReservationRequest req)
{
diff --git a/DurableMultiAgentTemplate/Agent/Synthesizer/SynthesizerActivity.cs b/DurableMultiAgentTemplate/Agent/Synthesizer/SynthesizerActivity.cs
index 97d519d..62890be 100644
--- a/DurableMultiAgentTemplate/Agent/Synthesizer/SynthesizerActivity.cs
+++ b/DurableMultiAgentTemplate/Agent/Synthesizer/SynthesizerActivity.cs
@@ -13,6 +13,12 @@ namespace DurableMultiAgentTemplate.Agent.Synthesizer;
///
public class SynthesizerActivity(ChatClient chatClient, ILogger logger)
{
+ ///
+ /// Synthesizes results from multiple agent calls into a coherent response.
+ /// Uses OpenAI to combine and format agent outputs into user-friendly content.
+ ///
+ /// Request containing agent results, original request, and called agent names for synthesis
+ /// Unified agent response with synthesized content and list of called agents
[Function(AgentActivityName.SynthesizerActivity)]
public async Task Run([ActivityTrigger] SynthesizerRequest req)
{
diff --git a/DurableMultiAgentTemplate/Agent/Synthesizer/SynthesizerWithAdditionalInfoActivity.cs b/DurableMultiAgentTemplate/Agent/Synthesizer/SynthesizerWithAdditionalInfoActivity.cs
index f1684f8..2cc7b54 100644
--- a/DurableMultiAgentTemplate/Agent/Synthesizer/SynthesizerWithAdditionalInfoActivity.cs
+++ b/DurableMultiAgentTemplate/Agent/Synthesizer/SynthesizerWithAdditionalInfoActivity.cs
@@ -16,6 +16,12 @@ namespace DurableMultiAgentTemplate.Agent.Synthesizer;
///
public class SynthesizerWithAdditionalInfoActivity(ChatClient chatClient, ILogger logger)
{
+ ///
+ /// Synthesizes results from multiple agent calls into a unified response with additional information.
+ /// Uses OpenAI structured output to combine agent results and generate supplementary data.
+ ///
+ /// Request containing agent results, original request, and called agent names for synthesis
+ /// Enhanced agent response with synthesized content, additional information, and list of called agents
[Function(AgentActivityName.SynthesizerWithAdditionalInfoActivity)]
public async Task Run([ActivityTrigger] SynthesizerRequest req)
{
diff --git a/DurableMultiAgentTemplate/Json/JsonSchemaGenerator.cs b/DurableMultiAgentTemplate/Json/JsonSchemaGenerator.cs
index 3b9f8ec..4454a24 100644
--- a/DurableMultiAgentTemplate/Json/JsonSchemaGenerator.cs
+++ b/DurableMultiAgentTemplate/Json/JsonSchemaGenerator.cs
@@ -10,15 +10,15 @@ namespace DurableMultiAgentTemplate.Json;
///
-/// JsonSchema を生成する。
-/// クラス定義に Description 属性を指定することで JsonSchema にも description を追加する。
+/// Generator for JSON schema creation.
+/// Supports adding descriptions to JSON schemas by specifying Description attributes on class definitions.
///
internal static class JsonSchemaGenerator
{
private static readonly JsonSchemaExporterOptions _jsonSchemaExporterOptions = new()
{
TreatNullObliviousAsNonNullable = true,
- // Description を追加する
+ // Add description to schema
TransformSchemaNode = (context, schema) =>
{
var attributeProvider = context.PropertyInfo is not null ?
@@ -44,8 +44,19 @@ internal static class JsonSchemaGenerator
Encoder = JavaScriptEncoder.Create(UnicodeRanges.All),
};
+ ///
+ /// Generates a JSON schema as a string from the specified type information.
+ ///
+ /// The JSON type information to generate the schema from
+ /// JSON schema as a string with Unicode encoding support
public static string GenerateSchema(JsonTypeInfo type) =>
JsonSchemaExporter.GetJsonSchemaAsNode(type, _jsonSchemaExporterOptions).ToJsonString(_jsonSerializerOptions);
+
+ ///
+ /// Generates a JSON schema as binary data from the specified type information.
+ ///
+ /// The JSON type information to generate the schema from
+ /// JSON schema as binary data
public static BinaryData GenerateSchemaAsBinaryData(JsonTypeInfo type) =>
BinaryData.FromString(GenerateSchema(type));
}
From f9d30c14925a4e40c030f04d92f1be2c38db0438 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 30 May 2025 02:39:06 +0000
Subject: [PATCH 11/11] Add method documentation to DTO constructors
Co-authored-by: runceel <79868+runceel@users.noreply.github.com>
---
DurableMultiAgentTemplate.Shared/Model/AgentResponseDto.cs | 4 ++++
.../Model/AgentResponseWithAdditionalInfoDto.cs | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/DurableMultiAgentTemplate.Shared/Model/AgentResponseDto.cs b/DurableMultiAgentTemplate.Shared/Model/AgentResponseDto.cs
index 8b7fbb2..785db57 100644
--- a/DurableMultiAgentTemplate.Shared/Model/AgentResponseDto.cs
+++ b/DurableMultiAgentTemplate.Shared/Model/AgentResponseDto.cs
@@ -12,6 +12,10 @@ public record AgentResponseDto(
string Content,
List CalledAgentNames)
{
+ ///
+ /// Initializes a new instance of the AgentResponseDto class with empty called agent names.
+ ///
+ /// The content of the response.
public AgentResponseDto(string content) : this(content, [])
{
}
diff --git a/DurableMultiAgentTemplate.Shared/Model/AgentResponseWithAdditionalInfoDto.cs b/DurableMultiAgentTemplate.Shared/Model/AgentResponseWithAdditionalInfoDto.cs
index 895c580..4046a16 100644
--- a/DurableMultiAgentTemplate.Shared/Model/AgentResponseWithAdditionalInfoDto.cs
+++ b/DurableMultiAgentTemplate.Shared/Model/AgentResponseWithAdditionalInfoDto.cs
@@ -14,6 +14,10 @@ public record AgentResponseWithAdditionalInfoDto(string Content,
List CalledAgentNames,
List AdditionalInfo) : AgentResponseDto(Content, CalledAgentNames)
{
+ ///
+ /// Initializes a new instance of the AgentResponseWithAdditionalInfoDto class with empty called agent names and additional info.
+ ///
+ /// The content of the response.
public AgentResponseWithAdditionalInfoDto(string content) : this(content, [], [])
{
}