MCPcopy Index your code
hub / github.com/kagent-dev/kagent / Delete

Method Delete

go/core/internal/httpserver/handlers/memory.go:282–299  ·  view source on GitHub ↗

Delete handles DELETE /api/memories

(w ErrorResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

280
281// Delete handles DELETE /api/memories
282func (h *MemoryHandler) Delete(w ErrorResponseWriter, r *http.Request) {
283 log := ctrllog.FromContext(r.Context())
284 agentName := r.URL.Query().Get("agent_name")
285 userID := r.URL.Query().Get("user_id")
286
287 if agentName == "" || userID == "" {
288 RespondWithError(w, http.StatusBadRequest, "Missing required query parameters (agent_name, user_id)")
289 return
290 }
291
292 if err := h.DatabaseService.DeleteAgentMemory(r.Context(), agentName, userID); err != nil {
293 log.Error(err, "failed to delete agent memory")
294 RespondWithError(w, http.StatusInternalServerError, fmt.Sprintf("failed to delete memory: %v", err))
295 return
296 }
297
298 RespondWithJSON(w, http.StatusOK, map[string]string{"status": "deleted"})
299}

Callers 14

TestMemoryHandlerFunction · 0.95
reconcileActorTemplateFunction · 0.45
TestE2EInvokeCrewAIAgentFunction · 0.45
cleanupFunction · 0.45
HandleDeleteAgentMethod · 0.45

Calls 6

RespondWithErrorFunction · 0.85
RespondWithJSONFunction · 0.85
QueryMethod · 0.80
GetMethod · 0.65
DeleteAgentMemoryMethod · 0.65
ErrorMethod · 0.45

Tested by 5

TestMemoryHandlerFunction · 0.76
TestE2EInvokeCrewAIAgentFunction · 0.36
cleanupFunction · 0.36