Use The Background Dev Server

Astro 7 can start astro dev as a managed background process when it detects an AI coding agent.

Humans still get the normal foreground dev server by default.

Commands

astro dev --background
astro dev status
astro dev logs
astro dev logs --follow
astro dev stop

When background mode starts, Astro writes .astro/dev.json with the server URL, port, and PID. This prevents duplicate dev servers for the same project.

Opt Out

ASTRO_DEV_BACKGROUND=0 astro dev

Use this when an agent environment is detected but you want normal foreground behavior.

Health Check

Astro’s dev server exposes a dev-only endpoint:

/_astro/status

It returns:

{ "ok": true }

Agents can use that endpoint instead of scraping terminal output for readiness.

Practical Pattern For Agents

astro dev --background
astro dev status

Then test the URL Astro reports. At the end of the task:

astro dev stop

Tip: Prefer astro dev logs --follow for debugging server-side output instead of starting another foreground dev server.