---
title: "Reference: Agent.getVoice() | Agents"
description: "Documentation for the `Agent.getVoice()` method in Mastra agents, which retrieves the voice provider for speech capabilities."
packages:
  - "@mastra/core"
---

# Agent.getVoice()

The `.getVoice()` method retrieves the voice provider configured for an agent, resolving it if it's a function. This method is used to access the agent's speech capabilities for text-to-speech and speech-to-text functionality.

## Usage example

```typescript
await agent.getVoice();
```

## Parameters

<PropertiesTable
  content={[
    {
      name: "options",
      type: "{ requestContext?: RequestContext }",
      isOptional: true,
      defaultValue: "{}",
      description: "Optional configuration object containing request context.",
    },
  ]}
/>

## Returns

<PropertiesTable
  content={[
    {
      name: "voice",
      type: "Promise<MastraVoice>",
      description:
        "A promise that resolves to the voice provider configured for the agent, or a default voice provider if none was configured.",
    },
  ]}
/>

## Extended usage example

```typescript
await agent.getVoice({
  requestContext: new RequestContext(),
});
```

### Options parameters

<PropertiesTable
  content={[
    {
      name: "requestContext",
      type: "RequestContext",
      isOptional: true,
      defaultValue: "new RequestContext()",
      description:
        "Request Context for dependency injection and contextual information.",
    },
  ]}
/>

## Related

- [Adding voice to agents](/docs/v1/agents/adding-voice)
- [Voice providers](../voice/mastra-voice)
