diff --git a/backend/agent-manager.ts b/backend/agent-manager.ts
index 895232a..d0658f4 100644
--- a/backend/agent-manager.ts
+++ b/backend/agent-manager.ts
@@ -98,6 +98,8 @@ export class AgentManager {
         if (bean) {
             await R.trash(bean);
             let endpoint = bean.endpoint;
+            this.disconnect(endpoint);
+            this.sendAgentList();
             delete this.agentSocketList[endpoint];
         } else {
             throw new Error("Agent not found");