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

# Run attributes

```typescript theme={null}
import { setAttribute, deleteAttribute } from '@intuned/runtime';

export declare function setAttribute(key: string, value: AttributeValue): void;
export declare function deleteAttribute(key: string): void;
```

Set or remove [run attributes](https://intunedhq.com/docs/main/02-features/run-attributes.md): key/value facts about how the current Run went. Attributes are reported when the Attempt finishes, whatever its outcome, and appear on the Run and Attempt details, the Run result, sinks, and Job result files.

Each Attempt starts with the Run's initial attributes (if any). Setting a key again overwrites it, including an initial attribute.

> [!WARNING]
>
> Attributes are operational metadata. Never put personal or regulated data in them.

## `setAttribute`

Sets a key/value attribute on the current Run.

**Parameters**

**key** `string` *required*

The attribute key. Must start with a letter, contain only letters, digits, and `_`, and be at most 64 characters long.

**value** *required*

The attribute value.

**Throws**

An `Error` when the key or value is invalid, when the Run would have more than 64 attributes, or when its attributes would serialize to more than 16 KB. The attribute isn't changed when it throws.

## `deleteAttribute`

Removes an attribute from the current Run. Does nothing if the key isn't set.

**Parameters**

**key** `string` *required*

The attribute key. Throws an `Error` if the key is invalid.

## `AttributeValue`

```typescript theme={null}
export type AttributeValue = string | number | boolean | Date | string[];
```

| Type | Rule |
| - | - |
| `string` | Up to 255 characters |
| `number` | Must be finite |
| `boolean` | — |
| `Date` | Must be a valid date. Sent as an RFC 3339 UTC string (`toISOString()`) |
| `string[]` | Up to 20 strings, each up to 255 characters |

## Example

```typescript theme={null}
import type { BrowserContext, Page } from "playwright";
import { setAttribute, deleteAttribute } from "@intuned/runtime";

export default async function handler(
  params: any,
  page: Page,
  _context: BrowserContext
) {
  setAttribute("source", "live");
  setAttribute("startedAt", new Date());

  const items = await scrapeItems(page);
  setAttribute("itemsProcessed", items.length);

  deleteAttribute("trigger"); // remove an initial attribute
  return items;
}
```

Outside a Run (for example, in a script that isn't executed by Intuned), both functions do nothing.

## Related

* [Run attributes](https://intunedhq.com/docs/main/02-features/run-attributes.md) — How attributes work across Attempts and where they show up.
* [attemptStore](https://intunedhq.com/docs/main/05-references/runtime-sdk-typescript/attempt-store.md) — Key-value store scoped to the current Attempt, for passing data within your code rather than reporting it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.