跳到主要内容
非官方简体中文翻译,内容版权归 Mastra 所有,遵循 Apache-2.0 许可。

Agent.listWorkflows()

The .listWorkflows() method retrieves the workflows configured for an agent, resolving them if they're a function. These workflows enable the agent to execute complex, multi-step processes with defined execution paths.

Usage example
Usage example的直接链接

await agent.listWorkflows()

Parameters
Parameters的直接链接

options?:

{ requestContext?: RequestContext }
= {}
Optional configuration object containing request context.
{ requestContext?: RequestContext }

requestContext?:

RequestContext
Request Context for dependency injection and contextual information.

Returns
Returns的直接链接

workflows:

Promise<Record<string, Workflow>>
A promise that resolves to a record of workflow names to their corresponding Workflow instances.

Extended usage example
Extended usage example的直接链接

await agent.listWorkflows({
requestContext: new RequestContext(),
})