---
title: "Mastra Voice Agent in Node.js | Micdrop"
description: "Give a voice to a Mastra agent: its instructions, model, tools, workflows and memory answer a live call in real time."
url: "https://micdrop.dev/docs/agents/mastra"
---

# Mastra Voice Agent in Node.js

`@micdrop/mastra` answers a call with an agent built with [Mastra](https://mastra.ai). It keeps everything the agent already has: its instructions, model, tools, workflows and memory.

## Installation

```bash
npm install @micdrop/mastra @mastra/core
```

## Usage

```typescript
import { Agent } from '@mastra/core/agent'
import { MastraAgent } from '@micdrop/mastra'
import { endCallTool, MicdropServer } from '@micdrop/server'

const supportAgent = new Agent({
  id: 'support',
  name: 'Support',
  instructions:
    'You help customers with their orders. Answer in short spoken sentences.',
  model: 'openai/gpt-5-mini',
  tools: { getOrder },
})

new MicdropServer(socket, {
  stt,
  tts,
  agent: new MastraAgent({
    agent: supportAgent,
    tools: [endCallTool()],
  }),
})
```

The answer reaches the voice as the agent writes it. The tools the Mastra agent runs are recorded in the conversation of the call, so the client and your transcripts see them. The tools of the call, such as `endCallTool()`, [`handoffTool()`](/docs/agents/handoff) or [MCP tools](/docs/agents/mcp), are added to the agent’s own.

## Memory

With `memory`, the call goes into a thread of the agent’s memory. Mastra holds the history, and each answer sends only what was said since the last one:

```typescript
new MastraAgent({
  agent: supportAgent,
  memory: { thread: callId, resource: customerId },
})
```

Working memory and semantic recall then work during the call as they do in chat. Without `memory`, the whole conversation is sent at each answer.

## Options

Option

Type

Description

`agent`

`Agent` of Mastra

The agent answering

`systemPrompt`

`string`

Added to its instructions for this call

`memory`

`{ thread, resource }`

Keeps the call in a thread of the agent’s memory

`streamOptions`

options of `stream()`

Any other option, such as `maxSteps` or `modelSettings`

`tools`

`Tool[]`

Tools of the call, added to the agent’s own

`transforms`

`AnswerTransform[]`

Rework the answers, see [extract](/docs/server/extract)

A spoken answer starts sooner with reasoning off: set it in `modelSettings` or in the `providerOptions` of `streamOptions`, as the model accepts.
