Docs/For AI Agents/Overview

AI Agent Documentation

Everything a coding agent needs to deploy and run apps on Nexlayer: how to connect, the steps to follow, the tools, and the one file that describes an app. If you're an agent, start with the box below.

For agents: start here

The same steps live at nexlayer.com/AGENTS.md. The deploy procedure itself always comes from nexlayer_get_deployment_workflow, so it's never stale.

context
NEXLAYER — FOR CODING AGENTS
============================
Nexlayer is a production cloud built for AI agents. It runs the whole app
(frontend, backend, database, workers) from one nexlayer.yaml.

TWO WAYS TO ACT
- MCP (any agent):   npx @nexlayer/mcp-install
                     remote server: https://mcp.nexlayer.ai/api/mcp
- CLI (has a shell): nexlayer ship --json      reference: nexlayer.com/docs/cli

STEPS
1. Connect      install the MCP (it opens the browser so the user signs in)
2. Confirm      nexlayer_check_credits — read-only; stop if not signed in
3. Look first   read .nexlayer/ if present; nexlayer_list_projects
4. Deploy       nexlayer_get_deployment_workflow, then follow it:
                build linux/amd64 images → write nexlayer.yaml →
                nexlayer_validate_yaml → nexlayer_deploy
5. Verify       nexlayer_check_deployment_status, open the URL, then report

RULES
- Never ask for a secret in chat or write one to the repo: send the user
  to the app's Secrets section in the dashboard.
- Never delete an app or create an API key without an explicit go-ahead.
- Always say which app (and workspace) you are deploying to.

Two ways to act

MCP: any agent

One command sets up every agent on the machine and signs the user in. Works in editors and chat apps.

npx @nexlayer/mcp-install

MCP setup

CLI: agents with a shell

Add --json and every answer is one line with a status, an exit code and the next step.

nexlayer ship --json

CLI reference

MCP tools

57 tools, grouped by what the user asks for. Users type the sentence; you pick the tool. Tools that delete or create keys act immediately, so get a clear yes first.

Get started

nexlayer_check_credits“Am I signed in to Nexlayer? Which plan am I on?”
nexlayer_list_projects“What do I have running on Nexlayer?”
nexlayer_get_project_by_url“Show me the app at my-app.cloud.nexlayer.ai”
nexlayer_deployment_activity“What changed across my apps recently?”

Build and deploy

nexlayer_get_deployment_workflow“How do I deploy this project?”
nexlayer_analyze_github_repo“What would it take to run this GitHub repo on Nexlayer?”
nexlayer_remote_build“Build this repo on Nexlayer, no Docker on my machine”
nexlayer_build_and_push_image“Build my local image and push it to my Nexlayer registry”
nexlayer_get_schema“What fields can nexlayer.yaml have?”
nexlayer_validate_yaml“Is my nexlayer.yaml valid?”
nexlayer_deploy“Ship this app to Nexlayer”
nexlayer_delete_deployment“Delete my-app (asks first)”

Check and fix

nexlayer_check_deployment_status“Is my app working?”
nexlayer_get_deployment_logs“Show me my app's logs”
nexlayer_get_deployment_events“Why did my app restart?”
nexlayer_fetch_result“Show the full output of that last result”

Debug a live app

nexlayer_debug_deploy_proxy“Open a debug session on my app”
nexlayer_debug_destroy_proxy“Close the debug session”
nexlayer_debug_shell_open“Open a shell in my API”
nexlayer_debug_shell_send“Run this command in that shell”
nexlayer_debug_shell_list“Which shells are open?”
nexlayer_debug_shell_close“Close that shell”
nexlayer_debug_proxy_exec“Run a one-off command in my web part”
nexlayer_debug_proxy_http“Call my API's /health from inside the app”
nexlayer_debug_file_list“List the files in my app's /app folder”
nexlayer_debug_file_edit“Fix this line in the running config”
nexlayer_debug_file_copy_from“Download that log file from my app”
nexlayer_debug_file_copy_to“Upload this file into my app”
nexlayer_debug_db_query“How many users are in my database?”
nexlayer_debug_pod_describe“Why won't my worker start?”
nexlayer_debug_pod_restart“Restart my API”
nexlayer_debug_pod_restart_deployment“Restart every part of my app”
nexlayer_debug_pod_scale“Run three copies of my web part”
nexlayer_debug_namespace_info“What's running inside my app?”
nexlayer_debug_namespace_dns“Can my web part reach api.pod?”
nexlayer_debug_fetch_result“Show the full output of that debug command”

Custom domains

nexlayer_get_domain_setup_guide“How do I put my app on my own domain?”
nexlayer_add_domain_to_profile“Add app.example.com to my account”
nexlayer_check_domain_configuration“Is my domain set up right?”
nexlayer_verify_name_servers_configuration“Have my name servers switched over?”

Starter AI apps

nexlayerAI_list_sandboxes“What AI starter apps can I launch?”
nexlayerAI_deploy_chatbot“Launch the chat starter app”
nexlayerAI_deploy_code_copilot“Launch the code copilot starter app”
nexlayerAI_deploy_code_reviewer“Launch the code reviewer starter app”
nexlayerAI_deploy_content_guard“Launch the content guard starter app”
nexlayerAI_deploy_multi_agent“Launch the multi-agent starter app”
nexlayerAI_deploy_translation_hub“Launch the translation starter app”

Account and keys

nexlayer_upgrade_plan“Upgrade me to Pro”
nexlayer_list_api_keys“Which API keys do I have?”
nexlayer_generate_api_key“Create an API key for CI (asks first)”
nexlayer_revoke_api_key“Revoke that old key”

Skills and feedback

nexlayer_get_skills“What Nexlayer skills do you have?”
nexlayer_get_skill_content“Load the deploy skill”
nexlayer_sync_skills“Install the Nexlayer skills here”
nexlayer_check_updates“Are my Nexlayer skills up to date?”
nexlayer_feedback“Tell Nexlayer the deploy was confusing”
nexlayer_submit_issue“Report this bug to Nexlayer”

nexlayer.yaml

One file in the project root describes the whole app. Always check it with nexlayer_validate_yaml before deploying. A full-stack app with a database:

nexlayer.yaml
application:
  name: my-app
  pods:
    - name: frontend
      image: ghcr.io/my-org/web:v1.0.0
      path: /
      servicePorts: [3000]
      vars:
        NEXT_PUBLIC_API_URL: <% URL %>/api

    - name: api
      image: ghcr.io/my-org/api:v1.0.0
      path: /api
      servicePorts: [8000]
      vars:
        DATABASE_URL: postgresql://user:password@db.pod:5432/mydb

    - name: db
      image: postgres:16
      servicePorts: [5432]
      vars:
        POSTGRES_USER: user
        POSTGRES_PASSWORD: password
        POSTGRES_DB: mydb
        PGDATA: /var/lib/postgresql/data/pgdata
      volumes:
        - name: postgres-data
          size: 10Gi
          mountPath: /var/lib/postgresql
  • pods sits under application. Each pod is one part of the app.
  • path makes a pod public at the app's URL. No path means private to the app.
  • Pods reach each other at <name>.pod:<port>. No service discovery to set up.
  • <% URL %> is the app's public URL. Use it for anything the browser calls.
  • Images are linux/amd64 with a real tag. Not latest.
  • API keys never go in the file or the chat. The user adds them in the app's Secrets section in the dashboard.
  • Volumes keep data across redeploys. Give every database one.

Every field: nexlayer.yaml reference. Live schema: nexlayer_get_schema.

When it isn't working

Read the logs before changing anything, explain the cause to the user in plain words, fix it, redeploy, and check again.

The build failed

Read the build output, fix the Dockerfile or dependencies, rebuild with a new tag.

The app isn't answering

The servicePorts value must be the port the process listens on, on 0.0.0.0, not localhost.

A part keeps restarting

Read its logs and events: usually a missing variable or secret, or a database it can't reach yet.

The image won't start

It was built for the wrong platform. Rebuild for linux/amd64.

Data vanished after a redeploy

The database has no volume. Add one at its data path.

Talking to the user

  • Plain words. Say what's happening to their app, not which tool you called.
  • Say where you're deploying: the app's name, and the workspace if there's more than one.
  • Check, don't assume: open the URL before you say it works.
  • Hand over the live URL the moment it's working.
  • Offer a custom domain once the first deploy is live.

Next