> ## Documentation Index
> Fetch the complete documentation index at: https://ai-kb.automationanywhere.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 메모리 API 레퍼런스

> EKB REST API를 사용하여 프로그래밍 방식으로 에이전트 메모리 및 승인 워크플로우를 관리합니다.

## 인증

모든 엔드포인트에는 다음 헤더가 필요합니다:

```http theme={null}
x-api-key: <your-api-key>
x-api-secret: <your-api-secret>
Content-Type: application/json
```

## 엔드포인트

<AccordionGroup>
  <Accordion title="에이전트 메모리 설정 가져오기">
    **`GET /agents/{agent_id}/memory-settings`**

    에이전트의 현재 메모리 구성을 반환합니다.

    **응답 예시:**

    ```json theme={null}
    {
      "memory_enabled": true,
      "max_memories": 50,
      "auto_approve": false,
      "memory_types": ["preference", "fact", "context"]
    }
    ```
  </Accordion>

  <Accordion title="에이전트 메모리 설정 업데이트">
    **`PUT /agents/{agent_id}/memory-settings`**

    에이전트의 메모리를 활성화, 비활성화 또는 업데이트합니다.

    **요청 본문:**

    ```json theme={null}
    {
      "memory_enabled": true,
      "max_memories": 50,
      "auto_approve": false,
      "memory_types": ["preference", "fact", "context"]
    }
    ```

    **응답 예시:**

    ```json theme={null}
    {
      "success": true,
      "message": "메모리 설정이 성공적으로 업데이트되었습니다",
      "settings": {
        "memory_enabled": true,
        "max_memories": 50,
        "auto_approve": false,
        "memory_types": ["preference", "fact", "context"]
      }
    }
    ```
  </Accordion>

  <Accordion title="에이전트의 승인된 메모리 가져오기">
    **`GET /agents/{agent_id}/memories`**

    사용자별로 그룹화된 에이전트의 모든 승인된 메모리를 반환합니다.

    **응답 예시:**

    ```json theme={null}
    {
      "memories_by_user": {
        "user_123": [
          {
            "id": "memory_abc",
            "agent_id": "agent_123",
            "user_id": "user_123",
            "memory_content": "사용자는 간결한 기술적 답변을 선호합니다.",
            "memory_type": "preference",
            "confidence_score": 0.92,
            "status": "approved",
            "created_at": 1710000000,
            "updated_at": 1710000100,
            "approved_at": 1710000100,
            "source_message_id": "msg_123"
          }
        ]
      },
      "total_users": 1,
      "total_memories": 1
    }
    ```
  </Accordion>

  <Accordion title="특정 사용자의 승인된 메모리 가져오기">
    **`GET /agents/{agent_id}/memories/user/{user_id}`**

    특정 사용자와 에이전트의 승인된 메모리 레코드를 반환합니다.

    **응답 예시:**

    ```json theme={null}
    [
      {
        "id": "memory_abc",
        "agent_id": "agent_123",
        "user_id": "user_123",
        "memory_content": "사용자는 간결한 기술적 답변을 선호합니다.",
        "memory_type": "preference",
        "confidence_score": 0.92,
        "status": "approved",
        "created_at": 1710000000,
        "updated_at": 1710000100,
        "approved_at": 1710000100,
        "source_message_id": "msg_123"
      }
    ]
    ```
  </Accordion>

  <Accordion title="대기 중인 메모리 승인 가져오기">
    **`GET /memory-approvals/pending`**

    인증된 사용자의 대기 중인 메모리 승인을 반환합니다. `?agent_id={agent_id}`를 사용하여 선택적으로 에이전트별로 필터링할 수 있습니다.

    **응답 예시:**

    ```json theme={null}
    [
      {
        "id": "memory_abc",
        "agent_id": "agent_123",
        "user_id": "user_123",
        "memory_content": "사용자는 간결한 기술적 답변을 선호합니다.",
        "memory_type": "preference",
        "confidence_score": 0.92,
        "source_message": "답변을 짧고 기술적으로 유지해 주세요.",
        "created_at": 1710000000,
        "expires_at": 1710604800
      }
    ]
    ```
  </Accordion>

  <Accordion title="메모리 승인 또는 거부">
    **`POST /memory-approvals/{memory_id}/action`**

    대기 중인 메모리 레코드를 승인하거나 거부합니다.

    **요청 본문:**

    ```json theme={null}
    {
      "action": "approve"
    }
    ```

    **응답 예시:**

    ```json theme={null}
    {
      "success": true,
      "message": "메모리가 성공적으로 승인되었습니다",
      "memory_id": "memory_abc"
    }
    ```
  </Accordion>

  <Accordion title="메모리 삭제">
    **`DELETE /memories/{memory_id}`**

    메모리 레코드를 거부됨으로 표시하여 삭제합니다.

    **응답 예시:**

    ```json theme={null}
    {
      "success": true,
      "message": "메모리가 성공적으로 삭제되었습니다",
      "memory_id": "memory_abc"
    }
    ```
  </Accordion>
</AccordionGroup>
