Skip to main content
Keep your agent. Vendo adds the guarded tools and renders what they return.
1

Install and run init

Answer the first question with Through my own agent loop (AI SDK / Mastra), and take Vendo Cloud on the model one. Init reads your repo, writes the wire route, and lands a VENDO_API_KEY in .env.local.Init wrote lib/vendo.ts for you (src/lib/vendo.ts when your app lives under src/) — the createVendo call, and the caller resolver beside it, so your chat route, your wire route, and the pack all share one instance.
lib/vendo.ts
Init wires whichever provider it detects — swap authJs() for another preset any time (Auth lists all five).With no provider yet, init wrote a demo principal in place of a preset, and the resolver beside it hands your chat route that same subject:
lib/vendo.ts
Either way, your agent and your wire route have to resolve the same subject — a mismatch has no error; the embed just polls a screen it will never be shown (Auth).
2

Spread the tools into your agent

One Mastra definition serves every user, so vendoMastraTools takes no principal — it returns a Promise, which is why the agent takes the tools-as-function form. Every tool lands under a vendo_ prefix — one per registered host action, plus vendo_make (a live view) and vendo_delegate (a whole task for Vendo’s own agent); trim the pack with include or exclude by final tool name.
src/mastra/agents/your-agent.ts
3

Hand the caller to the route

app/api/chat/route.ts
RequestContext is Mastra’s own per-invocation carrier, and Vendo’s tools read the principal off it on every call. Set VENDO_SESSION_KEY on the same context to carry your own session id into the audit trail.
4

Render the embeds

Mastra streams tool calls as dynamic-tool or as tool-<name>, depending on how the tool was declared, so match both.
components/vendo-part.tsx
Nothing to wrap: the embed finds the wire itself and rides your host session cookie, and that one component covers plain data, app refs, and approval refs. Full contract: Embeds in your chat.
5

See it live

Run your own chat and ask for something behind your API. The answer comes back as a working card, inside your own bubble.Init wrote VENDO_BASE_URL into .env.local; deployments set the same variable to the public URL, path prefix included (environment variables).
The Mastra example chat with the vendo_send_trip_report tool pill above an approval card carrying the report, the recipient, and Approve and Deny buttons

Apps in your product

Your agent can build apps now. Where they land in your product, and how to teach your model when to build one, is one more quickstart: Apps in your product.

The full example

examples/mastra-agent is the stock create-mastra weather starter, fronted with Next.js per Mastra’s guide, with this diff applied. Every added line sits between --- vendo and --- /vendo markers, about sixty of them in total.