Skip to main content
Metadata is key-value pairs attached to traces or spans — useful for model versions, request IDs, feature flags, or any structured context you want to search on.

Using the decorator

Pass static metadata to @observe for values known at definition time:
from traceroot import observe

@observe(name="process", type="agent", metadata={"version": "v2", "tier": "premium"})
def process(query: str):
    return result

Using context manager

Use using_attributes to propagate metadata to all traces and spans within a block:
from traceroot import using_attributes

with using_attributes(metadata={"deploy": "canary", "region": "us-west-2"}):
    agent.run(query)