Skip to content

Variable: TRACE\_REQUEST\_CONTEXT\_KEYS

const TRACE_REQUEST_CONTEXT_KEYS: readonly string[]

Canonical list of RequestContext keys we want Mastra to extract as metadata on every observability span (agent runs, model calls, tool invocations, workflow steps).

Mirrors https://mastra.ai/docs/observability/tracing/overview#automatic-metadata-from-requestcontext: passed verbatim into Observability.configs[*].requestContextKeys, so any key listed here is read from RequestContext at trace start and attached as scalar span metadata. Keep the set to plain scalars - never include MASTRA_USER_KEY (it carries the full AppKit execution context with a WorkspaceClient reference).

Order is purely cosmetic; Mastra de-dupes internally.