🎤Micdrop

Mastra Voice Agent in Node.js

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

Installation

Terminal window
npm install @micdrop/mastra @mastra/core

Usage

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() or MCP tools, 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:

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

OptionTypeDescription
agentAgent of MastraThe agent answering
systemPromptstringAdded to its instructions for this call
memory{ thread, resource }Keeps the call in a thread of the agent’s memory
streamOptionsoptions of stream()Any other option, such as maxSteps or modelSettings
toolsTool[]Tools of the call, added to the agent’s own
transformsAnswerTransform[]Rework the answers, see extract

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