> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lynxops.co/llms.txt
> Use this file to discover all available pages before exploring further.

# 에이전트 실행 추적

> 사용자 입력, 컨텍스트, 판단, 메모리 접근, 결과를 기록합니다.

## Run context

`run()`은 async context를 만듭니다. callback 안에서 기록한 모든 Lynx 이벤트는 같은 run에 연결됩니다.

```ts theme={null}
await lynx.run(
  {
    agentName: "SupportAgent",
    workspaceId: "workspace_123",
    sessionId: "session_123",
  },
  async () => {
    lynx.userInput("주문이 어디 있나요?");
  },
);
```

Agent 이름만 넘겨도 됩니다.

```ts theme={null}
await lynx.run("SupportAgent", async () => {
  lynx.userInput("주문이 어디 있나요?");
});
```

## Semantic event

가능하면 generic log보다 semantic helper를 사용하세요. 나중에 대시보드와 디버깅 화면에서 훨씬 잘 읽힙니다.

```ts theme={null}
lynx.userInput("구독을 취소하고 싶어요", {
  userId: "usr_123",
});

lynx.context("account-state", {
  plan: "pro",
  renewalDate: "2026-07-01",
});

lynx.decision({
  name: "choose_retention_offer",
  selected: "discount_offer",
  alternatives: ["cancel_now", "pause_subscription"],
  confidence: 0.74,
  reason: "사용자의 사용량이 높고 갱신일이 가깝습니다",
});

lynx.memory("customer-profile", {
  operation: "read",
  key: "usr_123",
  hit: true,
});

lynx.outcome({
  status: "COMPLETED",
  businessStatus: "SUCCEEDED",
  reason: "고객이 retention offer를 수락했습니다",
});
```

## Attributes

`setAttributes()`로 이후 이벤트에 공통 request ID나 business ID를 붙일 수 있습니다.

```ts theme={null}
lynx.setAttributes({
  tenantId: "tenant_123",
  orderId: "order_123",
});
```

## Custom annotation

Semantic helper로 표현하기 어려운 breadcrumb는 `annotate()` 또는 `log()`를 사용하세요.

```ts theme={null}
lynx.annotate("routing.selected", {
  queue: "billing",
  score: 0.91,
});
```
