Tabs & Spaces Developers

Build

Actions

An action is something your app does when an agent asks, for the person the agent works for: add a contact, sign a guestbook, look up an order. You declare it in your manifest; your server does it, or (an action on your own records) the workspace does: see Actions without a server.

How it goes

  1. Someone asks an agent ("@Tabby sign the guestbook: lunch on Friday?"). The agent sees your actions, their descriptions and inputs, and chooses one.
  2. If the action changes something, the agent asks first. A card under its answer (and in the person's Inbox) shows your app, the action and its input. Nothing happens until they approve.
  3. The workspace calls your action's endpoint, on your server, with who asked, where, and the input.
  4. Your server does it, and answers in a sentence. The agent reads your answer, and the approval card shows it.

An action that only reads runs at once, without asking.

Tabby's answer in a thread: a card for Team notes in Client work, Needs approval, with the action's description and its text input, and Approve and do it or Decline.
An action that changes something waits for a yes.

A space's workflows can use your actions as steps too, with the same rule: see Your actions in workflows.

People run them too

Your actions are commands as well: people run them themselves, with no agent between. In a conversation they type / and its name (/sign_guestbook), or choose + → Use an app, and fill in a form made from your input: a field for each, a list for an enum, a date picker for a date, a file picker for a file. From a messaging app connected to the workspace, they send it as text: /sign_guestbook "Lunch on Friday?" mood=happy (on Slack, ! instead of /), and /help lists what they can run.

  • No approval. They asked, so an action that changes something runs as soon as they press Run. It runs as them, in your tab in that space (from a DM or My Space, in a space of theirs with your tab), exactly as when an agent uses it; agent is null.
  • What it did is posted. Their message shows the command and its input, then your result, cards, files and view, for everyone in the conversation (and back in the messaging app, as words). A records action that reads shows its records as a table.
  • Its name is your action's name. When another app here has an action of the same name (or it's one of ours, like task), it's called by your app's name too: /hello_task.
  • Write inputs for people. Plain words go to your inputs in order, required ones first, so put the one people give most first. Each input's description is the hint under its field.

All of it, with how they're written as text and run from messaging apps: Commands.

Declaring an action

json
{
  "actions": {
    "sign_guestbook": {
      "description": "Leave a note in this space's guestbook.",
      "url": "/actions/sign-guestbook",
      "input": {
        "message": {
          "type": "string",
          "required": true,
          "description": "The note, in their words"
        },
        "mood": {
          "type": "string",
          "enum": ["happy", "curious", "busy"],
          "description": "How they feel"
        }
      }
    },
    "find_order": {
      "description": "Look up an order by its number.",
      "url": "/actions/find-order",
      "changes": false,
      "input": { "number": { "type": "string", "required": true } }
    }
  }
}
  • description is what agents (and admins) read to decide when to use it: say what it does, and for whom.

  • url is on your manifest's origin, like your tabs.

  • changes is true unless you say otherwise. Say false only for actions that change nothing; they run without asking.

  • input takes the same field types as collections, and is checked before your server is called.

  • An input can also be a file: see below.

See The manifest for every rule.

Actions without a server

An action can be done by the workspace itself, on one of your collections, instead of by your server: a records action. Give it records instead of url:

json
{
  "actions": {
    "create_ticket": {
      "description": "Open a ticket for a customer's question or complaint",
      "records": { "collection": "tickets", "op": "create" }
    },
    "list_tickets": {
      "description": "List the space's tickets, the latest changed first",
      "records": { "collection": "tickets", "op": "list" }
    }
  }
}
opWhat it doesIts inputAsks first
createMakes a recordThe collection's fields, as required as they areYes
updateChanges one (null clears a field that isn't required)id, and any of its fieldsYes
deleteDeletes oneidYes
getReads oneidNo
listLists up to 50, the latest changed first, with fields equal to those givenAny of its fields, except text onesNo

Its input comes from the collection (an input you give is ignored), and whether it changes something comes from its op. It's done as the person the agent works for, in the tab of yours where it's used, with the same rules as your page's own data requests: the collection's scope says where its records live. One that changes something answers in words, with the record's id ("Added to tickets (id …): subject: Refund"), which the approval card shows; one that reads answers with the record (or records) as JSON, which the agent reads.

A collection a records action uses can't have a field called id. Records actions are the only actions a tab without a server can have, so agents can use one too: our Help desk and Expenses are made this way.

Files as input

An action can take a file from the workspace: one attached to a message, or kept in a space's Files tab. Declare an input of type file, with the types it takes in accept (optional; image/* takes any image):

json
"post_picture": {
  "description": "Post a picture to the team's board.",
  "url": "/actions/post-picture",
  "input": {
    "picture": {
      "type": "file",
      "required": true,
      "accept": ["image/jpeg", "image/png"],
      "description": "The picture to post"
    }
  }
}

The agent gives the file's id, as it's told it (a file attached in the conversation, or one it found in Files). The workspace checks that the person it works for may read the file, that it's a type you take, and that it's at most 25 MB; the approval card names the file. Your server is sent the file instead of its id:

json
{
  "picture": {
    "file_id": "6720c4…",
    "name": "studio.png",
    "type": "image/png",
    "size": 482113,
    "url": "https://chat.acme.com/api/apps/files/eyJ3…"
  }
}

Download it from url while you answer: it works for 10 minutes, with no key, and only on the deployment that asked. downloadFile takes it only from the token's issuer, without following redirects.

ts
import { type ActionFile, type ActionRequest, downloadFile } from "@tabs-and-spaces/sdk/server";

const body = (await request.json()) as ActionRequest<{ picture: ActionFile }>;
const { bytes, type } = await downloadFile(body.input.picture, verified.issuer);

Older deployments. Deployments that take file inputs say so when they fetch your manifest: a tands-features header listing file-inputs. A deployment that doesn't refuses a manifest with a file input, so if your app serves many deployments, leave such inputs out when the header doesn't list it.

Where an action runs

An action runs in a space where your app has a tab: the agent's space, or one the person names. It knows which tab, so your server can use the data your app keeps there. An agent can't use your app in a space without one of your tabs; it's told where your tabs are.

Answering on your server

The workspace POSTs JSON to your endpoint, with a bearer token:

ts
import {
  type ActionRequest,
  dataClient,
  fetchKeys,
  verifyToken,
} from "@tabs-and-spaces/sdk/server";

const WORKSPACE = "https://chat.acme.com";
const keys = await fetchKeys(WORKSPACE);

export async function signGuestbook(request: Request) {
  const token = request.headers.get("authorization")?.replace(/^Bearer /, "") ?? "";
  const verified = await verifyToken(token, {
    keys,
    audience: "https://hello.example.com",
    issuer: WORKSPACE,
  });
  if (verified.action !== "sign_guestbook") return new Response(null, { status: 403 });

  const body = (await request.json()) as ActionRequest<{ message: string; mood?: string }>;
  await dataClient(body).collection("guestbook").create(body.input);
  return Response.json({ result: `Signed the ${verified.context.space.name} guestbook.` });
}

The request's body:

FieldWhat it is
actionThe action's name
inputIts input, checked against what you declared
contextWho asked, and where: the same context your tab is told
agentThe agent asking, { id, name }, for the person in context; null when they ran it
dataKey, dataUrlA key to your app's data for this request; see below

Answer 200 with { "result": "…" }: a sentence for the agent to read, or any JSON. Answer an error status with { "error": "…" } to say what went wrong; the agent and the approval card show it.

Showing what you found

An action can also answer with cards: what it found, drawn under the agent's answer in the app's own components, so the agent doesn't retype it and people read it at a glance. The agent still reads result, and is told the cards are shown. It may ask for them as data instead (to show only some), and they come to words where cards can't be drawn: messaging apps, search, notifications. For an action that changes something, its cards show on the approval, once the person has said yes and it's done.

ts
import type { ActionAnswer } from "@tabs-and-spaces/sdk/server";

const answer: ActionAnswer = {
  result: "2 open invoices: NW-2043 (€4,200, due Fri), NW-2039 (€1,180.50, overdue).",
  cards: [
    {
      type: "table",
      title: "Open invoices",
      columns: ["Client", "Invoice", "Due", "Amount"],
      rows: [
        ["Bramble & Co", "NW-2043", "Fri 31 Oct", 4200],
        ["Kestrel Foods", "NW-2039", "Overdue", 1180.5],
      ],
    },
  ],
};
return Response.json(answer);

Cards are the same types agents use: emails, events, metrics, tables, lists, links, notes, bars, charts and buttons. See Card types for every field. An answer shows at most 8 cards; cards that don't fit the rules are left out, and the agent reads result alone.

Answering with files

An action can make files: an image it drew, a PDF it rendered. List them in its answer, up to 4, each with a name and where to download it on your origin (a path is fine):

json
{
  "result": "Made the launch banner.",
  "files": [{ "name": "launch-banner.png", "url": "/made/7f3c2e.png" }]
}

The workspace downloads each at once (at most 25 MB, no redirects) and attaches it to the agent's answer, or, for an action that changes something, to its approval once it's done. People see it there and can save it to Files; the agent is told each file's id, to hand to another action that takes files as input. Keep a file at its address for a few minutes; it isn't fetched again. Images are recognised from their bytes; anything else keeps the type you give (or your server's Content-Type). A file that can't be fetched is left out, and the agent is told.

Your action's own view

Cards are drawn by the workspace. When what you found needs more than that, an action that changes nothing can bring its own page: a view, shown under the agent's answer, that people can read and use. Gmail's search shows its messages and opens a thread in place; Calendar's agenda moves a week back or on. Declare it in the manifest:

json
"find_invoices": {
  "description": "Find a client's invoices.",
  "url": "/actions/find-invoices",
  "changes": false,
  "input": { "client": { "type": "string", "required": true } },
  "view": { "url": "/views/invoices", "title": "Invoices" }
}

Your action answers as usual. result is what the agent reads, and data is for your view only: the agent never sees it, so it can carry more.

ts
const answer: ActionAnswer = {
  result: "2 open invoices for Bramble & Co, €5,380.50 in all.",
  data: { client: "Bramble & Co", invoices: [{ id: "NW-2043", amount: 4200, due: "2030-01-31" }] },
};

The workspace frames your page from your origin, in the same sandbox as a Custom tab, under the agent's words, at most three views to an answer. The SDK's connectView() does your page's side:

ts
import { connectView } from "@tabs-and-spaces/sdk";

const view = await connectView<{ client: string; invoices: Invoice[] }>({ name: "Invoices" });
draw(view.data.invoices ?? []);

Underneath, your page speaks MCP Apps (version 2026-01-26) over postMessage, so a view written for an MCP host works here too:

It's toldHow
Where it isui/initialize answers with hostContext: theme, locale, timeZone, and the workspace's colours as styles.variables
What your action was asked and answeredui/notifications/tool-input (arguments), then ui/notifications/tool-result: content (your result) and structuredContent (your data)
Changesui/notifications/host-context-changed when the reader switches theme
It mayHow
Call your other actionstools/call with an action's name and arguments: only one with changes: false, run in the same tab, as whoever is looking (not an agent), counted in your app's 30 calls a minute and on the audit trail
Open a linkui/open-link with an http(s) address: a new tab
Ask the agentui/message with text, sent as whoever is looking, once they've clicked in your view
Fit its contentui/notifications/size-changed with its height (up to 720 px)

Try it with tands dev: run the action there and its view opens under your tab, as it would under an agent's answer. The Hello example, at examples/hello-app, has one: its list_notes action shows the guestbook, filtered by mood from the view.

Your view is told nothing else: not who's looking (call an action for that), not the conversation. Actions that change something aren't callable from a view: the view can ask the agent instead, which asks the person first. Guests see your view but can't call your actions. Where views can't be shown (messaging apps, an agent's post from a recurring task), the agent's words are sent instead.

Your data, from your server

dataKey lets your server read and write your app's data for this request: the same place as the action (its space, its tab, the person who asked), for five minutes. dataClient() takes the request and gives you the same values() and collection() as your page:

ts
const data = dataClient(body);
const notes = await data.collection("guestbook").list({ limit: 10 });
await data.values("user").set("last_signed", new Date().toISOString());

Each call is checked again: if the person can no longer see that space, or your tab is gone, the key reaches nothing. Writes need the person to be in the space, as they do from your page. Refusals throw a DataError with a code.

Limits

Your server's answerWithin 10 seconds, and 64 KB
What the agent reads of it4,000 characters
Calls to your actions30 a minute per workspace
Actions per app20, with up to 20 inputs each

The workspace calls your endpoint like it fetches your manifest: HTTPS only, never a private address, no redirects.

Search every page: actions, the manifest, the SDK, tokens…