
By Jerel Velarde, Growth Team Staff Engineer at CopilotKit. Last updated December 3, 2026.
To bring a Mastra agent into OpenBot, deploy your Mastra server with Mastra's own auth turned on, then click New Bot in OpenBot, choose Mastra, and paste the server's address and key. OpenBot runs the agent through Mastra's own API, so you don't write an AG-UI endpoint, and your agent's instructions, tools and model stay as you wrote them.
OpenBot™ by CopilotKit (open.bot) is an open-source workspace where AI coworkers, called Bots, work in a sandboxed computer with a browser, a shell and files. A Mastra agent you connect becomes one of those Bots: you chat with it in OpenBot, and it can use OpenBot's tools and ask your other Bots for help. It isn't OpenBot by Synthetify Labs in Poland or the openbot.org robot kit.
When a Bot uses OpenBot's tools, by default it asks before sending, deleting, sharing, posting or paying in its browser or your connected apps, and OpenBot keeps a record. Your Mastra agent's own tools run in your server, outside those approvals.
Try OpenBot in your browser at my.open.bot, or download it at open.bot, free for personal use on a Mac or Windows PC.
We make OpenBot by CopilotKit. Checked against OpenBot 1.2.10 and Mastra 1.86 on December 3, 2026. Spot a mistake? Tell us on X at @0penBot.
OpenBot runs your agent through Mastra's own API, the one mastra dev and mastra build already serve, so you don't write an AG-UI endpoint. Three optional pieces from @ag-ui/mastra, the AG-UI package for Mastra, hand your agent the Bot's role and OpenBot's tool guidance. They're an input processor on the agent, a route that tells OpenBot the agent accepts them, and a middleware that marks OpenBot's runs as trusted. Step 1 includes all three.

This example is a Release Notes agent with one tool that reads the draft of the next release. Install Mastra and @ag-ui/mastra at the versions this guide was checked with:
npm install @mastra/core@1.86.0 @ag-ui/mastra@2.1.0 zod@4.6.7
npm install --save-dev mastra@1.40.2The tool, in src/mastra/tools/release-draft.ts:
import { createTool } from "@mastra/core/tools";
import { z } from "zod";
// Sample data: what has merged so far for the next release.
const draft = {
version: "0.4",
changes: [
{ area: "Sync", note: "Offline edits merge when you reconnect" },
{ area: "Sync", note: "Conflicts show both versions side by side" },
{ area: "API", note: "Breaking: /v1/notes now pages with a cursor" },
{ area: "API", note: "Breaking: tags are lowercase everywhere" },
{ area: "Editor", note: "Paste keeps headings and lists" },
],
};
export const releaseDraft = createTool({
id: "release-draft",
description: "Read the draft of the next release notes: every change merged so far.",
inputSchema: z.object({}),
execute: async () => draft,
});The agent, in src/mastra/agents/release-notes.ts:
import { Agent } from "@mastra/core/agent";
import { mastraRunGuidanceProcessor } from "@ag-ui/mastra/run-guidance";
import { releaseDraft } from "../tools/release-draft";
export const releaseNotes = new Agent({
id: "release-notes",
name: "Release Notes",
instructions:
"You keep the draft of the next release notes. Answer from the draft, briefly, and lead with breaking changes.",
model: "openai/gpt-5.5",
tools: { releaseDraft },
// Hands the model the Bot's role and tool guidance that OpenBot sends with each run.
inputProcessors: [mastraRunGuidanceProcessor],
});And the server, in src/mastra/index.ts:
import { timingSafeEqual } from "node:crypto";
import { Mastra } from "@mastra/core/mastra";
import { MastraAuthProvider } from "@mastra/core/server";
import {
registerMastraRunGuidanceCapabilities,
withMastraRunGuidanceAuthority,
} from "@ag-ui/mastra/run-guidance";
import { releaseNotes } from "./agents/release-notes";
const key = process.env.AGENT_API_KEY;
if (!key) throw new Error("Set AGENT_API_KEY");
const expected = Buffer.from(key);
type Caller = { id: string };
// Mastra's own auth: requests to the agent need the key, which OpenBot sends as the Bot's Key.
class AgentKey extends MastraAuthProvider<Caller> {
async authenticateToken(token: string): Promise<Caller | null> {
const offered = Buffer.from(token.replace(/^Bearer\s+/i, "").trim());
const match = offered.length === expected.length && timingSafeEqual(offered, expected);
return match ? { id: "openbot" } : null;
}
async authorizeUser(caller: Caller): Promise<boolean> {
return caller.id === "openbot";
}
}
export const mastra = new Mastra({
agents: { releaseNotes },
server: {
host: process.env.MASTRA_HOST ?? "0.0.0.0",
auth: new AgentKey(),
// Tells OpenBot this agent takes its role and tool guidance. Behind the same key.
apiRoutes: [registerMastraRunGuidanceCapabilities("release-notes")],
middleware: [
// Runs before Mastra's key check, which still refuses any request without the key,
// so every run that reaches the agent is OpenBot's.
async (c, next) => {
const body =
c.req.method === "POST"
? await c.req.raw.clone().json().catch(() => undefined)
: undefined;
return withMastraRunGuidanceAuthority(true, next, body?.requestContext);
},
],
},
});What each piece does:
auth: new AgentKey() turns on Mastra's own auth. Mastra now refuses requests to the agent, its memory and the route you add unless they carry the key. Mastra's built-in SimpleAuth is marked for development and testing, so this guide checks the key with MastraAuthProvider.@ag-ui/mastra lines are optional.mastraRunGuidanceProcessor and registerMastraRunGuidanceCapabilities let the agent take the Bot's role and OpenBot's tool guidance. withMastraRunGuidanceAuthority marks each run as trusted, so the role and tool guidance reach the model as system instructions. The middleware runs before Mastra's key check, but that check still refuses any request without the key, so only OpenBot's runs are trusted. Without these lines the agent still answers in OpenBot, but its model doesn't get the Bot's role.Set the package's scripts to Mastra's production build, in package.json:
{
"type": "module",
"scripts": {
"build": "mastra build",
"start": "node .mastra/output/index.mjs"
}
}Where the server runs, set:
AGENT_API_KEY: a long random key, for example from openssl rand -hex 32. OpenBot will send it.OPENAI_API_KEY: the agent's model calls OpenAI.Mastra listens on the PORT your host gives it, or on 4111. We deployed ours on Railway: railway up from the project folder, the two keys as service variables, and railway domain for a public HTTPS address. Any host that runs Node 22.13 or later and npm start works.
Check the key before you open OpenBot:
curl -i https://your-mastra-server.example.com/api/agents
curl -H "Authorization: Bearer $AGENT_API_KEY" https://your-mastra-server.example.com/api/agentsThe first answers 401. The second lists one agent, release-notes.
Mastra keeps its own storage in memory unless you add a storage adapter, and it says so when it starts. This agent stores nothing there, but add an adapter, such as Mastra's Postgres one, before you give an agent memory or workflows.
1. Click New Bot and give it a name and instructions. We called ours "Release Notes", with the instructions "Keeps the draft of the next release notes."

2. At the bottom of the panel, click Bring your own agent, then choose Mastra.
3. Under Agent address, paste your server's address. Under Key, type Bearer, a space and your AGENT_API_KEY.

4. Click Create Bot. OpenBot asks the server which agents it runs, with the key, then makes the Bot. The Bot's page says Powered by Mastra.

What OpenBot does when you click Create Bot:

To change the key later, open the Bot's Setup, then Key under Connection, to replace or remove it. You can skip Key for tools: it's only for an agent that calls OpenBot's tools itself.

Open the Bot and ask it something, like "What's going into 0.4 so far?" The Mastra agent calls its own tool and answers in the chat under the Bot's name.

A Mastra Bot gets the Bot's role, dozens of OpenBot's tools on every run, and the other Bots you let it ask. We checked each in OpenBot Cloud 1.2.10 with the Release Notes agent:
OpenBot person. It reaches your server but not the model, so read it from the run's request context if you need it.

mastra dev opens, chats with the agent without OpenBot (Mastra docs).agents.yaml with remote_agent_id (configuration docs).Give your Mastra server Mastra's own auth, deploy it, and add it in OpenBot as a Mastra Bot with its address and Bearer key.
More from us: All OpenBot guides · The best open-source AI agent workspaces · What is a Bot? · Which OpenBot? · OpenBot on GitHub · OpenBot's setup notes for Mastra
Page changes: December 3, 2026, for OpenBot 1.2.10, hosted with Mastra's own auth. November 30, 2026, for OpenBot 1.2.3. November 25, 2026, first version.
No. OpenBot runs a Mastra agent through Mastra's own API, so you paste the server's address and key instead of writing an AG-UI endpoint. To give the agent the Bot's role, add the three @ag-ui/mastra pieces shown in step 1: the input processor, the route and the middleware.
Bearer, a space and the key your Mastra server checks. OpenBot sends it as an Authorization header with every request and stores it encrypted. If the server refuses it, OpenBot doesn't make the Bot.
No. OpenBot in the browser needs an address it can reach over the internet, so deploy the server first. OpenBot Desktop can: run npx mastra dev with the same two keys, then give New Bot http://localhost:4111 and your key. We last checked that on OpenBot 1.2.3.
Yes, when its model calls them. OpenBot offers its tools with every run, next to your agent's own: 97 to 106 of them in our runs on OpenBot 1.2.10. There, the Mastra agent drew a chart, showed an approval card and opened a page in the Bot's browser when we asked. Your agent's own tools run in your Mastra server, outside OpenBot's approvals.
OpenBot 1.2.10, released December 3, 2026, with Mastra 1.86 (@mastra/core 1.86.0 and the mastra CLI 1.40.2) and @ag-ui/mastra 2.1.0. Checked December 3, 2026.



Subscribe to our blog and get updates on CopilotKit in your inbox.