A programming framework for agentic AI
feat: [dotnet] open control channel for grpc save/load (#5489)
Griffin Bassman8199a2c0a1b6
diff --git a/dotnet/src/Microsoft.AutoGen/RuntimeGateway.Grpc/Services/Grpc/GrpcGateway.cs b/dotnet/src/Microsoft.AutoGen/RuntimeGateway.Grpc/Services/Grpc/GrpcGateway.csindex bf42269aa..cc83a50a9 100644--- a/dotnet/src/Microsoft.AutoGen/RuntimeGateway.Grpc/Services/Grpc/GrpcGateway.cs+++ b/dotnet/src/Microsoft.AutoGen/RuntimeGateway.Grpc/Services/Grpc/GrpcGateway.cs@@ -10,7 +10,6 @@ using Microsoft.Extensions.Hosting;using Microsoft.Extensions.Logging;namespace Microsoft.AutoGen.RuntimeGateway.Grpc;-/// <summary>/// Represents the gRPC gateway service that handles communication between the agent worker and the cluster./// </summary>@@ -31,10 +30,11 @@ public sealed class GrpcGateway : BackgroundService, IGateway/// </summary>private readonly IMessageRegistryGrain _messageRegistry;private readonly IGateway _reference;- private readonly ConcurrentDictionary<string, List<GrpcWorkerConnection>> _supportedAgentTypes = [];- public readonly ConcurrentDictionary<string, GrpcWorkerConnection> _workers = new();- private readonly ConcurrentDictionary<(string Type, string Key), GrpcWorkerConnection> _agentDirectory = new();- private readonly ConcurrentDictionary<(GrpcWorkerConnection, string), TaskCompletionSource<RpcResponse>> _pendingRequests = new();+ private readonly ConcurrentDictionary<string, List<GrpcWorkerConnection<Message>>> _supportedAgentTypes = [];+ public readonly ConcurrentDictionary<string, GrpcWorkerConnection<Message>> _workers = new();+ public readonly ConcurrentDictionary<string, GrpcWorkerConnection<ControlMessage>> _controlWorkers = new();+ private readonly ConcurrentDictionary<(string Type, string Key), GrpcWorkerConnection<Message>> _agentDirectory = new();+ private readonly ConcurrentDictionary<(GrpcWorkerConnection<Message>, string), TaskCompletionSource<RpcResponse>> _pendingRequests = new();/// <summary>/// Initializes a new instance of the <see cref="GrpcGateway"/> class.@@ -255,15 +255,27 @@ public sealed class GrpcGateway : BackgroundService, IGateway/// <param name="responseStream">The response stream.</param>/// <param name="context">The server call context.</param>/// <returns>A task that represents the asynchronous operation.</returns>- internal async Task ConnectToWorkerProcess(IAsyncStreamReader<Message> requestStream, IServerStreamWriter<Message> responseStream, ServerCallContext context)+ internal async Task ConnectToWorkerProcess<TMessage>(IAsyncStreamReader<TMessage> requestStream, IServerStreamWriter<TMessage> responseStream, ServerCallContext context)+ where TMessage : class{_logger.LogInformation("Received new connection from {Peer}.", context.Peer);- var clientId = (context.RequestHeaders.Get("client-id")?.Value) ??- throw new RpcException(new Status(StatusCode.InvalidArgument, "Client ID is required."));- var workerProcess = new GrpcWorkerConnection(this, requestStream, responseStream, context);- _workers.GetOrAdd(clientId, workerProcess);+ var clientId = context.RequestHeaders.Get("client-id")?.Value+ ?? throw new RpcException(new Status(StatusCode.InvalidArgument, "Client ID is required."));+ var workerProcess = new GrpcWorkerConnection<TMessage>(this, requestStream, responseStream, context);- await this.AttachDanglingRegistrations(clientId).ConfigureAwait(false);+ if (typeof(TMessage) == typeof(Message))+ {+ _workers.GetOrAdd(clientId, _ => (GrpcWorkerConnection<Message>)(object)workerProcess);+ await this.AttachDanglingRegistrations(clientId).ConfigureAwait(false);+ }+ else if (typeof(TMessage) == typeof(ControlMessage))+ {+ _controlWorkers.GetOrAdd(clientId, _ => (GrpcWorkerConnection<ControlMessage>)(object)workerProcess);+ }+ else+ {+ throw new InvalidOperationException($"Unsupported message type: {typeof(TMessage).Name}");+ }await workerProcess.Connect().ConfigureAwait(false);}@@ -301,22 +313,39 @@ public sealed class GrpcGateway : BackgroundService, IGateway/// <param name="message">The received message.</param>/// <param name="cancellationToken">The cancellation token.</param>/// <returns>A task that represents the asynchronous operation.</returns>- internal async Task OnReceivedMessageAsync(GrpcWorkerConnection connection, Message message, CancellationToken cancellationToken = default)+ internal async Task OnReceivedMessageAsync<TMessage>(GrpcWorkerConnection<TMessage> connection, TMessage message, CancellationToken cancellationToken = default)+ where TMessage : class{_logger.LogInformation("Received message {Message} from connection {Connection}.", message, connection);- switch (message.MessageCase)++ switch (message){- case Message.MessageOneofCase.Request:- await DispatchRequestAsync(connection, message.Request);- break;- case Message.MessageOneofCase.Response:- DispatchResponse(connection, message.Response);+ case Message msg:+ // Handle regular messages+ switch (msg.MessageCase)+ {+ case Message.MessageOneofCase.Request:+ await DispatchRequestAsync(connection, msg.Request);+ break;+ case Message.MessageOneofCase.Response:+ DispatchResponse(connection, msg.Response);+ break;+ case Message.MessageOneofCase.CloudEvent:+ await DispatchEventAsync(msg.CloudEvent, cancellationToken);+ break;+ default:+ await RespondBadRequestAsync(connection, $"Unknown message type for message '{msg}'.");+ break;+ }break;- case Message.MessageOneofCase.CloudEvent:- await DispatchEventAsync(message.CloudEvent, cancellationToken);++ case ControlMessage controlMsg:+ // Handle control messages+ await DispatchControlMessageAsync(connection, controlMsg, cancellationToken);break;+default:- await RespondBadRequestAsync(connection, $"Unknown message type for message '{message}'.");+ await RespondBadRequestAsync(connection, $"Unsupported message type: {typeof(TMessage).Name}");break;}}@@ -326,14 +355,18 @@ public sealed class GrpcGateway : BackgroundService, IGateway/// </summary>/// <param name="connection">The worker connection.</param>/// <param name="response">The RPC response.</param>- private void DispatchResponse(GrpcWorkerConnection connection, RpcResponse response)+ private void DispatchResponse<TMessage>(GrpcWorkerConnection<TMessage> connection, RpcResponse response)+ where TMessage : class{- if (!_pendingRequests.TryRemove((connection, response.RequestId), out var completion))+ if (connection is GrpcWorkerConnection<Message> messageConnection){- _logger.LogWarning("Received response for unknown request id: {RequestId}.", response.RequestId);- return;+ if (!_pendingRequests.TryRemove((messageConnection, response.RequestId), out var completion))+ {+ _logger.LogWarning("Received response for unknown request id: {RequestId}.", response.RequestId);+ return;+ }+ completion.SetResult(response);}- completion.SetResult(response);}/// <summary>@@ -392,7 +425,8 @@ public sealed class GrpcGateway : BackgroundService, IGateway/// <param name="connection">The worker connection.</param>/// <param name="request">The RPC request.</param>/// <returns>A task that represents the asynchronous operation.</returns>- private async ValueTask DispatchRequestAsync(GrpcWorkerConnection connection, RpcRequest request)+ private async ValueTask DispatchRequestAsync<TMessage>(GrpcWorkerConnection<TMessage> connection, RpcRequest request)+ where TMessage : class{var requestId = request.RequestId;if (request.Target is null)@@ -422,17 +456,27 @@ public sealed class GrpcGateway : BackgroundService, IGateway/// <param name="request">The RPC request.</param>/// <param name="func">The function to invoke.</param>/// <returns>A task that represents the asynchronous operation.</returns>- private static async Task InvokeRequestDelegate(GrpcWorkerConnection connection, RpcRequest request, Func<RpcRequest, Task<RpcResponse>> func)+ private static async Task InvokeRequestDelegate<TMessage>(GrpcWorkerConnection<TMessage> connection, RpcRequest request, Func<RpcRequest, Task<RpcResponse>> func)+ where TMessage : class{try{var response = await func(request);response.RequestId = request.RequestId;- await connection.ResponseStream.WriteAsync(new Message { Response = response }).ConfigureAwait(false);++ if (connection is GrpcWorkerConnection<Message> messageConnection)+ {+ await messageConnection.ResponseStream.WriteAsync(new Message { Response = response }).ConfigureAwait(false);+ }}catch (Exception ex){- await connection.ResponseStream.WriteAsync(new Message { Response = new RpcResponse { RequestId = request.RequestId, Error = ex.Message } }).ConfigureAwait(false);+ if (connection is GrpcWorkerConnection<Message> messageConnection)+ {+ await messageConnection.ResponseStream.WriteAsync(+ new Message { Response = new RpcResponse { RequestId = request.RequestId, Error = ex.Message } }+ ).ConfigureAwait(false);+ }}}@@ -440,24 +484,32 @@ public sealed class GrpcGateway : BackgroundService, IGateway/// Handles the removal of a worker process./// </summary>/// <param name="workerProcess">The worker process.</param>- internal void OnRemoveWorkerProcess(GrpcWorkerConnection workerProcess)+ internal void OnRemoveWorkerProcess<TMessage>(GrpcWorkerConnection<TMessage> workerProcess)+ where TMessage : class{- var clientId = workerProcess.ServerCallContext.RequestHeaders.Get("client-id")?.Value ??- throw new RpcException(new Status(StatusCode.InvalidArgument, "Grpc Client ID is required."));+ var clientId = workerProcess.ServerCallContext.RequestHeaders.Get("client-id")?.Value+ ?? throw new RpcException(new Status(StatusCode.InvalidArgument, "Grpc Client ID is required."));+_workers.TryRemove(clientId, out _);+ _controlWorkers.TryRemove(clientId, out _);+var types = workerProcess.GetSupportedTypes();foreach (var type in types){- if (_supportedAgentTypes.TryGetValue(type, out var supported))+ if (_supportedAgentTypes.TryGetValue(type, out var supported) && workerProcess is GrpcWorkerConnection<Message> messageWorker){- supported.Remove(workerProcess);+ supported.Remove(messageWorker);}}- foreach (var pair in _agentDirectory)++ if (workerProcess is GrpcWorkerConnection<Message> messageWorkerInstance){- if (pair.Value == workerProcess)+ foreach (var pair in _agentDirectory.ToList()){- ((IDictionary<(string Type, string Key), GrpcWorkerConnection>)_agentDirectory).Remove(pair);+ if (ReferenceEquals(pair.Value, messageWorkerInstance)) // Ensures exact instance match+ {+ _agentDirectory.TryRemove(pair.Key, out _);+ }}}}@@ -468,7 +520,8 @@ public sealed class GrpcGateway : BackgroundService, IGateway/// <param name="connection">The worker connection.</param>/// <param name="error">The error message.</param>/// <returns>A task that represents the asynchronous operation.</returns>- private static async ValueTask RespondBadRequestAsync(GrpcWorkerConnection connection, string error)+ private static async ValueTask RespondBadRequestAsync<TMessage>(GrpcWorkerConnection<TMessage> connection, string error)+ where TMessage : class{throw new RpcException(new Status(StatusCode.InvalidArgument, error));}@@ -480,8 +533,28 @@ public sealed class GrpcGateway : BackgroundService, IGateway/// <param name="cloudEvent">The cloud event.</param>/// <param name="cancellationToken">The cancellation token.</param>/// <returns>A task that represents the asynchronous operation.</returns>- private async Task WriteResponseAsync(GrpcWorkerConnection connection, CloudEvent cloudEvent, CancellationToken cancellationToken = default)+ private async Task WriteResponseAsync(GrpcWorkerConnection<Message> connection, CloudEvent cloudEvent, CancellationToken cancellationToken = default){await connection.ResponseStream.WriteAsync(new Message { CloudEvent = cloudEvent }, cancellationToken).ConfigureAwait(false);}++ private async ValueTask DispatchControlMessageAsync<TMessage>(GrpcWorkerConnection<TMessage> connection, ControlMessage controlMsg, CancellationToken cancellationToken)+ where TMessage : class+ {+ if (string.IsNullOrEmpty(controlMsg.Destination))+ {+ throw new InvalidOperationException($"Control message is missing a destination. Message: '{controlMsg}'");+ }++ // Ensure the control message is of the correct type+ if (controlMsg is TMessage typedResponseMessage)+ {+ // Send the response back to the client+ await connection.ResponseStream.WriteAsync(typedResponseMessage, cancellationToken).ConfigureAwait(false);+ }+ else+ {+ throw new InvalidOperationException($"Cannot convert control message to type {typeof(TMessage).Name}");+ }+ }}diff --git a/dotnet/src/Microsoft.AutoGen/RuntimeGateway.Grpc/Services/Grpc/GrpcGatewayService.cs b/dotnet/src/Microsoft.AutoGen/RuntimeGateway.Grpc/Services/Grpc/GrpcGatewayService.csindex 1f04647db..60a851571 100644--- a/dotnet/src/Microsoft.AutoGen/RuntimeGateway.Grpc/Services/Grpc/GrpcGatewayService.cs+++ b/dotnet/src/Microsoft.AutoGen/RuntimeGateway.Grpc/Services/Grpc/GrpcGatewayService.cs@@ -35,6 +35,29 @@ public sealed class GrpcGatewayService(GrpcGateway gateway) : AgentRpc.AgentRpcB}}+ /// <summary>+ /// Open channel for the Control Channel (defined in the proto file).+ /// </summary>+ /// <param name="requestStream">The request stream.</param>+ /// <param name="responseStream">The response stream.</param>+ /// <param name="context">The server call context.</param>+ /// <returns>A task that represents the asynchronous operation.</returns>+ public override async Task OpenControlChannel(IAsyncStreamReader<ControlMessage> requestStream, IServerStreamWriter<ControlMessage> responseStream, ServerCallContext context)+ {+ try+ {+ await Gateway.ConnectToWorkerProcess(requestStream, responseStream, context).ConfigureAwait(true);+ }+ catch+ {+ if (context.CancellationToken.IsCancellationRequested)+ {+ return;+ }+ throw;+ }+ }+/// <summary>/// Adds a subscription./// </summary>diff --git a/dotnet/src/Microsoft.AutoGen/RuntimeGateway.Grpc/Services/Grpc/GrpcWorkerConnection.cs b/dotnet/src/Microsoft.AutoGen/RuntimeGateway.Grpc/Services/Grpc/GrpcWorkerConnection.csindex a88430484..b13362327 100644--- a/dotnet/src/Microsoft.AutoGen/RuntimeGateway.Grpc/Services/Grpc/GrpcWorkerConnection.cs+++ b/dotnet/src/Microsoft.AutoGen/RuntimeGateway.Grpc/Services/Grpc/GrpcWorkerConnection.cs@@ -2,11 +2,11 @@// GrpcWorkerConnection.csusing System.Threading.Channels;using Grpc.Core;-using Microsoft.AutoGen.Protobuf;namespace Microsoft.AutoGen.RuntimeGateway.Grpc;-public sealed class GrpcWorkerConnection : IAsyncDisposable+public sealed class GrpcWorkerConnection<TMessage> : IAsyncDisposable+where TMessage : class{private static long s_nextConnectionId;private Task _readTask = Task.CompletedTask;@@ -17,13 +17,13 @@ public sealed class GrpcWorkerConnection : IAsyncDisposableprivate readonly GrpcGateway _gateway;private readonly CancellationTokenSource _shutdownCancellationToken = new();public Task Completion { get; private set; } = Task.CompletedTask;- public GrpcWorkerConnection(GrpcGateway agentWorker, IAsyncStreamReader<Message> requestStream, IServerStreamWriter<Message> responseStream, ServerCallContext context)+ public GrpcWorkerConnection(GrpcGateway agentWorker, IAsyncStreamReader<TMessage> requestStream, IServerStreamWriter<TMessage> responseStream, ServerCallContext context){_gateway = agentWorker;RequestStream = requestStream;ResponseStream = responseStream;ServerCallContext = context;- _outboundMessages = Channel.CreateUnbounded<Message>(new UnboundedChannelOptions { AllowSynchronousContinuations = true, SingleReader = true, SingleWriter = false });+ _outboundMessages = Channel.CreateUnbounded<TMessage>(new UnboundedChannelOptions { AllowSynchronousContinuations = true, SingleReader = true, SingleWriter = false });}public Task Connect(){@@ -50,11 +50,11 @@ public sealed class GrpcWorkerConnection : IAsyncDisposablereturn Completion = Task.WhenAll(_readTask, _writeTask);}- public IAsyncStreamReader<Message> RequestStream { get; }- public IServerStreamWriter<Message> ResponseStream { get; }+ public IAsyncStreamReader<TMessage> RequestStream { get; }+ public IServerStreamWriter<TMessage> ResponseStream { get; }public ServerCallContext ServerCallContext { get; }- private readonly Channel<Message> _outboundMessages;+ private readonly Channel<TMessage> _outboundMessages;/// <inheritdoc/>public void AddSupportedType(string type)@@ -75,7 +75,7 @@ public sealed class GrpcWorkerConnection : IAsyncDisposable}/// <inheritdoc/>- public async Task SendMessage(Message message)+ public async Task SendMessage(TMessage message){await _outboundMessages.Writer.WriteAsync(message).ConfigureAwait(false);}diff --git a/dotnet/test/Microsoft.AutoGen.RuntimeGateway.Grpc.Tests/GrpcGatewayServiceTests.cs b/dotnet/test/Microsoft.AutoGen.RuntimeGateway.Grpc.Tests/GrpcGatewayServiceTests.csindex e9009c923..06f11836d 100644--- a/dotnet/test/Microsoft.AutoGen.RuntimeGateway.Grpc.Tests/GrpcGatewayServiceTests.cs+++ b/dotnet/test/Microsoft.AutoGen.RuntimeGateway.Grpc.Tests/GrpcGatewayServiceTests.cs@@ -28,7 +28,7 @@ public class GrpcGatewayServiceTestsvar logger = Mock.Of<ILogger<GrpcGateway>>();var gateway = new GrpcGateway(_fixture.Cluster.Client, logger);var service = new GrpcGatewayService(gateway);- var client = new TestGrpcClient();+ var client = new TestGrpcClient<Message>();gateway._workers.Count.Should().Be(0);var task = OpenChannel(service, client);@@ -37,13 +37,44 @@ public class GrpcGatewayServiceTestsawait task;}+ [Fact]+ public async Task Test_ControlChannel_Pass_Message_Through_Gateway()+ {+ var logger = Mock.Of<ILogger<GrpcGateway>>();+ var gateway = new GrpcGateway(_fixture.Cluster.Client, logger);+ var service = new GrpcGatewayService(gateway);++ var controlClient = new TestGrpcClient<ControlMessage>();+ var controlTask = OpenConrolChannel(service, controlClient);+ gateway._controlWorkers.Count.Should().Be(1);++ var testMessage = new ControlMessage+ {+ RpcId = "123",+ Destination = "agentid=PBAgent", // Target the registered agent+ RespondTo = "", // Empty string means it's a request+ RpcMessage = Google.Protobuf.WellKnownTypes.Any.Pack(new SaveStateRequest { AgentId = new Protobuf.AgentId() })+ };++ controlClient.AddMessage(testMessage);++ // Step 4: Verify that the agent receives the control message+ var receivedMessage = await controlClient.ReadNext();+ receivedMessage.Should().NotBeNull();+ receivedMessage.RpcId.Should().Be("123");++ // Cleanup+ controlClient.Dispose();+ await controlTask;+ }+[Fact]public async Task Test_Message_Exchange_Through_Gateway(){var logger = Mock.Of<ILogger<GrpcGateway>>();var gateway = new GrpcGateway(_fixture.Cluster.Client, logger);var service = new GrpcGatewayService(gateway);- var client = new TestGrpcClient();+ var client = new TestGrpcClient<Message>();var task = OpenChannel(service: service, client);await service.RegisterAgent(await CreateRegistrationRequest(service, typeof(PBAgent)), client.CallContext);await service.RegisterAgent(await CreateRegistrationRequest(service, typeof(GMAgent)), client.CallContext);@@ -90,7 +121,7 @@ public class GrpcGatewayServiceTestsvar logger = Mock.Of<ILogger<GrpcGateway>>();var gateway = new GrpcGateway(_fixture.Cluster.Client, logger);var service = new GrpcGatewayService(gateway);- var client = new TestGrpcClient();+ var client = new TestGrpcClient<Message>();var task = OpenChannel(service: service, client);var response = await service.RegisterAgent(await CreateRegistrationRequest(service, typeof(PBAgent)), client.CallContext);response.GetType().Should().Be(typeof(RegisterAgentTypeResponse));@@ -110,7 +141,7 @@ public class GrpcGatewayServiceTestsvar topics = eventTypes.GetTopicsForAgent(type)?.ToList();var topicsPrefix = eventTypes.GetTopicsPrefixForAgent(type)?.ToList();if (events is not null && topics is not null) { events.AddRange(topics); }- var client = new TestGrpcClient();+ var client = new TestGrpcClient<Message>();if (events != null){@@ -177,10 +208,14 @@ public class GrpcGatewayServiceTestsreturn registration;}- private Task OpenChannel(GrpcGatewayService service, TestGrpcClient client)+ private Task OpenChannel(GrpcGatewayService service, TestGrpcClient<Message> client){return service.OpenChannel(client.RequestStream, client.ResponseStream, client.CallContext);}+ private Task OpenConrolChannel(GrpcGatewayService service, TestGrpcClient<ControlMessage> client)+ {+ return service.OpenControlChannel(client.RequestStream, client.ResponseStream, client.CallContext);+ }private string GetFullName(Type type){return ReflectionHelper.GetMessageDescriptor(type)!.FullName;diff --git a/dotnet/test/Microsoft.AutoGen.RuntimeGateway.Grpc.Tests/Helpers/Grpc/TestGrpcClient.cs b/dotnet/test/Microsoft.AutoGen.RuntimeGateway.Grpc.Tests/Helpers/Grpc/TestGrpcClient.csindex 8c325678c..481469712 100644--- a/dotnet/test/Microsoft.AutoGen.RuntimeGateway.Grpc.Tests/Helpers/Grpc/TestGrpcClient.cs+++ b/dotnet/test/Microsoft.AutoGen.RuntimeGateway.Grpc.Tests/Helpers/Grpc/TestGrpcClient.cs@@ -1,27 +1,27 @@// Copyright (c) Microsoft Corporation. All rights reserved.// TestGrpcClient.cs-using Microsoft.AutoGen.Protobuf;namespace Microsoft.AutoGen.RuntimeGateway.Grpc.Tests.Helpers.Grpc;-internal sealed class TestGrpcClient : IDisposable+internal sealed class TestGrpcClient<TMessage> : IDisposable+ where TMessage : class{- public TestAsyncStreamReader<Message> RequestStream { get; }- public TestServerStreamWriter<Message> ResponseStream { get; }+ public TestAsyncStreamReader<TMessage> RequestStream { get; }+ public TestServerStreamWriter<TMessage> ResponseStream { get; }public TestServerCallContext CallContext { get; }private CancellationTokenSource CallContextCancellation = new();public TestGrpcClient(){CallContext = TestServerCallContext.Create(cancellationToken: CallContextCancellation.Token);- RequestStream = new TestAsyncStreamReader<Message>(CallContext);- ResponseStream = new TestServerStreamWriter<Message>(CallContext);+ RequestStream = new TestAsyncStreamReader<TMessage>(CallContext);+ ResponseStream = new TestServerStreamWriter<TMessage>(CallContext);}- public async Task<Message> ReadNext()+ public async Task<TMessage> ReadNext(){var response = await ResponseStream.ReadNextAsync();return response!;}- public void AddMessage(Message message)+ public void AddMessage(TMessage message){RequestStream.AddMessage(message);}diff --git a/dotnet/test/Microsoft.AutoGen.RuntimeGateway.Grpc.Tests/Helpers/Orleans/ClusterFixture.cs b/dotnet/test/Microsoft.AutoGen.RuntimeGateway.Grpc.Tests/Helpers/Orleans/ClusterFixture.csindex cb1320a25..5be4a8aaa 100644--- a/dotnet/test/Microsoft.AutoGen.RuntimeGateway.Grpc.Tests/Helpers/Orleans/ClusterFixture.cs+++ b/dotnet/test/Microsoft.AutoGen.RuntimeGateway.Grpc.Tests/Helpers/Orleans/ClusterFixture.cs@@ -13,7 +13,6 @@ public sealed class ClusterFixture : IDisposablebuilder.AddSiloBuilderConfigurator<SiloBuilderConfigurator>();Cluster = builder.Build();Cluster.Deploy();-}public TestCluster Cluster { get; }