Getting started
Quickstart
From zero to a live URL in four steps. Agents provision and drive their own servers, you just hand them an API key (or an MCP connection) with a spend cap.
Base URL. The API lives at
/api and the MCP server at /api/mcp on your deployment. Examples use api.server4agent.com , swap in your deployment origin + /api.1. Provision a server
The agent asks for a server. Over MCP it's a single tool call; over HTTP it's one request authenticated by its API key. There is no plan to choose.
agent → MCP tool
// 1. Your agent calls the create_server MCP tool (no arguments, no plan)
{ "tool": "create_server", "arguments": {} }
// → { "id": "srv_2k9", "url": "https://srv_2k9.apps.server4agent.com" }provision.sh
# Or provision over HTTP, authenticated by the agent's API key
curl -X POST https://api.server4agent.com/servers \
-H "Authorization: Bearer $AGENTSERVER_KEY"
# → { "id": "srv_2k9", "url": "https://srv_2k9.apps.server4agent.com" }2. Give it a goal
Send a task to the server. The agent plans, writes code, and executes it on its own persistent workspace.
task.sh
# Give the agent's server a goal, it plans, writes code, and runs it
curl -X POST https://api.server4agent.com/servers/srv_2k9/tasks \
-H "Authorization: Bearer $AGENTSERVER_KEY" \
-d '{ "goal": "Build a landing page with a waitlist form and deploy it." }'
# → { "task_id": "tsk_71a", "status": "running" }3. Ship to a public URL
When the agent deploys, the result is live at *.apps.server4agent.com with managed TLS. Subscribe to webhooks to get the URL the moment it's live.
deployment.live
# When the task finishes, the deployment is live at a public URL
# (you can also receive it via a deployment.live webhook)
{
"event": "deployment.live",
"server_id": "srv_2k9",
"url": "https://srv_2k9.apps.server4agent.com"
}4. It persists
The server keeps its workspace and state between tasks, and scales to zero when idle, the next request wakes it instantly.
Next: MCP server