Function: createRequestContext()
createRequestContext(
options?):Promise<RequestContext<unknown>>
Build the RequestContext a NON-HTTP agent turn needs.
Everything Mastra’s tools read off the context is stamped the same way the
request middleware stamps it - the AppKit user (so ask_genie and the model
resolver can mint user-scoped tokens), the memory thread / resource pair, and
a request id so the turn’s spans join up in traces. The result is passed as
requestContext to agent.generate / agent.stream.
This is what makes a card turn answer with the SAME data a chat turn does: the difference between the two endpoints is presentation, not capability.
Parameters
Section titled “Parameters”options?
Section titled “options?”requestId?
Section titled “requestId?”string
resourceId?
Section titled “resourceId?”string
threadId?
Section titled “threadId?”string
Returns
Section titled “Returns”Promise<RequestContext<unknown>>