@mastra/core
Version:
Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.
32 lines (20 loc) • 989 B
Markdown
# 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
```typescript
await agent.listWorkflows()
```
## Parameters
**options** (`{ requestContext?: RequestContext }`): Optional configuration object containing request context. (Default: `{}`)
**options.requestContext** (`RequestContext`): Request Context for dependency injection and contextual information.
## Returns
**workflows** (`Promise<Record<string, Workflow>>`): A promise that resolves to a record of workflow names to their corresponding Workflow instances.
## Extended usage example
```typescript
await agent.listWorkflows({
requestContext: new RequestContext(),
})
```
## Related
- [Agents overview](https://mastra.ai/docs/agents/overview)
- [Workflows overview](https://mastra.ai/docs/workflows/overview)