Skip to content

Commit

Permalink
get RegisterAgentTypeRequest working
Browse files Browse the repository at this point in the history
  • Loading branch information
peterychang committed Nov 14, 2024
1 parent 32f5c42 commit 89ffbca
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
16 changes: 5 additions & 11 deletions dotnet/samples/Hello/Backend/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
{
"AllowedHosts": "*",
"Kestrel": {
"EndpointDefaults": {
"Protocols": "Http2"
}
},
"AllowedHosts": "*",
"Kestrel": {
"EndpointDefaults": {
"Protocols": "Http2"
}
"AllowedHosts": "*",
"Kestrel": {
"EndpointDefaults": {
"Protocols": "Http2"
}
}
}
10 changes: 5 additions & 5 deletions dotnet/samples/Hello/HelloAgent/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
// step 4: send a message to the agent

// step 5: wait for the agent runtime to shutdown
var app = await AgentsApp.PublishMessageAsync("HelloAgents", new NewMessageReceived
{
Message = "World"
}, local: true);

// var app = await AgentsApp.PublishMessageAsync("HelloAgents", new NewMessageReceived
// {
// Message = "World"
// }, local: true);
var app = await AgentsApp.StartAsync();
await app.WaitForShutdownAsync();

namespace Hello
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ private async ValueTask RegisterAgentTypeAsync(GrpcWorkerConnection connection,
Success = true
}
};
await connection.ResponseStream.WriteAsync(response).ConfigureAwait(false);
}
private async ValueTask DispatchEventAsync(CloudEvent evt)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ async def factory_wrapper() -> T:

async def _process_register_agent_type_response(self, response: agent_worker_pb2.RegisterAgentTypeResponse) -> None:
future = self._pending_requests.pop(response.request_id)
if response.HasField("error"):
if response.HasField("error") and response.error:
future.set_exception(RuntimeError(response.error))
else:
future.set_result(None)
Expand Down Expand Up @@ -728,7 +728,7 @@ async def add_subscription(self, subscription: Subscription) -> None:

async def _process_add_subscription_response(self, response: agent_worker_pb2.AddSubscriptionResponse) -> None:
future = self._pending_requests.pop(response.request_id)
if response.HasField("error"):
if response.HasField("error") and response.error:
future.set_exception(RuntimeError(response.error))
else:
future.set_result(None)
Expand Down

0 comments on commit 89ffbca

Please sign in to comment.