# Requires: GRAVIXLAYER_API_KEY, jq
# REST create still sends cloud and region in the body.
API="https://api.gravixlayer.ai/v1"
AUTH=(-H "Authorization: Bearer $GRAVIXLAYER_API_KEY" -H "Content-Type: application/json")
RT=$(curl -sS -X POST "$API/agents/runtime" "${AUTH[@]}" \
-d '{
"template": "base-small",
"cloud": "aws",
"region": "us-east-1",
"timeout": 3600,
"env_vars": {"APP_ENV": "production"},
"metadata": {"project": "my-agent"}
}' | jq -r '.runtime_id')
for i in $(seq 1 60); do
STATUS=$(curl -sS "$API/agents/runtime/$RT" \
-H "Authorization: Bearer $GRAVIXLAYER_API_KEY" | jq -r '.status')
[ "$STATUS" = "running" ] && break
sleep 2
done
echo "$RT"
curl -sS -X DELETE "$API/agents/runtime/$RT" \
-H "Authorization: Bearer $GRAVIXLAYER_API_KEY"