I Give My AI Agent a Git Link and Get Back a Live App. Here's What It Does When the Build Breaks.
Description and use
Automating the deployment loop: an AI agent creates a service, triggers a build from a git repo, streams logs, parses failures, commits fixes, rebuilds, and verifies the live URL.
Problem
Automating the deployment loop for a Git-hosted app so an AI agent can build, detect failures, fix code, and redeploy without human intervention.
Outcome
The agent can fully automate the deployment loop, handling failures by reading logs, applying fixes, and redeploying until the app is live.
Workflow
- Create a service with placeholder image "pending" and port 3000 via POST /v1/services
- Start a build from a git URL with source_type "git", source_url, and source_ref (commit SHA) via POST /v1/services/{svc}/builds
- Stream the build output with GET /v1/services/{svc}/builds/{build}/logs?follow=true
- When build fails, retrieve the full log with GET /v1/services/{svc}/builds/{build}/logs and status with GET /v1/services/{svc}/builds/{build}
- Parse the last 40 lines of the log to identify the error
- Fix the code (e.g., run npm install, commit lockfile), push to repo, and start a new build with the new SHA
- After deployment success, check service status and URL with GET /v1/services/{svc} and request the URL to confirm it answers
Evidence
agentic-hosting is a single program called ah that runs on your server. Agents talk to it over an HTTP API.
Create a service, the server's name for one app.
Start a build from a git URL.
Stream the build output.
If it fails, read the end of the log.
Fix the code, push, and build again.
When it's running, check the URL.
- Record date: 2026-10-21T15:41:22.907Z