This page picks up inside an app you already have: a Next.js App Router
project with a Mastra
Agent, a chat route that invokes it, a React chat that
renders the parts, and your own sign-in. On that path init writes
lib/vendo.ts — the composition the steps below import. A project init reads
as a custom runtime gets vendo/server.mjs instead, and these imports will not
resolve. No app yet? Vendo’s full-stack agent scaffolds
the whole surface.1
Install and run init
@mastra/core is an optional peer, so it is not pulled in for you — step 2 imports Agent from it.Answer the first question with Through my own agent loop (AI SDK / Mastra), and take Vendo Cloud on the model one. Init asks four things in all and takes a few minutes; vendo init covers them. Two matter here: the URL your app serves in dev, which becomes VENDO_BASE_URL, and whether a coding agent may read your source to draft tool descriptions and your product brief — Skip — keep extractor defaults if you would rather send nothing. Extraction also needs typescript 4.9 or newer in the project; without it init finds zero tools.2
Spread the tools into your agent
vendoMastraTools is async, so the agent takes the tools-as-function form. Tools arrive under a vendo_ prefix; include and exclude trim the pack.src/mastra/agents/your-agent.ts
vendo_delegate — not your loop’s. With no model key of your own, point Mastra at the Cloud gateway instead:3
Hand the caller to the route
app/api/chat/route.ts
RequestContext on every call.4
Render the embeds
Mastra streams tool calls in two shapes, Nothing to wrap: the embed finds the wire at
dynamic-tool and tool-<name>. isVendoToolPart covers both.components/vendo-part.tsx
/api/vendo and rides your host session cookie. The guard narrows the part, so state and output typecheck. One component covers data, apps, and approvals — Embeds in your chat has the full contract.5
See it live
Start your app and ask your agent for something behind your API. The tool call runs under the guard and the answer comes back as a working card inside your own chat bubble.Init wrote
VENDO_BASE_URL into .env.local; deployments set the same variable to their public origin, path prefix included — see environment variables. Outside dev it has to be https: Vendo Cloud refuses to enrol an http origin, and scheduled automations will not fire.A complete working version of this page is examples/mastra-agent.Make it yours
The setup was the same for everyone. These, in order, make it yours.Wire auth
Swap the demo principal for your real sign-in.
Add tools
Point Vendo at your API — the agent gets hands.
Approve actions
Decide what runs and what asks first.
Generate screens
Ask for a view, pin it into your grid.
Theme it
Your fonts, colors, and radii on every surface.
Set instructions
The brief your agent reads before every turn.