Team quota management

Updated at:

A Team quota limits the resource usage of a specific Team. When multiple Teams, workloads, or environments share Agent Sandbox, configure the CPU, memory, and live instance quotas for each Team.

Overview

This topic describes how to manage Team quotas by using the Alibaba Cloud Go SDK. Requests use Alibaba Cloud access credentials, and the API version is Sandbox/2026-08-20. The E2B SDK and API keys are not used for Team quota management.

Quota model and planning

Tier

Scope

Quota items

Management method

Account level

A single region of an Alibaba Cloud account.

The overall resource quota of the account in that region.

View the quota or request an adjustment for the corresponding quota item.

Team level

A specified Team of the account in that region.

CPU cores, memory in GB, and live instances.

Managed through the Agent Sandbox OpenAPI or the Alibaba Cloud SDK.

The sum of the CPU quotas of all Teams cannot exceed the account-level CPU quota, and the sum of the memory quotas cannot exceed the account-level memory quota. Before you configure a Team quota, check the account quota of the target region. For the account-level resource limits and how to adjust them, see Limits.

To isolate production, testing, or batch workloads, create a separate Team for each and configure quotas. For example, run online services and batch evaluations in different Teams so that evaluation tasks do not consume the quota of the Team that serves online workloads. Divide Teams based on your workload isolation requirements.

When you plan the CPU and memory quotas, estimate them from the number of Sandbox instances that run at the same time and their specifications. Reserve account quota for workload growth. The live instance quota is configured separately. Before you lower or delete a quota, review the existing configuration, current resource usage, and peak workload.

Prerequisites

  • Agent Sandbox is activated in the target region, and Team quota management is confirmed to be available for that region and account.

  • You have created the target Team and obtained the Team ID.

  • The calling identity has the Resource Access Management (RAM) permissions required by the API operations. For the authorization method and the Alibaba Cloud Resource Name (ARN) of each resource, see Authorize RAM users to access the console.

  • You have prepared the Go SDK and the access credentials as described in Alibaba Cloud SDK and API guide. The examples in this topic use v1.2.0 of github.com/alibabacloud-go/sandbox-20260820.

API operations and RAM permissions

Operation

API / Go SDK method

RAM action

Set or update a quota

UpdateQuota

sandbox:UpdateQuota

Query the quota of a specified Team

DescribeQuota

sandbox:DescribeQuota

Query the quotas of the account

ListQuota

sandbox:ListQuotas

Delete the quota of a specified Team

DeleteQuota

sandbox:DeleteQuota

Use the API names and RAM actions specified in the preceding table. ListQuota is authorized against the collection of quotas in the account. A calling identity that is authorized to manage only a single Team may not have the permission to query the quotas of the account.

Quota parameters

The following fields are used in the request body of UpdateQuota. The Go SDK uses the sandbox.Quota model, and sets the fields by using functions such as tea.String and tea.Int32.

API field

Go SDK field

Type

Required

Description

tagValue

TagValue

String

Yes

Set to the ID of the target Team, in the [A-Za-z0-9_-]{1,64} format.

cpuCores

CpuCores

Integer

Yes

The CPU core quota. Set to a non-negative integer.

memoryGB

MemoryGB

Integer

Yes

The memory quota, in GB. Set to a non-negative integer.

instanceCount

InstanceCount

Integer

No

The live instance quota. If you leave this field empty, the quota is not updated. A value of -1 clears this quota item, 0 prohibits the use of instances, and a value greater than 0 sets the quota.

Except for the quota list operation, the query and delete operations specify the Team by the request parameter tagValue. The quota list uses maxResults to control the number of entries per page, and uses nextToken in the response to obtain the next page.

Manage Team quotas

Environment variables

Configure the access credentials as described in Alibaba Cloud SDK and API guide. Pass them in through environment variables instead of writing them into code, images, templates, or logs. The examples in this topic read the following environment variables:

Environment variable

Purpose

Value source or how to set it

ALIBABA_CLOUD_ACCESS_KEY_ID

The AccessKey ID used to call the OpenAPI.

Obtained from the access credentials of the calling identity.

ALIBABA_CLOUD_ACCESS_KEY_SECRET

The AccessKey secret that corresponds to the AccessKey ID.

Obtained together with the AccessKey ID.

ALIBABA_CLOUD_SECURITY_TOKEN

The security token of the Security Token Service (STS) temporary credentials.

Set this variable only if you use STS temporary credentials. The token is obtained from the same set of credentials.

SANDBOX_REGION_ID

The region in which the quota takes effect.

Set to the ID of the target region, for example cn-beijing.

SANDBOX_ENDPOINT

The endpoint of the OpenAPI service.

Set to sandbox.<region>.aliyuncs.com. The value must be consistent with the region and must not include a protocol prefix.

SANDBOX_TEAM_ID

The Team whose quota you manage.

Obtain the Team ID from the Team list of the target region.

Set or update a quota

UpdateQuota both sets a quota and updates an existing configuration. Before you run the example, change the CPU, memory, and live instance values to the target values. If a quota already exists, query the current configuration before you update it.

Set the parameters in a terminal in which the access credentials are configured. The following example uses the China (Beijing) region:

export SANDBOX_REGION_ID="cn-beijing"
export SANDBOX_ENDPOINT="sandbox.cn-beijing.aliyuncs.com"
export SANDBOX_TEAM_ID="<TEAM-ID>"

Save the following code as main.go. This example sets the quota of the specified Team to 32 CPU cores, 64 GB of memory, and 16 live instances:

package main

import (
    "encoding/json"
    "fmt"
    "log"
    "os"
    "strings"

    openapiutil "github.com/alibabacloud-go/darabonba-openapi/v2/utils"
    sandbox "github.com/alibabacloud-go/sandbox-20260820/client"
    "github.com/alibabacloud-go/tea/tea"
)

func requireEnv(name string) string {
    value := strings.TrimSpace(os.Getenv(name))
    if value == "" {
        log.Fatalf("Set %s", name)
    }
    return value
}

func printJSON(value interface{}) {
    data, err := json.MarshalIndent(value, "", "  ")
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(string(data))
}

func main() {
    client, err := sandbox.NewClient(&openapiutil.Config{
        AccessKeyId:     tea.String(requireEnv("ALIBABA_CLOUD_ACCESS_KEY_ID")),
        AccessKeySecret: tea.String(requireEnv("ALIBABA_CLOUD_ACCESS_KEY_SECRET")),
        SecurityToken:   tea.String(os.Getenv("ALIBABA_CLOUD_SECURITY_TOKEN")),
        RegionId:        tea.String(requireEnv("SANDBOX_REGION_ID")),
        Endpoint:        tea.String(requireEnv("SANDBOX_ENDPOINT")),
    })
    if err != nil {
        log.Fatal(err)
    }

    // Set or update the quota.
    resp, err := client.UpdateQuota(&sandbox.UpdateQuotaRequest{
        Body: &sandbox.Quota{
            TagValue:      tea.String(requireEnv("SANDBOX_TEAM_ID")),
            CpuCores:      tea.Int32(32),
            MemoryGB:      tea.Int32(64),
            InstanceCount: tea.Int32(16),
        },
    })
    if err != nil {
        log.Fatalf("set quota failed: %v", err)
    }
    printJSON(resp.Body)
}

Run the code in a Go project in which the SDK is installed:

go run main.go

The response contains the saved quota and the request ID. To adjust the quota again, change the target values in sandbox.Quota and call the same API operation.

The following query, list, and delete examples reuse the imports, helper functions, and client initialization code above. Replace the operation code after the "Set or update the quota" comment in main with the corresponding example. You do not need to run the update operation before you query or delete a quota.

Query a quota

Call DescribeQuota to query the quota of a specified Team:

resp, err := client.DescribeQuota(&sandbox.DescribeQuotaRequest{
    TagValue: tea.String(requireEnv("SANDBOX_TEAM_ID")),
})
if err != nil {
    log.Fatalf("describe quota failed: %v", err)
}
printJSON(resp.Body)

Query the quota list

Call ListQuota to query the quotas of the account a page at a time:

var nextToken *string
for {
    resp, err := client.ListQuota(&sandbox.ListQuotaRequest{
        MaxResults: tea.Int32(100),
        NextToken:  nextToken,
    })
    if err != nil {
        log.Fatalf("list quota failed: %v", err)
    }
    printJSON(resp.Body)

    nextToken = resp.Body.NextToken
    if tea.StringValue(nextToken) == "" {
        break
    }
}

ListQuota queries the quotas of the current account in the target region, and does not filter by SANDBOX_TEAM_ID. To query the quota of a specified Team, call DescribeQuota.

Delete a quota

Important

Deletion removes only the quota configuration of the Team. The Team itself is not deleted, and the original quota values are not retained. Before you delete the quota, call DescribeQuota to record the current quota values. If you need to restrict the Team again after the deletion, call UpdateQuota with the complete CPU, memory, and live instance target values.

After you confirm that the Team no longer needs this quota configuration, run the delete operation separately:

resp, err := client.DeleteQuota(&sandbox.DeleteQuotaRequest{
    TagValue: tea.String(requireEnv("SANDBOX_TEAM_ID")),
})
if err != nil {
    log.Fatalf("delete quota failed: %v", err)
}
printJSON(resp.Body)

After the deletion, call DescribeQuota to check whether the configuration still exists. A response of ResourceQuotaNotFound indicates that the quota configuration is not found.

How quotas take effect

  • UpdateQuota updates the Team specified by tagValue. Each request must include both the CPU and the memory target values. You cannot pass only one of them.

  • Quotas are managed based on the region in which the resources reside. When you call an API operation, the Team, region, and endpoint must correspond to each other.

  • If you update only the CPU and memory quotas, leave instanceCount empty, and the live instance quota remains unchanged. To adjust or clear this quota, pass the corresponding value as described in the parameter table.

  • A successful update indicates that the quota configuration is saved. When you create a Sandbox instance, the account-level quota and the limits of the related products still apply.

FAQ

What do I set tagValue to?

Set it to the ID of the target Team. Do not set it to the Team name, the resource group ID, or an API key. For more information about how to obtain the Team ID, see Create a Team.

Why does the system report an invalid parameter when I set a quota?

If InvalidParameter is returned, check the format of the Team ID, whether both the CPU and memory fields are specified, and whether the two values are non-negative integers. If you pass instanceCount, the value must be an integer that is not less than -1.

Why does the system report that I do not have the permission to call quota operations?

Check the RAM permissions and the resource scope of the calling identity. Querying the quota list of the account requires sandbox:ListQuotas, and setting a quota requires sandbox:UpdateQuota. For the authorization details, see Authorize RAM users to access the console. If the error message indicates that the feature is not activated, contact technical support to confirm the activation conditions of the target region and account.

Why does the system report that the account quota is exceeded when I set a quota?

Check the error message to determine whether the exceeded item is CPU, memory, or another quota item. Next, review the account quota and the quotas already configured for other Teams. If the CPU or memory quota is insufficient, reallocate the quota among Teams or request an increase in the corresponding account quota.

If the quota that you set exceeds the account quota, the request may return errors such as LimitExceededError. Evaluate the result based on the returned HTTP status code, error code, and message. Do not identify a quota overrun only by HTTP status code 429.

Why does the system report that the quota does not exist when I query a quota?

If ResourceQuotaNotFound is returned, verify the account, region, and Team ID, and check whether the Team has a quota configured and whether you deleted the quota. If TeamNotFound is returned, check whether the Team exists in the target region.

How do I troubleshoot a failed request?

Record the error message and the request ID. Check whether the access credentials are valid and whether the region and endpoint are consistent. If you use STS temporary credentials, make sure that the AccessKey ID, AccessKey secret, and security token come from the same set of credentials and have not expired. Fix parameter, permission, or quota issues before you retry the request.