Docs menu

Host Your Own Workbench

Goal: Take a workbench that runs on your laptop and host it in your tenant, so your whole team can call it.

OpenX hosts a workbench by running the same fai run you run locally. So start locally, and host it once it does what you want.

1. Run it locally

fai run workbench.ts --mode MCP

Point your own AI tool at it and try the tools. fai workbenches describe workbench.ts lists the modes the workbench declares without starting it - a quick check that it builds.

2. Push the repo or publish the package

OpenX builds from a GitHub repo or a published JSR package. For a repo, commit the workbench and push it to a repo OpenX can clone. For JSR, publish the package.

3. Add it to a surface

Open the surface where the workbench belongs and drag a SurfaceWorkbench onto it. In the inspector's Source tab, pick the source - GitHub repo or JSR package - and set its fields. For a GitHub repo:

FieldValue
RepoThe repo URL, e.g. https://github.com/my-org/triage-workbench
RefA branch, tag or commit. A branch redeploys its latest commit each time; a tag or commit pins the build
EntryThe .ts file that exports the workbench, e.g. workbench.ts
DockerfileOptional. Left blank, OpenX uses its default: Deno plus fai run <Entry>

For a JSR package, set Package (@scope/name), Version (an exact version, which pins the build, or latest or a prerelease channel name, which are re-resolved on each deploy) and, if the workbench is not the package's root export, the Entry export. The optional Dockerfile is a path inside the package. A custom Dockerfile must run the workbench with fai run.

4. Name it

In the Hosting tab, set the APISlug: a short, lowercase name (a-z, 0-9, -), unique in your workspace. It's the workbench's address, so pick one your team will recognise - triage, release-checks.

5. Choose its modes

A new SurfaceWorkbench starts with an MCP mode. In the Modes tab, use Add mode to add each mode your workbench declares - API, Web, or a custom mode its package declares - and remove MCP if your workbench doesn't declare it. Each enabled mode runs in its own container.

6. Deploy

Deploy the workspace. OpenX clones the repo at your Ref (a JSR package needs no clone), builds an image, and starts one container per enabled mode. The image build itself usually takes under a minute; redeploying the same commit or version reuses the image. The first workbench you deploy in a workspace also waits while Azure makes the workspace's hosting environment, once: in our runs that took about ten minutes, and the workbench reads Pending until it's done. Later deploys in the same workspace skip it. The workbench's status in the Hosting tab reads Pending until a mode has an address, then Running. It has no other states: a deploy that fails shows in the Deploy window, not as a status in the Hosting tab.

If a deploy stops, the Deploy window says why, and the workbench keeps running what it ran before. A deploy waits ten minutes for its image: past that, it stops, changes nothing and says the image is still building. Deploy again a few minutes later and the finished image is reused.

What the build and the containers use:

  • Ref and Version. A branch redeploys its latest commit each time. A tag is looked up again on every deploy, so a tag that has moved builds a new image; only a full commit sha stays fixed. A GitHub source has no latest. For JSR, an exact version never changes, while latest (the newest stable version) and a channel such as integration (the newest prerelease on exactly that channel) are looked up again on every deploy. A package with only prereleases has no latest: pin a channel or an exact version, or the window says the JSR package "has no stable version". JSR has no private packages, so keep a private workbench on GitHub.
  • The Dockerfile. Left blank, OpenX uses its own: Deno plus fai run. To use yours, enter its path, relative to the repo root (GitHub) or the package root (JSR), such as Dockerfile or docker/Dockerfile; never paste its content (the window says the "Dockerfile field holds Dockerfile text, but the field is now a path"). It has to run the workbench with fai run, or the deploy is refused with "does not start the workbench with fai run". A path with no file behind it is refused with "There is no Dockerfile at" and the path. A mode can have its own Dockerfile path in the Modes tab, and it wins over the Source tab's.
  • The port. Each mode's web address points at the port your package declares for it with .Ports() (or the number you pin in the Modes tab), and OpenX sets the variable that port names, PORT unless you named another with .Ports(n, { Env: 'NAME' }), to that same number. A mode with .Ports(false) gets no web address. If you declare a port with no variable, the mode must listen on exactly that number: @fathym/fai 0.0.922-round-10 and later do; an older fai listens on its own default (4967 MCP, 4968 API, 4969 Web), so either declare that number, name a variable (.Ports(1880, { Env: 'PORT' })), or upgrade fai. A mode that listens elsewhere still deploys, but its address does not answer.
  • What the container receives. FATHYM_OX_WORKBENCH_ENTRY (your Entry, or the resolved jsr: specifier), FATHYM_OX_WORKBENCH_MODE, FATHYM_OX_WORKBENCH_MODE_CONFIG, and the port variable above. A JSR package's own Dockerfile is built with no files from the package, so it cannot COPY them: start the entry from the environment, for example CMD fai run $FATHYM_OX_WORKBENCH_ENTRY --mode=$FATHYM_OX_WORKBENCH_MODE, and it follows latest and channels.
  • Its login settings. A mode linked to App Identity (Who may call this mode is Identity) also gets FATHYM_OX_WORKBENCH_LOGINS: which login system each linked directory is and where it signs people in. Your workbench checks its own callers with them; OpenX makes no token for it, and its address answers 403 until the mode's app is registered and confirmed. How: Add Sign-in to Your Workbench.
  • Environment values. What you set in the Environment tab (the workbench's, or one mode's) becomes container secrets, except an empty value, which is set plain. The names OpenX sets itself (the ones listed above, and the WB_CONSUMED_* names for what the workbench consumes) win over a same-named key of yours.
  • Scale. The Hosting tab's Min replicas, Max replicas, CPU and memory apply to every mode. A mode with a web address can scale down to nothing when idle; set Min replicas to 1 to keep one running.

7. Connect your AI

Mark the port that speaks MCP in the Modes tab (Serve MCP from a Workbench). A mode keyed MCP with MCP at its root is then at:

https://openx.fathym.com/ox-api/w/<workspace id>/workbenches/<apiSlug>/MCP

<workspace id> is the ID shown in Workspace -> Settings; the API Manager's Workspace MCP group shows every endpoint's full address. With fAI installed, one command adds it to every coding agent on your machine:

fai mcp install https://openx.fathym.com/ox-api/w/<workspace id>/workbenches/triage/MCP --name triage --global --auth "<YOUR_TOKEN>"

The token is one your workbench accepts: at an Identity mode, a token a directory in your App Identity issued for the mode's app (Add Sign-in to Your Workbench). OpenX passes no key from APIs -> API Keys on to a workbench. The API and Web modes, and other clients: Reach a Hosted Workbench, with a page each for MCP, HTTP and a page.

Treat that token like any credential, and use a separate one for each AI client, so you can revoke one without touching the others.

Call the workspace's API from your workbench

OpenX hands a workbench no token of its own making to call your workspace's API with. Calling it as the workbench itself, or for the person signed in to it, comes with a later release; both kinds of call will be held to the workbench's Allowed rights, which a person sets in the workbench's inspector (its Rights tab; see Reach a Hosted Workbench).

Until then, a workbench calls the workspace's API as any other app does. With a key from APIs -> API Keys, kept as an Environment value, while the workspace's API identity, set in the API Manager, is Team (the default) or Hybrid. Under App Identity, team keys are turned away and a caller needs an access token from an App Identity you trust (API Manager).

If something's off

IssueDo
The deploy says the image is still buildingThe build outlasted the deploy's ten-minute wait and nothing was changed. Deploy again in a few minutes; the finished image is reused
The deploy says the image build failedCheck the workbench builds and runs locally: fai run <Entry>. For a GitHub repo, check it's public or Fathym has been given access to it: a repo the build can't clone fails it
The Dockerfile is refusedEnter a path, not the content; the file must exist at the deployed commit or version, and must run fai run
A mode doesn't answer after deployCheck the workbench declares it: fai run <Entry> --mode <key>
The APISlug is refusedIt's taken in this workspace; pick another
The first call is slowThe container is starting; later calls are quick
The workbench stays Pending after a deployDeploy again

Remove it

Delete the SurfaceWorkbench from its surface, save, and deploy: OpenX removes its containers. To stop a single mode, remove it in the Modes tab and deploy, and that mode's container goes.

Before you deploy, the removal tells you what goes with it. Every hosted workbench in a workspace runs in one hosting environment that OpenX made for it. When the deploy removes the last workbench in the workspace, it removes that empty hosting environment too, and the removal says so first: "No workbench is left in this workspace after this Deploy, so its empty hosting environment goes too, unless something else runs in it." The next workbench you deploy makes a fresh one.

  • Another workbench stays: the hosting environment stays for it, and the removal doesn't mention it.
  • Something else runs in it: OpenX checks Azure first, and keeps an environment that still holds any other app.
  • Your own cloud: the same rule. Only the environment OpenX made for this workspace's workbenches is removed.
  • The resource group stays: it's the workspace's own group, shared with its other records. It goes only when the workspace is archived.

If the environment can't be removed, the deploy says so and the removal stays staged, so the next deploy tries again.

Next steps

On fathym.com: Workbenches →

On this page