Skip to content
Documentation
On this page

App deployment

App deployment from the built-in skills in Executor 2.0.0-beta.79.

This page covers Local source with the CLI from the built-in skills shipped with Executor 2.0.0-beta.79. It contains app-authoring/deploy.md.

Next: App deployment · Local source with the CLI (continued)

Local source with the CLI

Use this path when you can run shell commands and executor apps --help works. If the command is missing, or it has no framework subcommand, install the current release. An older CLI can also fail against a newer host with NotFound or UnexpectedResponse. Install it with npm, or without Node on macOS or Linux with the install script:

npm i -g executor@beta --include=optional
curl -fsSL https://executor.sh/docs/install.sh | sh

The beta tag is required. The latest tag installs the previous Executor, which has no apps command. Installing globally changes the user’s machine, so ask first if that has not been approved.

Keep one directory per app with index.ts and package.json at its root. The CLI sends the whole directory, skipping .git, node_modules and .DS_Store. Keep scratch files out of it; files missing from the directory are deleted from the app. --files also accepts a JSON file holding an array of { "path", "content" } objects.

Code, every file outside ui/public/, is UTF-8 text: at most 4,096 files and 16 MiB of file contents, on every host. Each of the app’s own JavaScript or TypeScript files is at most 2,000,000 bytes (2 MB). JSON files are outside this limit, so keep a large document such as an OpenAPI description in a .json file. The host checks this limit while it builds, not the CLI before uploading: a build that reaches a larger file of the app’s own fails with VersionBuildFailed at the source stage, naming the file, its size and the limit; no app or version is created. Files inside npm packages the app imports are not limited and are still compiled. On self-host and the local server a build compiles on the thread that runs apps, so a large package file delays every app call, and any other request served from that thread, while it compiles: a 3,000,000-byte module of dense code took about 1.2 seconds in our tests. Files under ui/public/ are served as they are and may be binary, such as images, fonts, audio, WebAssembly or a prebuilt bundle: at most 10,000 files, each at most 32 MB and 1 GB in total. Builds never load them; each deploy copies them to the host’s own storage. The CLI checks the other limits before it uploads anything. A source over them fails with SourceRejected, which states the count or size and names the largest files; a binary file outside ui/public/ fails the same way and is named. The host rejects a larger source with SourceError and HTTP 413.

A directory of at most 16 MiB in total is sent as files, with binary files as base64. A larger one is pushed with Git: executor apps create, commit and deploy --files do this themselves, send only the files the app does not already hold, and split large uploads into several pushes. Deploy a directory in one step with executor apps deploy --app <app-id> --files ./app.

Reading source lists a ui/public/ file that is not UTF-8 text, or does not fit beside the rest of the source, as { "path", "object", "size" } without its bytes. Send that entry back unchanged in a commit to keep the file. Through appManagement.commit, send a small binary file as { "path", "content": "<base64>", "encoding": "base64" }. executor apps source --app <app-id> --out ./copy writes every file, binary files included, and a Git clone has them all.

Read these docs with executor skills --app executor --name app-authoring --file deploy.md.

Commands use --host, then EXECUTOR_HOST, then the host the CLI signed in to last. Without any of them, they use the local background Executor, starting it if it is not running, and need no API key. A set EXECUTOR_API_KEY is sent in place of the background Executor’s own credential, so it must be that server’s current key. A --host that names another local server, such as http://127.0.0.1:4400, needs that server’s API key in EXECUTOR_API_KEY; if the variable is unset, ask the user to set it, and do not search files for it. For hosted Executor, run executor apps login once; add --host <origin> for a self-hosted Executor. It prints a link and a code and waits; ask the user to open the link and approve the code. Later commands use that host without --host. --organization defaults to the organization you signed in to.

A command that fails exits with status 1. Its standard error states the message, the error code, the HTTP status when the host answered, and the host’s recovery: Next step for the user and For agents for you. When standard output is not a terminal, the command also prints the same failure there as JSON, so scripts can read it:

{
  "error": {
    "code": "VersionBuildFailed",
    "status": 422,
    "message": "App build failed at the declaration stage: ...",
    "details": {
      "stage": "declaration",
      "location": { "file": "index.ts", "line": 3, "column": 7 }
    }
  }
}

recovery holds action and instructions when the error declares them; follow the instructions. details holds the error’s other fields. When a newer CLI release exists, update says so with the install command, and standard error ends with the same line; update the CLI before retrying.

A new app is a directory with index.ts and a package.json that pins the exact apps version the host runs. executor apps framework prints that version. Create the app from both files, then deploy its first commit. mkdir and index.ts run first. If executor apps framework fails, the && chain stops before it writes package.json or creates the app; install the current release as above and run the chain again:

mkdir hello
cat > hello/index.ts <<'EOF'
import { defineApp, object, query, router } from "apps";

export default defineApp({}, async () => ({
  tools: router({
    hello: query({ description: "Say hello", input: object({}) }, async () => ({ message: "Hello" })),
  }),
}));
EOF
version="$(executor apps framework | jq -er .version)" &&
  printf '{"name":"hello","private":true,"type":"module","dependencies":{"apps":"%s"}}\n' \
    "$version" > hello/package.json &&
  executor apps create --name "Hello" --files ./hello    # prints the app, including its id
executor apps source --app <app-id> | jq -r .revision.commit
executor apps deploy --app <app-id> --commit <first-commit>

hello takes no input. A handler that does takes the context first and the parsed input second, async (_ctx, { name }) => ...; see tools.md.

To work on an existing app, fetch its source into a directory. executor apps list shows app IDs:

executor apps source --app <app-id> > /tmp/source.json
jq -r .revision.commit /tmp/source.json    # the commit your edits are based on
node -e 'const fs=require("fs"),p=require("path");for(const f of JSON.parse(fs.readFileSync(0)).files){const t=p.join(process.argv[1],f.path);fs.mkdirSync(p.dirname(t),{recursive:true});fs.writeFileSync(t,f.content)}' ./hello < /tmp/source.json

Each iteration saves the directory as a commit and deploys it:

executor apps commit --app <app-id> --files ./hello \
  --expected <last-commit> --message "Add search" > /tmp/commit.json
jq .removed /tmp/commit.json             # { count, paths }: files this save deleted
jq -r .revision.commit /tmp/commit.json
executor apps deploy --app <app-id> --commit <new-commit>

The commit prints the new revision; its commit is the next --expected. removed gives how many files the save deleted and at most 100 of their paths. If it names a file you meant to keep, it is still in the --expected commit (git show <last-commit>:<path> in a clone): restore it and commit again before deploying. A path cannot be both a file and a folder (a and a/b); such a save fails with SourcePathConflict and saves nothing. --expected is the commit your edits are based on. If someone else saved in between, the commit is rejected. Read the source again and reconcile before retrying. A commit alone does not change the running app.

On hosted Executor you can also use Git. executor apps git --app <app-id> prints the clone URL. Clone with the credential helper configured in the clone, so later pushes and fetches use it too:

git clone -c credential.helper= -c credential.helper='!executor apps credential' \
  -c credential.useHttpPath=true <url>

The empty credential.helper stops other helpers, such as the macOS keychain, from keeping copies of the helper’s short-lived tokens. In a clone made without it, run git config credential.helper '' and then git config --add credential.helper '!executor apps credential'.

Pushes save source but do not deploy it. Deploy the pushed commit with executor apps deploy --app <app-id> --commit "$(git rev-parse HEAD)". Pushes stream to the repository, so Executor sets no push size limit of its own. On hosted Executor the repository host accepts files up to 32 MB each and repositories up to 1 GB, and a single push of more than about 64 MiB of packed data currently fails; push a larger history in several pushes. The CLI does this for you. A pushed source over the limits above cannot be read or deployed. The limits apply to the commit being read, not to the history before it.

Type-check locally before deploying. A deploy compiles the app and reports build errors, but it does not type-check. The framework is published to npm as apps under the beta tag. The latest tag and the 1.0.0-beta versions are unrelated packages, so install only the exact version pinned in package.json, never apps@latest or an unpinned apps:

cd hello
npm install --no-package-lock
npx -y -p typescript@7 tsc --ignoreConfig --noEmit --strict --skipLibCheck \
  --module nodenext --moduleResolution nodenext --target es2022 index.ts

For a React UI, declare @types/react@19 and @types/react-dom@19 in devDependencies, and declare the asset types the UI imports in ui/assets.d.ts. Images and fonts import as URL strings; declare other extensions, such as *.png, the same way:

declare module "*.css";
declare module "*.svg" {
  const url: string;
  export default url;
}
declare module "*.woff2" {
  const url: string;
  export default url;
}

The live-inbox example already has the type packages and ui/assets.d.ts. An example from an older apps release may lack them and import ./schema.ts; add them and change those imports to .js. Then add --jsx react-jsx, the UI entry and the declaration file:

npx -y -p typescript@7 tsc --ignoreConfig --noEmit --strict --skipLibCheck \
  --module nodenext --moduleResolution nodenext --target es2022 \
  --jsx react-jsx index.ts ui/main.tsx ui/assets.d.ts

Was this page helpful?