You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: I have encountered an issue where the behavior of the runtime worker trying to register an agent to the Servicer differs between .NET and Python libraries. Below are the code snippets that demonstrate the registration process:
if (!_supportedAgentTypes.TryGetValue(registration.Type, out var supportedAgentTypes))
{
supportedAgentTypes = _supportedAgentTypes[registration.Type] = [];
}
if (!supportedAgentTypes.Contains(gateway))
{
supportedAgentTypes.Add(gateway);
}
var workerState = GetOrAddWorker(gateway);
workerState.SupportedTypes.Add(registration.Type);
await state.WriteStateAsync().ConfigureAwait(false);
async with self._agent_type_to_client_id_lock:
if request.type in self._agent_type_to_client_id:
existing_client_id = self._agent_type_to_client_id[request.type]
await context.abort(
grpc.StatusCode.INVALID_ARGUMENT,
f"Agent type {request.type} already registered with client {existing_client_id}.",
)
else:
self._agent_type_to_client_id[request.type] = client_id
return agent_worker_pb2.RegisterAgentTypeResponse()`
There is a discrepancy in the behavior of the runtime worker when registering an agent to the Servicer between the .NET and Python libraries. In the .NET version, a HashSet is used for tracking the registered agent types, making the registration operation idempotent. If the worker registers the same type again, the operation is treated as successful, but it wouldn't add the agent twice. The Python version, on the other hand, throws an exception if the agent type is already registered, preventing duplicate registrations.
This behavior in Python could be problematic if the worker-runtime doesn't receive the acknowledgment for the registration request from the Servicer. In such cases, the worker would retry the operation, leading to a scenario where the agent might already be registered, but the acknowledgment failed. This could cause the worker to keep retrying until it fails.
The ways is see to handle this issue can be to either:
Add a try-catch on the registration of the agent and unpack the error message to validate if it is related to this behavior.
Delete the registration from the Servicer, which would allow the worker to register the agent again.
The text was updated successfully, but these errors were encountered:
We're in the progress of rewriting the dotnet servicer, so it's a good time to fix this. In general we want it to be possible for a client to recover from losing connection and so reregistering an existing registration is something that should succeed. Perhaps we should require client id and type to match for a re-register.
Anyway, I think Python's current behavior is wrong as you pointed out so we should fix that. Thanks for the issue!
Description: I have encountered an issue where the behavior of the runtime worker trying to register an agent to the Servicer differs between .NET and Python libraries. Below are the code snippets that demonstrate the registration process:
.NET Code:
https://github.com/microsoft/autogen/blob/756e2a4865b83276270fa8a23b86297b06d88f92/python/packages/autogen-ext/src/autogen_ext/runtimes/grpc/_worker_runtime_host_servicer.py#L191C1-L210C60
`
`
Python Code:
https://github.com/microsoft/autogen/blob/756e2a4865b83276270fa8a23b86297b06d88f92/python/packages/autogen-ext/src/autogen_ext/runtimes/grpc/_worker_runtime_host_servicer.py#L191C1-L210C60
`
There is a discrepancy in the behavior of the runtime worker when registering an agent to the Servicer between the .NET and Python libraries. In the .NET version, a HashSet is used for tracking the registered agent types, making the registration operation idempotent. If the worker registers the same type again, the operation is treated as successful, but it wouldn't add the agent twice. The Python version, on the other hand, throws an exception if the agent type is already registered, preventing duplicate registrations.
This behavior in Python could be problematic if the worker-runtime doesn't receive the acknowledgment for the registration request from the Servicer. In such cases, the worker would retry the operation, leading to a scenario where the agent might already be registered, but the acknowledgment failed. This could cause the worker to keep retrying until it fails.
The ways is see to handle this issue can be to either:
The text was updated successfully, but these errors were encountered: