Skip to content

Variable: MASTRA\_REQUEST\_ID\_KEY

const MASTRA_REQUEST_ID_KEY: "mastra__requestId" = "mastra__requestId"

RequestContext key for the per-HTTP-request id stamped by MastraServer. Reads X-Request-Id from the incoming headers when present (so an upstream load balancer / API gateway can keep its trace correlation), falls back to a freshly minted UUID. Echoed back on the response and surfaced on every span via TRACE_REQUEST_CONTEXT_KEYS so logs and traces share a join key.