# Agent.listAgents()

The `.listAgents()` method retrieves the subagents configured for an agent, resolving them if they're a function. These subagents enable the agent to access other agents and perform complex actions.

## Usage example

```typescript
await agent.listAgents()
```

## Parameters

**options** (`{ requestContext?: RequestContext }`): Optional configuration object containing request context. (Default: `{}`)

**options.requestContext** (`RequestContext`): Request Context for dependency injection and contextual information.

## Returns

**agents** (`Promise<Record<string, Agent>>`): A promise that resolves to a record of agent names to their corresponding Agent instances.

## Extended usage example

```typescript
import { RequestContext } from '@mastra/core/request-context'

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

## Related

- [Agents overview](https://mastra.ai/docs/agents/overview)