> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-serverless-sft-revamp.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# withAttributes

> TypeScript SDK 레퍼런스

# withAttributes

▸ **withAttributes**\<`T`>(`attrs`, `fn`): `Promise`\<`T`> | `T`

현재 실행 컨텍스트에 속성(attributes)을 부여하여 `fn` 내부에서 생성된 모든 호출이 해당 속성을 자동으로 상속받도록 합니다. 속성은 추적 서버의 호출 레코드에 기록되며 Weave UI 및 필터링에 표시됩니다. 따라서 요청 ID, 테넌트, Experiments 등을 기반으로 Runs 에 태그를 지정하는 데 매우 유용합니다.

Example:

```ts theme={null}
await withAttributes({requestId: 'abc'}, async () => {
  await myOp();
});
```

#### Type parameters

| Name |
| :--- |
| `T`  |

#### Parameters

| Name    | Type                         |
| :------ | :--------------------------- |
| `attrs` | `Record`\<`string`, `any`>   |
| `fn`    | () => `T` \| `Promise`\<`T`> |

#### Returns

`Promise`\<`T`> | `T`

#### Defined in

[clientApi.ts:193](https://github.com/wandb/weave/blob/1aee4006a95d913addb45881dfc950de7ce7b0bd/sdks/node/src/clientApi.ts#L193)

***
