# Automations Source: https://docs.vendo.run/capabilities/automations One model: an automation is a record someone owns, your deployment runs it, and Cloud is only the alarm clock. An automation is a **record**. It has an owner, a trigger, a task, and — if the task is a goal — the name of the agent that thinks it through. It lives in your database, it runs in your backend, and something outside just has to wake you up on time. ```text theme={null} record wake run ────── ──── ─── owner → a cron in your app → steps → run in-process trigger the dev ticker goal → the named agent, task Cloud's heartbeat with the OWNER's grants agent name an inbound webhook armed ``` ## Two authors, one model Someone has to say an automation should exist. Exactly two can, and they differ only in what consent means. They ask for it in words. Consent is the **grants** they allow while they are present, and revoking one stops the run loudly rather than silently widening it. `agent.on(...)` in your source. Consent is **the code**: it exists because you deployed it, and your next deploy reconciles it. ### A user asks for it ```text theme={null} "Every weekday at 8am, email me the invoices that went overdue overnight." ``` The agent creates the record and tells them what it armed, in the thread. There is no form, no separate automations screen, and no create call for you to make — everything that can author one already does. An automation card in a Maple thread reading Every Friday at 5:00 PM, prepare a digest of that week's spending by category, drafted and ready for you to send ### You declare it in code ```ts lib/agent.ts theme={null} import { agent } from "@vendoai/vendo"; export const support = agent({ name: "support" }); support.on("0 9 * * 1", "summarize the week and email ops"); support.on({ every: "1d" }, "refresh credit scores"); support.on({ event: "payment.failed" }, "triage and notify the user"); ``` `.on()` is a declaration: it returns nothing, touches no database, and reconciles once at boot. A bad schedule throws right there — `"every monday"` is not a cron, and you find that out at the declaration site rather than at 2am. See [`.on()`](/backend/automate) for every shape it takes. ## What wakes it Your deployment decides what is due. Nothing else does. A five-field cron, a plain interval, or a one-shot timestamp. `"0 8 * * 1-5"` · `{ every: "15m" }` · `{ at: "2026-09-01T09:00Z" }` Your own product event, emitted from the code path that owns it. `{ event: "invoice.paid" }` A signed delivery from a connected service. `{ webhook: "stripe" }` Host events fire in your own process, on the line that emitted them: ```ts theme={null} await vendo.emit("invoice.paid", invoice, principal); ``` That runs every armed automation listening for `invoice.paid` — the emitting user's, and those of every org they belong to — and answers with the run ids it started. Schedules need someone to knock, and the door is idempotent: a duplicate knock claims nothing and fires nothing. ```http theme={null} POST /api/vendo/tick ``` With a Cloud key there is nothing to set. The deployment derives the tick secret from `VENDO_API_KEY` and publishes it, with its own URL, when it boots. Without a key, set `VENDO_TICK_SECRET` yourself and knock from your own cron. Cloud's heartbeat is an **alarm clock, not a brain**. It calls `/api/vendo/tick` on every enrolled deployment once a minute with a signed, empty body. It holds no schedule, decides nothing about what is due, and never writes a run. The run ledger you read in the console is the one your deployment wrote. ## Agents are code, never stored A record names an agent with a string. The agent itself is your code, registered under that name when your process boots and looked up when the automation fires. ```ts lib/vendo.ts focus={4} theme={null} import { createVendo } from "@vendoai/vendo/server"; import { billing, support } from "./agents"; export const vendo = createVendo({ agents: [support, billing] }); ``` A goal runs with the **owner's** grants, inside your backend. A steps task needs no brain at all and runs in-process. A record naming an agent nobody registered writes a failed run with the missing name on it — never a silent skip, and never someone else's agent under this record's grants. ## Permissions before the first fire Nobody is there to approve anything at 2am, so the asking happens when the automation is turned on. ```ts theme={null} const { enabled, missing, grantSetId } = await vendo.automations.enable(id, ctx); ``` `missing` is what the owner still has to allow. They belong to one grant set, so one decision settles them all, and after that the automation runs as the person who armed it, every time. ## Reaching your API with nobody there An away run carries no browser session. There is no cookie to forward, so auth material is minted for the owner before each outbound call — that is the `actAs` seam. Present calls need none of it: a user is in the room, and the inbound cookie or bearer already forwards. `createVendo({ auth: authJs() })` fills `actAs` for you — see [Wire auth](/howto/auth) — and most deployments stop reading here. The presets below are the same wiring by hand, for when no shipped `auth` preset fits. | Preset | Provider | Shape | | ------------------ | -------------- | ----------------------------------------- | | `authJsPreset` | Auth.js | Offline session JWE | | `supabasePreset` | Supabase Auth | Offline HS256 with the project JWT secret | | `clerkPreset` | Clerk | Host-owned away token plus middleware | | `auth0Preset` | Auth0 | Host-owned away token plus middleware | | `genericJwtPreset` | Anything HS256 | Configurable secret, claims, header | Auth.js and Supabase let a host holding the session secret mint a token their own verifier accepts, so nothing else changes in your app. Clerk and Auth0 sign sessions with private keys you do not hold, so their presets ship two halves: a producer that signs a short-lived `VendoAway` token, and a verify middleware you mount on your host app. They ship on `@vendoai/vendo/actions`, a subpath of the package you already have: ```ts lib/vendo.ts focus={7,8,9,10} theme={null} import { authJsPreset } from "@vendoai/vendo/actions/presets/auth-js"; import { createVendo } from "@vendoai/vendo/server"; import { resolvePrincipal } from "@/lib/session"; export const vendo = createVendo({ principal: resolvePrincipal, actAs: authJsPreset({ secret: process.env.AUTH_SECRET!, cookieName: "authjs.session-token", }), }); ``` The cookie name doubles as the JWE salt, so it has to match your Auth.js config. Clerk and Auth0 return a preset object instead of a function; pass its `actAs` half. ### Mount the verify middleware Clerk and Auth0 sign a host-owned token rather than a real provider session, so your host API has to accept it and turn it back into a user. ```ts middleware.ts focus={3,5} theme={null} import { clerkPreset } from "@vendoai/vendo/actions/presets"; const clerk = clerkPreset({ secret: process.env.VENDO_AWAY_TOKEN_SECRET! }); export const middleware = clerk.nextMiddleware; export const config = { matcher: "/api/:path*" }; ``` Each preset also exports `expressMiddleware`. The middleware strips any caller-supplied `x-vendo-away-*` headers, verifies a real `VendoAway` token, and injects the subject on headers your API can trust. Generate the shared secret with `openssl rand -base64 32` and set it for both halves. ### The impersonation guard Before invoking `actAs`, Vendo compares the grant's subject to the running principal's. On a mismatch the call fails closed with `act-as-subject-mismatch` and no outbound request is made. You do not wire this; it applies on every preset, and every attempt is audited with its disposition: `minted`, `declined`, `mismatch`, or `error`. ## Observe and control In the browser there is nothing to build. One hook carries every verb into a panel you write yourself. ```tsx theme={null} const { automations, enable, disable, runs, dryRun, stopRun, rerun } = useAutomations(); ``` Server-side there is no request to read from, so every verb takes the caller's `RunContext` last. That is what scopes the read to what this principal may see — there is no ambient "current user". ```ts theme={null} import type { RunContext } from "@vendoai/vendo/core"; const ctx: RunContext = { principal: { kind: "user", subject: "user_ada" }, venue: "automation", presence: "present", sessionId: "sess_ops", }; await vendo.automations.list({ owner, agent }, ctx); // deployment-wide await vendo.automations.get(id, ctx); await vendo.automations.enable(id, ctx); await vendo.automations.disable(id, ctx); // the kill switch await vendo.automations.dryRun(id, ctx, event); // what it would do; runs nothing await vendo.automations.runs.list({ automationId, owner, agent, status }, ctx); await vendo.automations.runs.get(runId, ctx); await vendo.automations.runs.stop(runId, ctx); await vendo.automations.runs.rerun(runId, ctx); ``` `disable` is a person's decision, and it outranks your code: a redeploy's reconcile will never re-arm something a human switched off. # Connected accounts Source: https://docs.vendo.run/capabilities/connected-accounts Each user connects their own Gmail, Slack, or GitHub once, and every later tool call runs as that user. ## The picture No user token enters your server. The broker holds the credential and runs the call. ```mermaid theme={null} flowchart LR U["Your user
signed in to your product"] CARD["Connect card
one OAuth popup"] BROKER["Cloud broker
holds the credential"] ACCT["Their Gmail
their account, not yours"] U --> CARD --> BROKER --> ACCT ACCT -. "runs as them, every time after" .-> U classDef yours fill:#ffffff,stroke:#c9c5d6,stroke-width:1px,color:#15141b classDef vendo fill:#f5f1ff,stroke:#ddd0ff,stroke-width:1px,color:#4a22bd class U,ACCT yours class CARD,BROKER vendo ``` A connection is keyed to the Vendo principal's subject. One user can never read, use, or disconnect another user's account. ## Naming the services With a Cloud key and nothing else, the agent gets one tool that lists what this product can connect to and one that asks the user to connect it. Name the services in `connectedAccounts` when you want their tools in the agent's hands from the start. ```ts app/api/vendo/[...vendo]/route.ts focus={6} theme={null} import { createVendo } from "@vendoai/vendo/server"; const vendo = createVendo({ principal: resolvePrincipal, instructions: "...", connectedAccounts: ["gmail", "slack"], }); ``` Those names scope three things at once — the tools the agent sees, the accounts the connect surface offers, and the catalog it advertises — so they can never drift apart. Service names used to go in `connectors`. They still work there for one more minor and warn once; `connectors` is for [connector objects](/capabilities/connectors), where **you** hold the one credential. ## The connect card A tool call for a service the user has not connected never reaches the guard. The call comes back `connect-required`, and the thread renders the ask in place. A popup opens on the broker's own consent page. Your product never renders an OAuth screen. The user finishes in the popup and it closes itself. No re-prompting. The turn picks up where it stopped. A connect card in a Maple thread carrying the Gmail mark, the reason the agent needs it, and Connect and Not now buttons The agent can also raise the ask on its own, before calling anything, when the request plainly needs a service the user has not connected. ## Managing accounts The `useConnections` hook reads the signed-in user's accounts and disconnects them. Render it wherever you already handle user settings. ```tsx theme={null} const { connections, disconnect, isLoading } = useConnections(); ``` The shipped thread also carries a connect dock: a badge counting active accounts, and a tray listing everything connectable. The connect tray open above the Maple composer, with a search field and a grid of connectable services each carrying an add button Building your own surface instead? The [connection routes](/reference/http-routes) all resolve the subject from the session — there is no caller-supplied subject and no cross-user read. Connecting needs a signed-in person: an ephemeral principal is refused, because an external account would outlive it. ## What the guard sees A connector tool's risk comes from the provider's own tags and nothing else, so an untagged tool is `ungraded` and the guard asks about it on every call. Pin the grade of any tool by name in [`.vendo/overrides.json`](/reference/tool-overrides) and your grade wins — including for a tool the agent reached by searching the provider's catalog, which the file names by the provider's own tool id. Every connector call is audited with the account identity behind it: the connector, the toolkit, and the subject it ran as. That identity is stripped from the outcome the model and the UI see. # Tools from someone else's API Source: https://docs.vendo.run/capabilities/connectors Point the agent at an MCP server or any OpenAPI document and its operations become guarded tools. ## Where tools come from A connector is an outside API your **deployment** brings, under one credential **you** hold. `vendo sync` reads your own API; a connector reads someone else's at boot and hands the result to the same registry. ```mermaid theme={null} flowchart LR SPEC["An OpenAPI document
or an MCP server"] CONN["Connector
lists what is there"] GUARD["Guard
risk · approval · audit"] HANDS["The agent's hands"] SPEC --> CONN --> GUARD --> HANDS classDef yours fill:#ffffff,stroke:#c9c5d6,stroke-width:1px,color:#15141b classDef vendo fill:#f5f1ff,stroke:#ddd0ff,stroke-width:1px,color:#4a22bd class SPEC yours class CONN,GUARD,HANDS vendo ``` Connector tools are ordinary tools. They collide-check against your own by name, they take corrections in `.vendo/overrides.json`, and every call goes through the guard. ## Any REST API with a spec `openApiConnector` takes the spec **document**, not a path or a URL. Read it, bundle it, or fetch it yourself, then hand it over. ```ts app/api/vendo/[...vendo]/route.ts focus={6,7,8,9,10,11} theme={null} import { readFileSync } from "node:fs"; import { createVendo, openApiConnector } from "@vendoai/vendo/server"; const vendo = createVendo({ connectors: [ openApiConnector({ name: "ledger", spec: readFileSync("./specs/ledger.json", "utf8"), baseUrl: "https://api.ledger.example", headers: { authorization: `Bearer ${process.env.LEDGER_TOKEN}` }, }), ], }); ``` | Option | What it does | | --------- | ----------------------------------------------------------------------- | | `spec` | The document itself: JSON text, YAML text, or an already-parsed object. | | `baseUrl` | Where the calls land. Wins over the spec's own `servers[0]`. | | `headers` | Static headers, or a function called per tool call (below). | | `name` | The namespace every tool is named under. Defaults to `openapi`. | Each operation becomes one tool — `openapi_ledger_getAccount`. Path, query, and body parameters come straight off the spec, so the model sees the API's own declared shape. Risk comes from the method, never the name: `DELETE` is `destructive`, everything else is `ungraded`, and the guard asks about every ungraded call. Grade them by name: ```json .vendo/overrides.json theme={null} { "format": "vendo/overrides@3", "tools": { "openapi_ledger_getAccount": { "risk": "read" }, "openapi_ledger_createAccount": { "risk": "write" } } } ``` ## An MCP server `mcpConnector` speaks streamable HTTP to any MCP server and lists its tools at boot. ```ts app/api/vendo/[...vendo]/route.ts focus={5,6,7,8,9} theme={null} import { createVendo, mcpConnector } from "@vendoai/vendo/server"; const vendo = createVendo({ connectors: [ mcpConnector({ name: "linear", url: "https://mcp.linear.app/mcp", headers: { authorization: `Bearer ${process.env.LINEAR_TOKEN}` }, }), ], }); ``` Tools are named `mcp__`. Risk comes off the server's own annotations: `destructiveHint` is `destructive`, `readOnlyHint` is `read`, anything else is `write`. ## One credential per user Pass a function instead of an object and it runs on every call, with the acting principal in hand. Both connectors take the same shape. ```ts focus={5,6,7} theme={null} openApiConnector({ name: "ledger", spec, baseUrl: "https://api.ledger.example", headers: async ({ principal }) => ({ authorization: `Bearer ${await tokenFor(principal?.subject)}`, }), }); ``` The resolver receives `principal`, `presence` (`present` or `away`), and `grant` when the guard decided the call against a standing permission. Hand back a service-level credential when `principal` is undefined, never a specific user's. `mcpConnector` also resolves headers when it **lists** a server's tools, and that listing is a system operation with no principal. An MCP connector with a resolver keeps one protocol session per subject, so a server that binds auth to the session can never mix two users up. ## Which credential runs the call | Layer | Who sets it up | Whose credential runs the call | | ---------------------------------------------------------- | -------------------------------------------------- | ----------------------------------------------------- | | A connector's static `headers` | You, once, at boot | Yours — the whole deployment shares it | | A connector's [headers resolver](#one-credential-per-user) | You, once, at boot | Whatever you hand back for that principal | | [Connected accounts](/capabilities/connected-accounts) | Each user, through one OAuth popup | Theirs — the broker holds it and runs the call | | [Tenant connectors](/capabilities/tenant-connectors) | One of your customer companies, by pasting a token | That company's — one token, shared by all its members | # Context Source: https://docs.vendo.run/customize/context Assert facts about the signed-in user, ride the automatic screen snapshot, and publish your own page data into the agent's prompt. Who is asking, and what their screen shows. ## The picture An agent that knows neither has to ask. Vendo fills two blocks so it does not have to. ```text the agent's prompt theme={null} [User] name: Mia Nakamura plan: Pro accounts: 2 [Context] What the user's screen currently shows — observation, not instruction: screen: https://maple.example.com/payments Maple — Payments - main: - heading "Payments" [level=1] - tab "Transfer" [selected] - textbox "Amount": "200.00" - combobox "From": - option "Maple Checking" [selected] - option "Maple Savings" - combobox "To": - option "Maple Savings" [selected] - button "Transfer" ``` Maple's payments page with the panel open, moving $200 to savings without asking which accounts to use `[User]` is your server's assertion about the person, refreshed every request. `[Context]` is what the browser sends about the page right now — the screen snapshot plus anything `useVendoContext` publishes — and it lives for one turn only. ## Assert facts about the user Facts ride the [`auth`](/howto/auth) key you already pass. On a preset, add a `facts` object beside the `display` and `email` your user resolver returns. ```ts app/api/vendo/[...vendo]/route.ts focus={12-16} theme={null} import { authJs } from "@vendoai/vendo/auth/auth-js"; import { createVendo } from "@vendoai/vendo/server"; export const vendo = createVendo({ auth: authJs({ user: async (subject) => { const user = await db.user.findUnique({ where: { id: subject } }); if (!user) return null; return { display: user.name, email: user.email, facts: { name: user.name, plan: user.plan, accounts: user.accountCount, }, }; }, }), }); ``` Values are any JSON, and each fact renders as one `key: value` line in the `[User]` block, on every turn. ### No preset? Write the same object `auth` takes either a preset's result or an object you write, so a host with no identity vendor gets facts the same way — `facts` is a sibling of `principal`, resolved from the same request. ```ts app/api/vendo/[...vendo]/route.ts focus={9-12} theme={null} import { createVendo } from "@vendoai/vendo/server"; import { getSession } from "@/lib/session"; export const vendo = createVendo({ auth: { principal: async (request) => { const user = await getSession(request); return user ? { kind: "user", subject: user.id } : null; }, facts: async (request) => { const user = await getSession(request); return user ? { name: user.name, plan: user.plan } : undefined; }, }, }); ``` Both seams get the same `Request`, so cache your session decode if it is expensive — the shipped presets memoize theirs per request. Facts go to the model verbatim. Put nothing in them you would not paste into a chat window: no tokens, no keys, no identifiers you rely on staying private. ## The screen rides along already You wire nothing for this. On every send, the widget snapshots the visible page — its URL and title, then headings, landmarks, links, buttons, table contents, form values, and control states — and attaches it as `[Context]`. The block is labeled as observation, so page text reads as evidence rather than as instructions to the model. ### Publish what the page does not show A cart total, a selected row id, a wizard step. `useVendoContext` merges your own data into the same `[Context]` block and retires it on unmount, so the agent never sees a screen the user has left. ```tsx app/checkout/payment-step.tsx focus={6} theme={null} "use client"; import { useVendoContext } from "@vendoai/vendo/react"; export function PaymentStep({ cart }: { cart: Cart }) { useVendoContext({ step: "payment", cartTotal: cart.total }); return /* … */; } ``` Several mounted callers coexist and merge, and on a repeated key the later one wins. ### Keep something out `data-vendo-ignore` drops an element and everything under it. Vendo's own chrome carries it, so the widget never snapshots itself. ```tsx theme={null}
``` To stop page capture entirely, set `captureScreen={false}` on the provider. Data you publish through `useVendoContext` still rides. ```tsx app/layout.tsx focus={1} theme={null} {children} ``` ## What actually reaches the model * **`[User]` is server-trust.** It comes from your resolver, on your server, on every request. The client cannot set it. * **`[Context]` is client-trust, one turn only.** The browser sends it, so the model reads it as evidence, never as authority — put anything you need trusted in `facts`. It is never written to the transcript, so the next turn on the same thread carries no context. * **8 KB, enforced twice.** The client truncates before sending, and the server re-caps whatever arrives by dropping entries past the budget rather than refusing the turn. * **Nothing can forge a section.** Values render as `key: value` with every continuation line indented, so a fact cannot close its own block and impersonate one of Vendo's. # Knowledge Source: https://docs.vendo.run/customize/knowledge Connect your product docs so the agent answers how-it-works questions from them, cites what it used, and says it does not know when they do not cover it. Answers from your docs, with citations. ## The picture Ask "how long do card refunds take?" and the agent looks it up instead of guessing. The answer arrives with a **Sources** row under it, one chip per cited document. A Maple answer about card refund timing with a Sources row of five citation chips, one open on the snippet it quoted and the document it came from Each chip opens the snippet the answer came from. When your docs do not cover the question, the turn says so plainly instead of inventing an answer. `VENDO_API_KEY` is the whole setup. The `knowledge` slot fills with the Cloud engine, and the agent picks up its `vendo_knowledge_search` tool with no code change. ## Load your docs Open [console.vendo.run](https://console.vendo.run/knowledge/sources) and go to Knowledge. **Upload files** takes documents straight off your machine. **Crawl a URL** points the crawler at a docs site you already publish. Indexing takes a few seconds and the page does not spin while it runs. Refresh, and the document count tells you the corpus is searchable. Still in the Knowledge tab, open **Playground** and ask something your docs answer. The passage under the green **Would answer** banner is the one the agent answers from; a passage marked **Below the bar** was retrieved but not cited. That is the whole setup. In your app the same search tool runs on its own. ## Docs that live in your repo If your documentation sits next to your code, push it from the repo instead of uploading by hand. ```bash theme={null} npx vendo knowledge add "docs/**/*.md" npx vendo knowledge sync # Synced: 128 upserted, 0 removed, 0 unchanged → Vendo Cloud (console.vendo.run). ``` `add` only records the source in `.vendo/knowledge.json`. `sync` is the one verb that moves content: it upserts what changed against the hash manifest at `.vendo/knowledge-manifest.json` and removes what vanished, so a second run over unedited files pushes nothing. ### Say what shape a file is `--kind` decides how a file is cut up. `docs`, the default, chunks prose at heading boundaries. `glossary` and `api` make every heading its own chunk, which is what makes an exact term lookup return the term rather than a fuzzy paragraph. ```bash theme={null} npx vendo knowledge add "glossary.md" --kind glossary npx vendo knowledge add "docs/api/**/*.md" --kind api ``` A source added with `--visibility internal` answers your own host-wired callers only: end-user turns never see those documents, and the prompt's index does not name them. Every verb and flag is in [the CLI reference](/reference/cli#vendo-knowledge). ### Keep it synced from CI Run `vendo knowledge sync` after a docs change merges, with `VENDO_API_KEY` set as a secret. Commit `.vendo/knowledge-manifest.json` so each run only pushes the documents that changed. # User data Source: https://docs.vendo.run/customize/user-data Give each user a place to keep their own files: drop one in chat and the agent can read it, build on it, and pick it up again in next week's conversation. Drop a file. Build on it. ## The picture Attachments used to ride one message and end with it. A file dropped in chat is now **saved** — into that user's own files, private to them, still there in next week's conversation. The agent reads it, answers from it, and can build an app on top of it. The message that follows carries only a reference to the file, which is what keeps a transcript light: a spreadsheet lands once, and the conversation about it stays a conversation. Images are the deliberate exception. They still ride the message itself, because that is how a model sees a picture at all. ## Where files go Each user gets `/user/files/` inside their own workspace, scoped to that one person. Nothing is shared between users, and nothing here belongs to a thread, so a file outlives every conversation that comes after it. `POST /files` is the door a browser uses: ```http theme={null} POST /api/vendo/files?name=sales-2026.csv Content-Type: text/csv x-vendo-upload: 1 month,revenue jan,31000 ``` ```json theme={null} { "path": "/user/files/sales-2026.csv", "bytes": 24 } ``` The body is the file's own raw bytes under its own media type, so the name rides the query string, percent-encoded. `x-vendo-upload` is required and its value is never read — it is simply a header a cross-site form post cannot set. A name is a **file name**, never a path: `nested/report.csv` and `../escape.csv` are refused rather than quietly rewritten. **Same name replaces.** Upload `sales-2026.csv` again and the new file *is* `sales-2026.csv` — last write wins, no `-v2` suffix, no second copy. Re-sending a corrected export is the common case, and a drawer of four near-identical spreadsheets would be worse than one that keeps the newest. ## From the browser The client does it in one call — no upload state to manage: ```ts theme={null} const saved = await client.files.upload(file); // { path: "/user/files/sales-2026.csv", bytes: 86104 } ``` The built-in chat surface already does this for you: dropping a file on the thread, or picking one with the paperclip, uploads it and sends the reference. ## From your own code `putUserFile` is the same write, called server-side — for pushing a file at a user without waiting for them to bring it: ```ts theme={null} await vendo.putUserFile({ principal: { kind: "user", subject: user.id }, name: "statement-2026-08.pdf", content: bytes, }); ``` It **delivers nothing and starts no turn**. The file is simply there, and the user reaches it the next time they chat. ## What the agent does with it Three tools come with every deployment — no adapter, no key, no configuration: | Tool | Risk | What it does | | ----------------------- | ------- | ------------------------------------------------------------------------------------- | | `vendo_user_files_list` | `read` | What this user has shared, with each file's size and type | | `vendo_user_files_read` | `read` | Reads one of them, by name | | `vendo_user_files_put` | `write` | Saves one, by name. Text as `content`; anything else base64 with `encoding: "base64"` | They run through the same guard, audit trail, and approval rules as every other tool, so on the `cautious` preset the write parks for the person. None of them takes a path or a subject — each call opens the drawer of the principal that made it and no other. The list is also how the agent finds last month's upload in a conversation that knows nothing about it. And because these are ordinary tools, they are at the [MCP door](/outside-agents/how-the-door-works) too: an outside agent holding a user-bound token gets the same three against that same user's files. ## What reads back Any file can be **saved**. Only these read back as text: `csv` · `tsv` · `txt` · `log` · `sql` · `md` · `json` · `ndjson` · `xml` · `html` · `yaml` · `yml` Anything else — a PDF, an image, an `.xlsx` workbook, a `.parquet` export — comes back with its name, size, and media type, plus a sentence telling the agent to ask the user for one of the readable formats instead. That is an `ok`, not an error: the bytes are safe either way. **The extension is the whole evidence.** Nothing stores a media type, so a perfectly good text file saved as `notes.dat` does not read back. Renaming it `notes.txt` is what fixes it. ## Building on a file **There is nothing to wire here.** Once your users can drop files, everything below happens on its own. The whole flow, as your user experiences it: 1. **They drop `sales-2026.csv`** into the chat and ask: *"make me a dashboard of this."* 2. **The agent reads the file and builds an app.** The rows it needs are copied into a table in the app's own SQL database, separate from the user's files. The dashboard renders from those saved rows. 3. **The file and the app now live separately.** The copy is a snapshot, not a live link, so nothing re-reads the user's files on the app's behalf. 4. **In December they drop the updated `sales-2026.csv`.** Same name, so it replaces the old copy. The dashboard still shows what it was built from — 5. **— until they ask.** *"Refresh my dashboard."* The agent reads the new file, rewrites the app's table, and says what it did. No watcher, no polling, no background sync: a file sitting in the drawer changes nothing until the user talks to the agent, so everything that happens is visible in the conversation. In this release a PDF or an image **lands in the drawer and can be read about, but does not reach an app**. Only tabular data is copied into an app. ## Size An upload is capped at **5 MiB** (`5242880` bytes), and `createVendo({ uploadMaxBytes })` moves it. That is a cap on the *door*: both `POST /files` and `vendo_user_files_put` read the same number, so a file refused in chat cannot be admitted by asking over MCP instead. `putUserFile` is a trusted server caller, so the door's cap does not apply to it. What bounds it is the backing — with no `files:` adapter, files are kept in your store's own blobs, up to 5 MiB each. ## Your own bucket `s3Files` puts every file in a bucket you own, and is what you wire before raising `uploadMaxBytes` past 5 MiB. It talks to anything S3-compatible — Cloudflare R2, AWS S3, Supabase Storage, MinIO — and signs SigV4 over WebCrypto, so it runs on an edge target too. ```ts focus={4-11} theme={null} import { createVendo, s3Files } from "@vendoai/vendo/server"; createVendo({ files: s3Files({ endpoint: "https://.r2.cloudflarestorage.com", bucket: "vendo-files", credentials: { accessKeyId: process.env.R2_ACCESS_KEY_ID!, secretAccessKey: process.env.R2_SECRET_ACCESS_KEY!, }, }), uploadMaxBytes: 50 * 1024 * 1024, }); ``` `endpoint` is the origin your provider's dashboard gives you, and `region` defaults to `"auto"` — what R2 requires and MinIO ignores, while AWS and Supabase need their real one. There is one backing for every file: unset, files are store blobs; set, every file is in your bucket. # AI SDK Source: https://docs.vendo.run/existing-agent/ai-sdk Spread Vendo's guarded tool pack into a Vercel AI SDK loop you already run, and render what it returns in your own chat. Keep your loop. Vendo adds the guarded tools and renders what they return. ```bash npm theme={null} npm install @vendoai/vendo npx vendo init ``` ```bash pnpm theme={null} pnpm add @vendoai/vendo pnpm exec vendo init ``` This page picks up from a Next.js App Router app that already runs an AI SDK `streamText` loop. If you don't have one yet, the [AI SDK chatbot quickstart](https://ai-sdk.dev/docs/getting-started/nextjs-app-router) gets you there first; run init from that app's root. Init asks four things and takes a few minutes — [`vendo init`](/reference/vendo-init) covers all of them. Answer the first with **Through my own agent loop (AI SDK / Mastra)**, and take **Vendo Cloud** on the model one. There are two model budgets on this path. The Cloud key pays for the screens and apps Vendo generates; your own loop keeps its own key — `model: yourModel` below is untouched — so set `ANTHROPIC_API_KEY` or your provider's equivalent too. No browser to approve the Cloud key in? Pass `--cloud-key `, or `--byo` to skip Cloud entirely. ```ts app/api/chat/route.ts focus={2,14} theme={null} import { convertToModelMessages, stepCountIs, streamText } from "ai"; import { vendoTools } from "@vendoai/vendo/ai-sdk"; import { resolvePrincipal, vendo } from "@/lib/vendo"; export async function POST(req: Request) { const { messages } = await req.json(); const caller = await resolvePrincipal(req); if (!caller) return new Response("Unauthorized", { status: 401 }); return streamText({ model: yourModel, // your model, unchanged messages: await convertToModelMessages(messages), stopWhen: stepCountIs(5), // the AI SDK stops after one step by default system: "…your system prompt as it is", tools: { ...yourTools, ...(await vendoTools(vendo, { principal: caller })) }, }).toUIMessageStreamResponse(); } ``` The pack is built per request, inside the handler, so every tool runs as the caller. Tools arrive under a `vendo_` prefix; `include` and `exclude` trim the pack. ```tsx app/page.tsx focus={3-7} theme={null} import { isVendoToolPart, VendoToolResult } from "@vendoai/vendo/react"; if (isVendoToolPart(part)) { return part.state === "output-available" ? :
Building…
; } // your own parts fall through to your own rendering ``` Nothing to wrap: the embed finds the wire at `/api/vendo` and rides your host session cookie. `isVendoToolPart` owns the whole "is this ours" question and narrows the part, so `part.state` and `part.output` typecheck. Wait for `output-available` before you render — a generated app streams for a few seconds first, and an embed handed nothing renders nothing. One component covers data, apps, and approvals — [Embeds in your chat](/existing-agent/embeds) has the full contract.
```bash theme={null} npm run dev ``` Ask for something the agent has to build: *"Make me a Recent Activity view listing my three most recent transactions."* You'll see a `vendo_make` call stream for a few seconds, then the generated app render inline in your own chat. Fresh out of init, that app has no data to show — the only route init found was your chat route, and it excludes that one because it runs a model loop. Its empty state will say so. [Add tools](/howto/tools) is where you point Vendo at your real API and the agent gets hands.
## Make it yours The setup was the same for everyone. These, in order, make it yours. Swap the demo principal for your real sign-in. Point Vendo at your API — the agent gets hands. Decide what runs and what asks first. Ask for a view, pin it into your grid. Your fonts, colors, and radii on every surface. The brief your agent reads before every turn. # Mastra Source: https://docs.vendo.run/existing-agent/mastra Spread Vendo's guarded tool pack into a Mastra agent you already run, and render what it returns in your own chat. Keep your agent. Vendo adds the guarded tools and renders what they return. 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](/product/quickstart) scaffolds the whole surface. ```bash npm theme={null} npm install @vendoai/vendo @mastra/core npx vendo init ``` ```bash pnpm theme={null} pnpm add @vendoai/vendo @mastra/core pnpm exec vendo 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`](/reference/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. `vendoMastraTools` is async, so the agent takes the tools-as-function form. Tools arrive under a `vendo_` prefix; `include` and `exclude` trim the pack. ```ts src/mastra/agents/your-agent.ts focus={2,10} theme={null} import { Agent } from "@mastra/core/agent"; import { vendoMastraTools } from "@vendoai/vendo/mastra"; import { vendo } from "@/lib/vendo"; export const yourAgent = new Agent({ id: "your-agent", name: "your-agent", instructions: "…your system prompt as it is", model: "openai/gpt-4.1-mini", // your model, unchanged tools: async () => ({ ...yourTools, ...(await vendoMastraTools(vendo)) }), }); ``` Your agent keeps thinking on your own model. The **Vendo Cloud** key you took in step 1 pays for *Vendo's* turns — app generation, `vendo_delegate` — not your loop's. With no model key of your own, point Mastra at the Cloud gateway instead: ```ts theme={null} import { createAnthropic } from "@ai-sdk/anthropic"; const model = createAnthropic({ apiKey: process.env.VENDO_API_KEY, baseURL: `${process.env.VENDO_CONSOLE_URL ?? "https://console.vendo.run"}/api/v1`, })("vendo"); ``` ```ts app/api/chat/route.ts theme={null} import { RequestContext } from "@mastra/core/request-context"; import { VENDO_PRINCIPAL_KEY } from "@vendoai/vendo/mastra"; import { resolvePrincipal } from "@/lib/vendo"; // in your existing POST handler, before you invoke the agent: const caller = await resolvePrincipal(req); if (!caller) return new Response("Unauthorized", { status: 401 }); const requestContext = new RequestContext(); requestContext.set(VENDO_PRINCIPAL_KEY, caller); params.requestContext = requestContext; ``` One agent definition serves every user, so the caller travels per request: Vendo's tools read the principal off Mastra's `RequestContext` on every call. Mastra streams tool calls in two shapes, `dynamic-tool` and `tool-`. `isVendoToolPart` covers both. ```tsx components/vendo-part.tsx focus={5-8} theme={null} import { getToolName, type UIMessage } from "ai"; import { isVendoToolPart, VendoToolResult } from "@vendoai/vendo/react"; export function VendoPart({ part }: { part: UIMessage["parts"][number] }) { if (!isVendoToolPart(part)) return null; // your own parts render elsewhere return part.state === "output-available" ? : Running {getToolName(part)}…; } ``` Nothing to wrap: the embed finds the wire at `/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](/existing-agent/embeds) has the full contract. 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](/reference/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`](https://github.com/runvendo/vendo/tree/main/examples/mastra-agent). ## Make it yours The setup was the same for everyone. These, in order, make it yours. Swap the demo principal for your real sign-in. Point Vendo at your API — the agent gets hands. Decide what runs and what asks first. Ask for a view, pin it into your grid. Your fonts, colors, and radii on every surface. The brief your agent reads before every turn. # In your existing agent Source: https://docs.vendo.run/existing-agent/quickstart Spread Vendo's guarded tool pack into an AI SDK or Mastra loop you already run, and render what it returns in your own chat. Keep your loop. Vendo adds the guarded tools and renders what they return. Every path starts with [`npx vendo init`](/reference/vendo-init), which reads your repo before it asks anything. It asks how people will use your agent, how your users sign in, where the app runs in dev, and whether it may send your source to a model provider to grade your tool catalog — every one Enter-to-accept, and all of them [listed with their flags](/reference/vendo-init#what-an-interactive-run-asks) — then writes the wiring. Pick how your loop runs and follow that page end to end — each one is complete on its own. Per-request packs, `dynamic-tool` parts, one route edit. `vendoTools(vendo, { principal })` A static definition, the request-context caller, one route edit. `VENDO_PRINCIPAL_KEY` Any agent that speaks MCP gets the same guarded tools. `createVendo({ mcp: true })` # Generated apps Source: https://docs.vendo.run/generated/apps How one ask becomes one app.tsx screen, what that screen may write, and why every user gets their own copy. Your user asks for something. One `app.tsx` screen comes back, live on real data. ## One ask, one app A savings goals screen built in the Maple panel, one card per goal with the amount saved, the target, and a progress bar An app is one file holding one default-exported React component. Saving it repaints the person's screen. ```tsx app.tsx focus={4,15} theme={null} import { useQuery, tools, Stack, Row, Text, Button } from "@vendo/screen"; export default function Spend() { const spend = useQuery("host_spend_by_category", { month: "aug" }); return ( {spend.rows.map((row) => ( ))}