> ## 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

```python theme={null}
from intuned_runtime import set_attribute, delete_attribute

def set_attribute(key: str, value: AttributeValue) -> None: ...
def delete_attribute(key: str) -> None: ...
```

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.

## `set_attribute`

Sets a key/value attribute on the current Run.

**Parameters**

**key** `str` *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.

**Raises**

`ValueError` 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 raises.

**Returns**

Returns `None`.

## `delete_attribute`

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

**Parameters**

**key** `str` *required*

The attribute key. Raises `ValueError` if the key is invalid.

**Returns**

Returns `None`.

## `AttributeValue`

```python theme={null}
from datetime import datetime

AttributeValue = str | int | float | bool | datetime | list[str]
```

| Type | Rule |
| - | - |
| `str` | Up to 255 characters |
| `int`, `float` | Floats must be finite |
| `bool` | — |
| `datetime` | Must be timezone-aware, for example `datetime.now(timezone.utc)`. Sent as an RFC 3339 string with its offset |
| `list[str]` | Up to 20 strings, each up to 255 characters |

## Example

```python theme={null}
from datetime import datetime, timezone

from intuned_runtime import delete_attribute, set_attribute


async def automation(page, params, **_kwargs):
    set_attribute("source", "live")
    set_attribute("started_at", datetime.now(timezone.utc))

    items = await scrape_items(page)
    set_attribute("items_processed", len(items))

    delete_attribute("trigger")  # remove an initial attribute
    return items
```

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

## Related

* [Run attributes](https://intunedhq.com/docs/main/02-features/run-attributes.md) — How attributes work across Attempts and where they show up.
* [attempt\_store](https://intunedhq.com/docs/main/05-references/runtime-sdk-python/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.