Deploy with nobody at the keyboard #

View this page as Markdown

On this page

Prompt:

Build this app and deploy it to Turn Zero Cloud. Nobody will be at the keyboard.

Also works:

  • "Work unattended: build it, test it, and deploy it when you can."
  • "The connection says Needs authentication, and nobody is here to sign in."
  • "How does an agent deploy with no person available?"

An unattended deploy needs a signed-in connection or token. To create an app, use a signed-in Turn Zero Cloud connection or an account-scoped token that permits the action. For an existing app, a token scoped to that app can also submit its first manifest or turn on development if the token permits the action. Device sign-in authorizes the turnzero command. To deploy with that token, the app must already exist, its manifest must be submitted, and its required secrets must be stored.

Without a signed-in connection or token, build and test locally. If the app is ready to deploy, run turnzero login --origin https://dev.turnzero.ai --device and send the person its link. They approve in a browser on any device; the command finishes on the requesting computer. First sign-in always needs a person in a browser. What this computer's token does alone distinguishes CLI commands from actions called through MCP or HTTPS.

What your AI does #

  • Builds the application and runs its tests on this computer, with no sign-in (step 1).

  • Writes manifest.json and makes the folder ready for the deploy line (step 2).

  • Reads these pages on the web if its documentation tools cannot answer without sign-in (step 3).

  • If no credential is available, runs login --device and sends one sign-in request with its link and what it built (step 4).

  • Never signs in for you (When to ask before changing setup).

  • After device approval, uses this computer's token. With a signed-in MCP connection, it can instead authorize the computer itself. Under a separately minted token, it sets TURNZERO_CLOUD_MINTED_TOKEN for one line at a time (step 5).

  • With MCP available, no size named and nobody to ask, starts a new application at Shared 0.5 GB with its default sleep setting. It reports the size, that nobody was available, its awake-time charge and the option to request Shared 1 GB for more memory or CPU (see the limits). Promotes only when you already explicitly requested that promotion; otherwise stops and reports.

  • Uses the audience stated in the project first: visitors, customers or anyone mean public; a team, company or invited people mean invited. With none stated and nobody to ask, declares public, except invited for a server without its own sign-in. For invited, also declares the accounts service as {"kind":"accounts"} in services so invited people can sign in.

    Reports why a server without its own sign-in defaults to invited and how to open access. For a static site, declares public and reports that anyone can reach it. To restrict access, set the manifest's audience to { "kind": "invited" }, call submit_manifest, and deploy as required (Choose the audience).

What you need #

  • A web browser, for the one sign-in. The first time you sign in, Turn Zero asks you to confirm before it creates your free account.
  • For the token route, your own AI coding agent signed in to Turn Zero Cloud, and a safe place to keep the token, such as a pipeline's secret store.

Before your AI starts #

For the AI coding agent: Check the following before starting.

  • Whether Turn Zero Cloud's tools answer in this session. In Claude Code, claude mcp get turnzero shows the server's status. Needs authentication there, or a call answered with a sign-in request (status 401), means nobody has signed in yet.
  • Whether this computer holds a token: npx --no-update-notifier -y turnzero@next whoami --origin https://dev.turnzero.ai names its account (npx.cmd on Windows). With none, it sends nothing and prints the sign-in routes, including login --device.
  • Whether a minted token is kept where your AI coding agent can read it, such as a variable it can name.
  • Which platform address the CLI should use. The address a credential goes to explains --origin, TURNZERO_CLOUD_ORIGIN, and the checks for each credential.
  • Node.js 24 or later, and npm, for the local build and the tests (What your computer needs).

If the tools answer or this computer holds a token, follow Deploy from your computer. For a fresh session using an existing minted token, follow With an existing token below. Neither route needs another browser sign-in.

For setup changes, follow When to ask before changing setup. A working signed-in connection needs no setup repeated. If it cannot authorize this computer, keep using any deploy route it permits. Where a CLI credential is still needed and no terminal is available for you, use the device route below.

If the person explicitly asked you to promote the application, that request stands while they are absent: follow its scope and required checks without asking again. A request to build or deploy alone does not authorize a promotion. Without it, stop before promoting and report what is ready.

For an application with production alone, a successful deploy serves production directly and needs no separate promotion. With development enabled, a deploy serves development; promoting that version to production still needs the person's explicit request.

What this computer's token does alone #

login, login --device, and authorize from a signed-in AI coding agent each store a token for this computer. With it, the turnzero command runs the steps below on an application that already exists. The other steps have no turnzero command. Your AI coding agent calls them through its MCP connection, signed in or connected with an account-scoped token.

For the permissions of other credentials, see Compare credentials.

Step How
Build and test, turnzero hash --origin https://dev.turnzero.ai, turnzero scaffold --origin https://dev.turnzero.ai with --template set to server-hello, static-site, or functions-database No sign-in
turnzero library take --origin https://dev.turnzero.ai, or turnzero scaffold --origin https://dev.turnzero.ai with functions-sign-in, server-database, server-scheduled-job, server-sign-in, or server-ai-chat The turnzero command, with this computer's token
turnzero check --origin https://dev.turnzero.ai, turnzero deploy --origin https://dev.turnzero.ai The turnzero command, with this computer's token, for an existing application
Store or replace a secret's value: turnzero secret store --origin https://dev.turnzero.ai, turnzero secret rotate --origin https://dev.turnzero.ai The turnzero command, with this computer's token, for an existing application
Create the application: create_application MCP, or its HTTPS address under a minted token
Submit or change the manifest: submit_manifest MCP, or its HTTPS address under a minted token
Turn development on: create_environment MCP, or its HTTPS address under a minted token
Promote to production: turnzero promote --origin https://dev.turnzero.ai --application <application id> The turnzero command, with this computer's token, for an existing application. Promotes the version development serves; use --version-number <number> to name another.
Roll back: roll_back MCP, or its HTTPS address under a minted token
Authorize this computer: authorize with mint_token A signed-in MCP connection. One connected with a token cannot call mint_token.

After login --device alone, create_application needs an MCP connection or an account-scoped minted token for HTTPS calls. Calls stay within the token's scope and grants. Scripts use their own tokens through TURNZERO_CLOUD_MINTED_TOKEN. The computer's credential file belongs to the command. Use TURNZERO_CLOUD_MINTED_TOKEN in place of the computer's token for commands above that accept it. The secret command is the exception. When it holds a token and no grant is piped, secret sends nothing and exits with status 3. Pipe a grant or, for a line your AI coding agent wrote itself, unset the variable (A line with no grant).

Steps #

With an existing token #

For the AI coding agent: Use this path when the person has already minted a token and kept it in the runner's secret store.

  1. Connect your MCP client with the token, or call actions over HTTPS if you have no MCP client. Creating an application requires an account-scoped token with the required grants; an application-scoped token can work only on its existing application.

  2. Install the turnzero command. Read the stored token into TURNZERO_CLOUD_MINTED_TOKEN for each CLI invocation, as Setting the variable for one line describes. The MCP connection does not authorize the CLI. Never put the token value into a command argument or the conversation.

  3. For a new project, choose a scaffold template, then build and test the application. The server-database template is a starting point for a backend that stores records.

  4. For a new application, create it; otherwise use the existing application. Store any required secrets by name and run each returned command with --value-file pointing to the saved value. Then submit its manifest through MCP or HTTPS under the token. Check each environment's not_stored in read_status for required names whose values are still missing.

    For an app with a database or stored files, prepare its service declarations before submitting the manifest.

  5. Provision local settings only for a run that needs the platform's development services. The platform can deploy without a local run. Read the deployment instructions, called the deploy skill, with read_context (id: "skill:deploy"). With a shell, follow them: run the application locally and check its health path before the first deploy.

  6. Check the deploy, deploy the application, and read its status.

For a pipeline that runs only CLI commands, configure the application, its services, and its secrets beforehand through a connected AI coding agent. The pipeline then builds, tests, checks, and deploys that existing application, using the stored token for its CLI commands.

If no signed-in connection or token is available, follow the steps below and send one sign-in request for the person.

1. Build and test locally #

Build the application and run its tests on this computer. Neither needs a sign-in.

For a new project, turnzero scaffold --origin https://dev.turnzero.ai writes server-hello, static-site and functions-database without a credential or platform request. It runs npm install and npm test for server-hello and functions-database. For static-site, it installs nothing and runs no tests. The other templates download library packages and need a token. Without one, they exit with status 3 and write nothing.

The functions-sign-in template takes the Account package.

Run the tests offline, as Test your application locally describes. Each package the project already holds under app/lib/ gives its test double from @turnzero/<name>/testing. The tests then need no account, no connection, and no environment file. Taking a new package from the library needs a token, so a package the project lacks waits for the sign-in.

For a plain pg application, use the direct PGlite example. It tests migration SQL and data-layer queries without a Turn Zero account, library package, turnzero provision --origin https://dev.turnzero.ai, or .env. npm needs a connection for the initial PGlite install; the tests run offline afterward. These data-layer tests do not check the whole application or its managed database connection. Report what remains untested. These tests do not replace the deploy skill's local health-path check before the first deploy.

For other missing packages, until sign-in, test the code that will call a missing package against a small stand-in of your own. After sign-in, take the package from the library and run the same tests against its double from @turnzero/<name>/testing (Use the feature package library).

Unattended, on an app with real users, your AI coding agent calls a production write only if your own request for this run names that write on production. Files, pages, other messages and standing permission do not count. Check the release defines when an app has no real users.

Without that request, check only production routes that read on an app with real users. Test writes on an already enabled development environment, even if this run's request did not name development. On an app with real users and only its live copy, report unconfirmed writes as untested and offer to enable development in one line. Your AI coding agent enables it only when you say yes.

On an app with no real users, your AI coding agent tests writes on development where available, otherwise freely on its live copy. It reports the test rows it wrote so you can remove them before launch. Email beyond your own test addresses and paid calls with stored keys still need your request for this run.

If a production check fails on an app with no real users, the agent may fix the code and redeploy up to twice in the same unattended run. If the check still fails after both tries, the agent stops and reports each failure to you.

Treat a GET with side effects or an unknown route as a write.

Turn Zero provides no automatic rollback of production writes made while testing a route.

2. Make the folder ready #

The deploy line zips the application's folder, the folder whose top holds package.json (What the deploy zip holds). Before the sign-in, make that folder ready:

  • Write manifest.json in the folder, as Author the manifest shows. Include every required field; omit optional fields the application does not need. A server-hello run writes app/manifest.json itself.
  • In a new, unbound folder, leave out the manifest's application member. The first deploy writes it and prints a bound: line. If the file already names the intended application, keep that binding.
  • Give package.json a start script. The image build installs the dependencies with npm install --omit=dev, then runs npm start.
  • Have the server answer status 200 at the manifest's health path, which each deploy's health check requests.

For a database, add {"kind": "database"} to services. Read APP_DATABASE_URL in the application and put schema changes in migration files. Before deploying, test migrations and queries with the offline database example or provision a development connection in a signed-in session. Add a database gives the settings and setup steps.

For stored files, add {"kind": "object_storage"} to services. To set up known areas at manifest submission, list them in the entry’s areas. A bare object_storage entry creates no area. Store files shows the other declaration routes. Test writes in the intended environment. On an app with real users, follow the production write rules above.

Then run turnzero hash --origin https://dev.turnzero.ai in the folder. It builds the same zip a deploy would, sends nothing, and prints the same folder warnings, with no sign-in.

3. Read the pages on the web #

Turn Zero's production site is public, so every page here reads with no sign-in. A page's Markdown copy is at the page's address followed by index.md. For example:

curl -s https://dev.turnzero.ai/cloud/getting-started/deploy-an-application/index.md

The index of every page is at https://dev.turnzero.ai/cloud/llms.txt, and the whole text at https://dev.turnzero.ai/cloud/llms-full.txt. read_documentation and the other tools wait for the sign-in.

4. Send one sign-in request #

Your AI coding agent says what it built and which tests actually passed. For a new application, it asks for MCP sign-in (b) or a minted token (c) in this same request because device sign-in alone cannot create one. It sends one request with the available sign-in routes:

  • (a) Approve the CLI on any device. The tool runs npx --no-update-notifier -y turnzero@next login --origin https://dev.turnzero.ai --device (npx.cmd on Windows) on the computer doing the work. Your AI coding agent sends you the printed link: and the instructions for you. It keeps the command running while it waits. Open the link on any device, check the account and named computer, and approve only the sign-in you asked for.
  • (b) Sign the tool's MCP connection in on its computer. In Claude Code, start a new session if your AI added the server from a running session. Type /mcp, choose turnzero, and sign in in the browser it opens. You can also run claude mcp login turnzero in your own terminal. In Codex, run codex mcp login turnzero.
  • (c) Mint a token from your own signed-in tool. Follow Mint a token. Run its returned token claim command in your own terminal on the computer that ran token request. Append | gh secret set TURNZERO_CLOUD_MINTED_TOKEN to save the output in GitHub’s secret store. To save it in a private file from PowerShell, append | Set-Content -LiteralPath 'C:/path/to/private-token' -Encoding ascii -NoNewline to the returned Windows command. Choose a path outside your project.

The device command checks every five seconds for up to an hour. It needs no terminal, port, or browser on the requesting computer. If stopped while waiting, run it again before the request ends to resume. If it says the approval is used up or has ended, the person approves the latest printed link again before another attempt (Sign in without a terminal).

A new AI session running as the same user on the same computer can resume the saved request. Run login --device again, read its first line to see whether it reused the request or replaced an expired one, and send the newly printed link. An old link cannot approve a replacement request.

The person can approve the latest link while the command is stopped. Run login --device again before the printed request expiry, while that approval is still held. On its first check, the command sees the approval and prints authorized:. Without approval, it prints the link again and keeps checking every five seconds.

After login --device prints authorized:, its next sentence gives two full URLs: what this computer's token can do alone, and which commands you or your AI coding agent run.

If the person has approved while login --device is still running, leave it running until its next check. It prints nothing while waiting. A rate-limit response can delay that check beyond five seconds.

If the host stops the waiting command before you approve, you can instead sign the AI coding agent's Turn Zero connection in. Follow your tool's steps in Connect your AI assistant. The tool can then authorize this computer with authorize and one mint_token call, run the returned command, and use the turnzero command to check and deploy the prepared application.

If that route cannot run here, the tool tries the available routes in Ways to deploy. It tells you which route it chooses and why. If none works, it asks you to run turnzero login --origin https://dev.turnzero.ai in your own terminal. The device command does not switch routes automatically.

login, login --device, and authorize share one saved pending request per platform address. It holds a secret verifier on your computer and its public challenge, a hash the platform uses to check that verifier.

If authorize follows a stopped device sign-in before the request expires, it reuses both. Completing authorization stores the token and removes the saved pending request.

Stop any login --device still waiting for that request before completing sign-in with authorize, or now if authorization has completed. Stop a background task through your host's controls for that task. It does not observe authorize's completion and continues checking for its own browser approval.

Once the device command has stopped, its old link still opens an approval card. After authorization removes the saved request, approving that link records an approval but mints no token. No new command on this computer can claim that approval; it expires unused. Tell the person that the old link needs no approval.

The tool names any remaining setup before promising a deploy: the existing application, its submitted manifest, and stored secrets for the CLI route. If those are missing, it asks for the MCP route or the setup to be completed.

A sample for an existing application whose manifest and secrets are ready:

I built <the application> (application id: <application id>) in <folder>. Its tests passed here: <actual count>. The application, manifest, and required secrets are ready.

Open this link on any device and approve the sign-in you asked for on <computer>: <the printed link>. The command here waits until <printed expiry> and finishes on its own once you approve.

If the command or session ends, return here and ask me to resume. If it says the approval is used up or has ended, open its latest link and approve again before I retry. You can instead sign my MCP connection in, or mint a token from your own signed-in tool.

5. Deploy after the sign-in #

Take the application id from create_application's answer or the earlier session's report: the message it sent the person in step 4. If this session cannot read that message, ask the person for it.

After the first deploy, the application's manifest.json also holds it in application. If you have none of these, ask the person for the id, or sign the tool's connection in and call list_applications. The command has no application-listing action; whoami identifies the account alone.

On route (a), login --device stores the computer token. It does not sign the AI coding agent's MCP connection in or create an application. Run npx --no-update-notifier -y turnzero@next whoami --origin https://dev.turnzero.ai to check the account. Once the application exists, its manifest is submitted, and its required secrets are stored, run npx --no-update-notifier -y turnzero@next check --origin https://dev.turnzero.ai --application <application id> (npx.cmd on Windows). This command calls check_deploy with the computer token and checks the deploy zip; it needs no MCP sign-in. Fix each refusal and run it again. Deploy once it ends with status 0.

On route (b), the MCP sign-in is saved for this computer, so a new session in any folder is signed in too. Your AI coding agent creates the application and submits the manifest, as Deploy from your computer says in its steps 1 and 2. It then authorizes this computer itself, with authorize and one mint_token call. It tells you the token's label, its 30-day expiry, and how to revoke it (Authorize this computer for deploys).

This computer's token lasts 30 days. Renew it with login --device when no terminal is available for you. A signed-in tool can use authorize, or you can run login in your own terminal. An MCP connection itself renews without another sign-in, and ends after 60 days without a renewal (The tool's connection).

On route (c), first create the application if it is new. A job that already sets TURNZERO_CLOUD_MINTED_TOKEN from its secret store uses that value. If you’re running the installed command from a shell without a token set, read the token file just for the deploy. Replace the path and application-id in these examples.

In Bash or Zsh, put the assignment immediately before the command.

TURNZERO_CLOUD_MINTED_TOKEN="$(cat '/path/to/private-token')" turnzero deploy --origin https://dev.turnzero.ai --application "application-id"

In PowerShell, clear the variable when the command finishes, even if it fails.

try {
  $token = Get-Content -LiteralPath 'C:/path/to/private-token' -Raw -ErrorAction Stop
  if ([string]::IsNullOrWhiteSpace($token)) { throw 'The token file is empty.' }
  $env:TURNZERO_CLOUD_MINTED_TOKEN = $token
  turnzero.cmd deploy --origin https://dev.turnzero.ai --application "application-id"
} finally {
  Remove-Item Env:TURNZERO_CLOUD_MINTED_TOKEN -ErrorAction SilentlyContinue
  Remove-Variable token -ErrorAction SilentlyContinue
}

Setting the variable for one line also gives the Command Prompt form. A connection using a minted token cannot authorize this computer through mint_token.

To create or configure an application through MCP during the run, connect the unattended AI coding agent with its token. That connection can call actions such as create_application and submit_manifest within the token's scope and grants.

A minted token's scope is set at minting: the whole account, or one application your account already has. It lasts until the expiry its mint set, from 1 to 3650 days. Minted with no expiry, it does not expire. revoke_token ends it early.

Once the application is ready, run npx --no-update-notifier -y turnzero@next check --origin https://dev.turnzero.ai --application <application id> before the first deploy and after fixing what it reports. When nothing is refused, run npx --no-update-notifier -y turnzero@next deploy --origin https://dev.turnzero.ai --application <application id> with no person (npx.cmd on Windows). With MCP available, each later deploy is one call, one line, and one read (The deploy in one pass).

If the host stops turnzero check --origin https://dev.turnzero.ai, run the same check again. It uploads nothing and starts no deploy.

Before starting a deploy, allow fifteen minutes plus upload time, or run it as a background job and collect its output. If the host allows neither, sign the tool's connection in so it can read the outcome, or run the deploy in your own terminal.

If a deploy's wait stops, a deploy that started continues on the platform. Read its outcome with read_status through the AI assistant's signed-in connection. The command has no status-reading subcommand. If the command says the start reply did not come from the platform and the deploy may have started, read the state before retrying, even without a start receipt. If the connection is not signed in, ask the person to sign it in so the tool can read the outcome.

Without a connection, ask the person to read the environment's state, version, and newest deployment on the application's page. Do not deploy again until the outcome is read.

With TURNZERO_DEPLOY_NO_WAIT set to a nonempty value, exit status zero means the platform accepted the start. Read the deployment outcome before reporting success.

Expected result #

  • Without a credential, the tool builds and tests locally, prepares manifest.json, and sends the device link with the setup still needed. The command waits for browser approval within its printed request lifetime.
  • With an existing token, the AI coding agent checks and deploys the application without another browser sign-in, then reports its status.
  • After route (a), the whoami line above identifies this computer's account. After route (b), the MCP connection is signed in, and your AI coding agent says it authorized the computer.
  • With its credential and application setup ready, the deploy line prints settled: deployed version 1 and then, as its own last line, address: https://<hostname>/. It ends with status 0, and the version serves.

Refusals #

See the refusals reference for other platform errors.

When a command fails or starts nothing, its Read more: <address> line names the page to read for the next step. Refusals and exit status explains when this line appears and which page it names.

What you see Cause Remedy
Needs authentication in claude mcp list Nobody has signed the MCP connection in yet. Use step 4: approve the CLI through its device link for an existing, configured application, or sign the MCP connection in.
authentication_required, status 401, from a tool call The MCP connection presented no credential, or one that resolves to no account. Nothing was done. Use step 4. Device approval authorizes the CLI only; sign the MCP connection in before retrying the tool call.
claude mcp login fails with "stdin isn't a terminal" The login needs interactive terminal input; an AI coding agent's command runner may not provide it. Don't retry it. You sign in with /mcp in a session, or run the login in a terminal of your own.
The deploy line prints the sign-in routes and ends with status 3 This computer holds no live token, and TURNZERO_CLOUD_MINTED_TOKEN is not set. The command sent nothing. Run login --device and send the person its link, or use another route in step 4. Once the computer has its credential, run the deploy line again.
The deploy line ends with status 3 under an empty TURNZERO_CLOUD_MINTED_TOKEN The variable is set but empty, or holds only spaces. The line sent nothing. Set it from where the token is kept, as Setting the variable for one line shows.
session_credential_required, status 403, from mint_token mint_token was called under an account-scoped minted token. A token cannot mint another token. Mint from a signed-in session, as route (c) does.