> For the complete documentation index, see [llms.txt](https://docs.hackle.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hackle.io/development-guide/sdk/evaluation-mode/local-evaluation.md).

# 로컬 평가

로컬 평가는 SDK가 사용자 디바이스에서 직접 평가를 수행하는 방식입니다.

평가를 위한 서버 통신이 없어 사용자 정보가 변경되어도 서버와 다시 동기화하지 않고 분배를 처리합니다.\
모든 핵클 SDK의 기본 평가 방식으로, 별도 설정 없이 사용할 수 있습니다.

### 기능 지원

로컬 평가는 디바이스에 저장된 사용자 정보를 기반으로 평가합니다.

{% hint style="info" %}
로컬 평가는 핵클 서버에 저장된 사용자 정보와 동기화하지 않습니다.

* 사용자 속성 기반 타겟팅을 사용하려면 필요한 속성이 디바이스 또는 브라우저에 저장되어 있어야 합니다.
* 로그인하는 경우 사용자 속성을 설정하는 것을 권장합니다.
* 앱에서 설정한 사용자 속성은 기기에 저장됩니다. 앱을 삭제하기 전까지 유지됩니다.
  {% endhint %}

<table><thead><tr><th width="469.87890625">기능</th><th align="center">로컬 평가</th><th align="center">원격 평가</th></tr></thead><tbody><tr><td>A/B 테스트 분배</td><td align="center">✅</td><td align="center">✅</td></tr><tr><td>기능 플래그 결정</td><td align="center">✅</td><td align="center">✅</td></tr><tr><td>원격 구성 확인</td><td align="center">✅</td><td align="center">✅</td></tr><tr><td>디바이스에 저장된 사용자 정보 기반 평가</td><td align="center">✅</td><td align="center">❌</td></tr><tr><td>서버에 저장된 사용자 정보 기반 평가</td><td align="center">❌</td><td align="center">✅</td></tr><tr><td>사용자 정보 변경 시 서버 통신 없이 재평가</td><td align="center">✅</td><td align="center">❌</td></tr></tbody></table>

### 동작 방식

SDK가 초기화 과정에서 A/B 테스트, 기능 플래그 등 워크스페이스의 설정 정보를 받아와 내부에 저장합니다.\
이후 분배가 필요한 시점에 저장된 설정 정보를 기반으로 SDK가 직접 평가합니다.

```mermaid
sequenceDiagram
    participant App as 클라이언트
    participant SDK as SDK (로컬 평가 엔진)
    participant Hackle as 핵클 서버

    App->>SDK: SDK 초기화
    SDK->>Hackle: 워크스페이스 설정 정보 요청
    activate Hackle
    Hackle-->>SDK: 워크스페이스 설정 정보
    deactivate Hackle
    Note over SDK: 설정 정보를 내부에 저장

    App->>SDK: 분배/결정 호출
    SDK->>SDK: 저장된 설정 정보로 직접 평가<br/>(네트워크 호출 없음)

    opt 사용자 정보 변경 (setUser, 속성 업데이트 등)
        App->>SDK: 사용자 정보 변경
        SDK->>SDK: 저장된 설정 정보로 다시 평가<br/>(서버와 다시 동기화할 필요 없음)
    end

    opt 설정 정보 갱신 (fetch 호출)
        App->>SDK: fetch 호출
        SDK->>Hackle: 최신 설정 정보 요청
        activate Hackle
        Hackle-->>SDK: 워크스페이스 설정 정보
        deactivate Hackle
        Note over SDK: 저장된 설정 정보 갱신
    end

```

1. SDK 초기화 시 핵클 서버로부터 A/B 테스트, 기능 플래그 등 워크스페이스의 설정 정보를 받아와 내부에 저장합니다.
2. 분배/결정 호출 시 저장된 설정 정보를 기반으로 SDK가 직접 평가합니다.\
   이 과정에서 네트워크 호출이 발생하지 않습니다.

{% hint style="success" %}
로컬 평가는 워크스페이스 설정 정보를 받아올 때를 제외하면 평가를 위한 서버 통신/네트워크 지연 없이 분배를 처리할 수 있습니다.
{% endhint %}

### 사용자 정보가 변경되는 경우

사용자 식별자가 변경되거나(`setUser`, `setUserId`, `setDeviceId`, `resetUser`) 사용자 속성이 업데이트되면 SDK 내부 저장소에 사용자 정보를 저장합니다.

A/B 테스트 등 함수가 호출되면 사용자 정보를 이용하여 실시간으로 분배처리를 합니다.

### 대시보드 변경사항 반영

로컬 평가는 SDK 내부에 저장된 설정 정보를 기반으로 평가합니다.\
분배/결정을 호출한 시점의 대시보드 설정이 아니라, **설정 정보를 받아온 시점**을 기반으로 평가합니다.

SDK에 저장된 설정 정보는 다음 시점에 갱신됩니다.

* SDK 초기화 시
* SDK의 `fetch` 함수 호출 시

{% hint style="warning" %}
대시보드에서 A/B 테스트의 트래픽 분배율을 조정하거나 기능 플래그를 켜고 끄더라도, SDK가 설정 정보를 다시 받아오기 전까지는 기존 설정 정보로 평가합니다.

변경된 설정을 반영해야 하는 경우 SDK를 다시 초기화하거나 `fetch` 함수를 호출해야 합니다.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.hackle.io/development-guide/sdk/evaluation-mode/local-evaluation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
