Manage AgentSpace resource tags

Updated at:

Resource tags consist of a tag key and a tag value and are used to identify and classify AgentSpaces. This topic describes how to add, modify, and delete resource tags for an AgentSpace, and how to query AgentSpaces by tag.

Prerequisites

  • An AgentSpace is created and in the available state.

  • Your account has access to the target AgentSpace. If you use a RAM user or RAM role, grant the required tag operation permissions. For more information, see RAM permission policy reference.

    Operation

    Required permission

    View space details and query the space list

    agentloop:GetAgentSpace, agentloop:ListAgentSpaces

    Query resource tag bindings

    agentloop:ListTagResources

    Add tags and modify tag values

    agentloop:TagResources

    Unbind tags

    agentloop:UntagResources

Usage limits

Item

Limit

Supported resource

AgentSpace only. Tags are bound to a specific AgentSpace.

Resource scope

The target must be an AgentSpace that is created and available in the requested region under the current account. All resources in a single batch request must be in the same region.

Tags per resource

Up to 20 user-defined tags.

Tag key length

1 to 128 Unicode characters. The key cannot be empty.

Tag value length

0 to 256 Unicode characters. An empty string is allowed.

Tag key uniqueness

Tag keys within an AgentSpace must be unique. If you set a new value for an existing key, the value is updated and other tags remain unchanged.

Case sensitivity

Tag keys and tag values are case-sensitive. For example, env and Env are different tag keys.

Reserved prefix

Tag keys cannot start with acs: or aliyun. The prefix check is case-insensitive.

URL strings

Tag keys and tag values cannot contain http:// or https://. This check is case-insensitive.

Character range

Unicode letters, digits, spaces, and other separators are supported, along with the special characters listed below. Line breaks, tabs, emoji, and other unsupported characters are not allowed.

Resources per API request

A single bind, unbind, or query-by-resource request can specify up to 50 AgentSpaces. Resource names must be unique.

Tag parameters per API request

A single bind request can contain up to 20 tags. A single unbind-by-key request can contain up to 20 tag keys. A single query request can contain up to 20 tag filter conditions. Tag keys in the same request must be unique.

The following special characters are supported. Each character can be used on its own:

-.!@#$%\^&*)(+={}[]/",'<>~·`?:;|_。?!,、;:“”‘’()《》〈〉【】『』「」﹃﹄〔〕…—~﹏¥
Note
  • Different AgentSpaces can use the same tag keys and values independently. For example, multiple spaces can be tagged with env=prod.

  • Resource tags on an AgentSpace are managed separately from the tags on its associated SLS project, CloudMonitor 2.0 workspace, and MSE namespace. Adding a resource tag does not automatically add the same tag to these associated resources.

  • The resource tags described in this topic are managed separately from features such as prompt version tags and attribution tags.

Manage resource tags

Log on to the AgentLoop console, select the target AgentSpace, and go to System Management > Space Management. In the Tags section, click the edit icon.

Add a tag

  1. Add a tag key and a tag value. You can set tags by environment, business, or team, as shown in the following example.

    Tag key

    Tag value

    Purpose

    env

    prod

    Identifies the production environment.

    business

    customer-service

    Identifies the customer service business.

    team

    search

    Identifies the team.

  2. Add more tags as needed. A tag value can be empty, but a tag key cannot.

  3. Submit the tag configuration, and check the tag list of the target AgentSpace to confirm that the tag is added.

Modify a tag

  1. Click the edit icon and find the tag key to modify.

  2. Change the tag value. For example, change the value of env from test to prod.

  3. Submit the change and confirm that the tag list shows the new value.

Note

Changing a tag value affects only the corresponding tag on the current AgentSpace. To change a tag key, unbind the existing tag first and then add the new key-value pair.

Delete a tag

  1. Click the edit icon and select the tag to delete.

  2. Remove the tag and submit the change.

  3. Check the tag list to confirm that the tag is unbound from the current AgentSpace.

Note

Deleting a tag only removes the association between the tag and the current AgentSpace. It does not delete the AgentSpace or tags with the same name on other resources. If the AgentSpace is deleted, the system removes its tag associations.

Query AgentSpaces by tag

You can call ListAgentSpaces and use the tag parameter to filter AgentSpaces. Use the service endpoint of the region where the target resources reside.

Query

tag parameter example

Description

Query spaces in the production environment

[{"key":"env","value":"prod"}]

Exactly matches env=prod.

Query spaces that have an environment tag

[{"key":"env"}]

Matches spaces that have the env tag key, regardless of the tag value.

Query spaces whose environment tag value is empty

[{"key":"env","value":""}]

Matches only spaces whose env value is an empty string.

Query production spaces of a team

[{"key":"env","value":"prod"},{"key":"team","value":"search"}]

Multiple conditions are combined with AND. All conditions must be met.

Note
  • When you specify tag filter conditions, key is required. Omitting value has a different meaning from passing an empty string. null is not supported as a wildcard value.

  • When you filter by tag, only AgentSpaces available in the current region are returned. An empty tag array is equivalent to no tag filter.

  • ListAgentSpaces returns space information and all its tags, whereas ListTagResources returns tag bindings. To view only all tags of an AgentSpace, call ListTagResources with the resource name of the space and do not specify tag filter conditions.

  • tags: [] in the response indicates that the space has no tags. If the tags field is omitted from the response, it does not mean that the space has no tags. For tag return rules in cross-region lists, see the API reference.

Related APIs

When you call the three tag APIs, set resourceType to agentspace (case-insensitive) and resourceId to the AgentSpace name. The region is determined by the service endpoint. You do not need to pass regionId in the business request parameters of these three APIs.

API

Description

TagResources

Binds tags to one or more AgentSpaces, or updates the value of an existing tag key.

UntagResources

Unbinds specified tags or all user-defined tags from one or more AgentSpaces.

ListTagResources

Queries resource tag bindings by resource name or tag conditions.

GetAgentSpace

Queries the details and tags of a specified AgentSpace.

ListAgentSpaces

Queries the AgentSpace list and supports filtering by tag.