News

Laravel Installer Now Returns JSON When Running Inside an AI Agent

Published
Laravel Installer Now Returns JSON When Running Inside an AI Agent image

Release updates

Never miss a Laravel release

Get an email whenever a new Laravel release lands.

Laravel Installer v5.27.0 adds support for AI agent environments. When laravel new detects it's running inside an agent, it suppresses interactive prompts and decorative output and prints a single line of structured JSON to stdout instead.

The change comes from Joe Tannenbaum, and it covers the two things an agent actually needs to know: did it work, and if not, why?

A successful run produces:

{
"success": true,
"name": "my-app",
"directory": "/Users/you/code/my-app"
}

On failure, the output includes the error message, a path to the full installer log, and a tail of that log — enough context for an agent to understand what went wrong without having to chase down a temp file:

{
"success": false,
"name": "my-app",
"directory": "/Users/you/code/my-app",
"error": "Composer installation failed.",
"log": "/tmp/laravel-installer-abc123",
"tail": "..."
}

Detection happens automatically through a new Agent class that checks for environment variables set by common AI coding tools, including Claude Code, Cursor, GitHub Copilot, and Windsurf. No flags to pass or configuration needed — the installer figures out the context on its own.

For agentic workflows the agent runs the command, reads the JSON result, and either continues or handles the error — without trying to parse terminal output that wasn't meant for it.

PR: laravel/installer#508

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Sponsored

acquaintsoft logo
Acquaint Softtech

Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

Visit Acquaint Softtech

The latest

View all →
CPX: The Composer Package Executor for PHP image

CPX: The Composer Package Executor for PHP

Read article
Laravel AI SDK Adds Human-in-the-Loop Tool Approval image

Laravel AI SDK Adds Human-in-the-Loop Tool Approval

Read article
Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals image

Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals

Read article
Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs image

Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs

Read article
Blade Formatting in Laravel Pint image

Blade Formatting in Laravel Pint

Read article
Inertia DevTools Is Now on the Chrome Web Store image

Inertia DevTools Is Now on the Chrome Web Store

Read article