Deploy from your AI agent
Deploy a site from Codex with Layero
Give Codex access to your project and connect Layero. This guide covers Codex CLI with a terminal: MCP provides platform operations, while the Layero CLI uploads the folder for a remote build.
Connect Layero Try the example1. Connect the platform
Run these commands in your terminal to add the remote MCP server and install the Layero skill. Start a new Codex session in your project folder after connecting. codex mcp list shows configured servers; /mcp in an interactive session shows active servers.
codex mcp add layero --url https://mcp.layero.ru/mcpnpx skills add LayeroInfra/layero-agentscodex mcp list
codex mcp login layeroFor account operations, run codex mcp login layero and authorize Layero in your browser. This signs in to Layero separately from your Codex account. Documentation search also works without signing in.
The Layero CLI needs Node.js 20 or newer and npm access. Model access, subscriptions and client availability are governed by the client provider and are not included in Layero plans.
2. Give the agent a task
Open the app root. In a monorepo, identify the app folder first. For a repository already connected to Layero, use the Git deployment workflow. Example request for a new project:
Read the Layero skill, inspect the project and run deploy --dry-run --json. Publish the new project with the CLI, wait for ready and check its returned URL. If the environment blocks network access or commands, report the required permission. Do not bypass a restriction with another tool.3. Try a minimal example
Download a single HTML file and publish it from a new folder. No dependencies, build tool or layero.json file are required. The commands use Bash/zsh; on Windows, use WSL or Git Bash. Run them in the agent terminal or your own shell.
mkdir layero-agent-demo
cd layero-agent-demo
curl -fsS https://layero.ru/examples/agent-deploy/index.html -o index.html
npx layero@latest deploy --dry-run --json
npx layero@latest deploy --jsonThe dry-run plan uploads nothing. When sign-in is needed, the CLI emits auth_required: open its URL and authorize access. Wait for ready and open its URL rather than constructing an address from the project name.
Download the HTML example · Open the deployed resultChecked on October 25, 2026: CLI 0.11.10 detected static, completed a real deployment and returned ready. The published site responds with HTTP 200 and contains Hello from Layero. This validates the CLI workflow, not model performance or a deployment-time guarantee.
Deploying your own app
For Vite, Next.js, Astro, Node.js or Python, run the CLI from the source folder. Layero detects the project and builds it remotely. If dry-run returns confident: false, follow next_action: you may need a different folder or a layero.json setting.
MCP publish_site uploads prebuilt static files with index.html. Use the CLI for server apps or projects that still need a build. Update a connected Git repository by pushing to the appropriate branch.
Next.js support and limits · CLI for agentsLimits to check before publishing
| Repeat deployments | A direct CLI upload replaces the live CLI project. For an isolated preview, connect a repository and push a separate branch. Archive uploads do not support --branch. |
|---|---|
| Without an account | Explicit --claim only: a static site or SPA for one hour, with a random address and indexing disabled. SSR and server apps need an account. Give the person ready.url and claim_url. |
| Search and domains | Free does not include search indexing. A permanent indexed site and custom domain require Pro; enable indexing separately in project settings. |
| Secrets and permissions | Keep tokens and secret .env files out of published files. Set project environment variables separately and store LAYERO_TOKEN as a CI secret. The agent remains subject to client and Layero account permissions. |
Troubleshooting
In a remote Codex task, check Node.js, network access and project files. Source builds require a client with terminal access; MCP publish_site alone only publishes prebuilt static files. CI uses LAYERO_TOKEN from a secret store instead of interactive sign-in.
npx layero@latest diagnose
npx layero@latest logs --runtimeCheck whether the failure happened during dependency installation, build or launch. Read diagnose first; runtime logs help with launch failures. A command that ended without ready has not confirmed a successful publication.
CLI events and error codes