Skip to content

Scaling

Each agent runs as one or more replicas: identical containers with the CPU and memory set in deploy.resources. Requests to the agent's URL go to a random running replica.

Set replicas and resources at deploy time

{
  "deploy": {
    "image": "agntspark/template-customer-support:latest",
    "replicas": 2,
    "resources": {"cpu": 0.5, "memory_mb": 512}
  }
}

cpu is in vCPUs (0.1 or more) and memory_mb in megabytes (128 or more). Each replica gets exactly that much: memory is a hard limit, and a replica that exceeds it is restarted.

Scale a running agent

curl -X POST https://agntapi.agntspark.com/v1/agents/agt_…/scale \
  -H "Authorization: Bearer $AGNTSPARK_API_KEY" -H 'content-type: application/json' \
  -d '{"direction": "up", "count": 1}'

New replicas get the same image, environment and limits as the existing ones. In the CLI: agntspark scale agt_… up --count 1.

Auto-scaling

Set auto_scale: true with min_replicas and max_replicas in the deploy config. The platform checks running agents every 30 seconds and adjusts replicas within that range. It never scales past your plan's quota.

Conversations and replicas

The platform runtime keeps session_id history in memory, in the replica that served the request. With more than one replica, a follow-up request can land on a replica that hasn't seen the conversation. If your agent relies on session_id, run one replica, or store history outside the container.

Quotas

Scaling counts against your plan: running replicas, total vCPU and memory, and the most one replica may request. A request past a quota is refused with 403 QUOTA_EXCEEDED and nothing changes. See Plans, Quotas and Usage.