Human-in-the-loop for Mastra
Human-in-the-loop for Mastra agents and workflows.
A Mastra tool or a durable workflow step that asks a real person and waits for the answer.
The integration
Add it to your Mastra agent
Install @pushary/mastra. It gives you two ready-made pieces. createPusharyAskTool is a Mastra tool that blocks until a person answers, for a quick approval. pusharyApprovalStep is a workflow step that suspends and resumes on a signed webhook, for a wait measured in hours. Either way the question lands on a phone, the wait is durable, and the decision comes back fail-closed. Connect each end-user's phone once with a one-tap link, and the externalId is your own id for that user.
import { createPusharyAskTool, connect } from "@pushary/mastra"
// Connect the user's phone once, keyed to your own id.
await connect({ apiKey: process.env.PUSHARY_API_KEY! }, "user_123")
// A Mastra tool that blocks on a real person, fail-closed.
export const askHuman = createPusharyAskTool(
{ apiKey: process.env.PUSHARY_API_KEY! },
{ externalId: "user_123" },
)
// add it to any Agent({ tools: { askHuman } })Why you need it
Mastra pauses the agent. Pushary reaches the human.
Mastra can suspend a workflow step and persist the snapshot, and a suspended step does not tell anyone it is waiting. @pushary/mastra completes the loop. createPusharyAskTool covers the blocking case, and pusharyApprovalStep suspends the run, delivers the question to a phone, and resumes on Pushary's signed webhook. Mastra persists the snapshot, so an hour-long wait holds no compute and survives a restart, and every decision is fail-closed and logged.
How it works
From ask to resume
Connect the phone once, then ask a human from the tool or step that guards the action. The waiting, the delivery, and the record are handled for you.
- 01
Install the adapter
Run npm i @pushary/mastra and set your Pushary API key in the environment.
- 02
Connect the phone
Call connect(config, external_id) once per end-user. It returns a link the person taps once to turn on approvals, with no account and no app to install.
- 03
Add the tool or the step
For a quick approval, add createPusharyAskTool to your Agent's tools. For a long wait, put pusharyApprovalStep in a workflow; it suspends until the person answers.
- 04
Resume on the answer
The tool returns fail-closed. The step resumes when Pushary's signed webhook arrives, so a decline, a timeout, or no reply never lets the workflow take the guarded step.
A decision is a yes or no confirm, a multiple-choice select, or a free-text input. Every one is stored with its outcome and kept in the audit log.
The Partner plan
Your agent asks your users, not just you
Ship the agent to real users and let each of them approve their own decisions from their phone, under your brand.
Your users never see a Pushary login or bill.
Your users answer on their own phones
The externalId is your own id for the end-user. Connect their phone once with a keyless one-tap link, and every approval lands with the right person. No account, no app, no key on their side.
Durable, fail-closed waits
The agent stays open on a durable wait backed by a decisions ledger. If nobody answers in the window you set, the decision comes back denied, so a timeout or a restart never turns into an unapproved action.
Phone-first delivery
Pushary reaches the person on the device they carry: native app push first, then PWA push notifications, then Slack if you route it there. You do not build a delivery pipeline.
Signed webhooks and an audit trail
Every decision is written to a durable ledger you can query and export, and resolved decisions post a signed webhook to your callback URL. You have the record of who approved what and when.
FAQ
Questions, answered
Let your Mastra agent ask a human.
Connect a user with one tap, ask a human with one call, and act on a fail-closed decision. Every decision is saved to a durable ledger you can audit.
Partner plan, $99 a month. Your users never see a Pushary login or bill.