Catalog PyPI
Back to packageRELEASE DETAILS

0.1.1

PyPI

agent-identity-cli

Agent Identity Toolkit CLI for managing AI Agent identities

agent-identityalibabacloudcliramworkload-identity
Published4 Jan 2026
Direct dependencies9
Transitive dependenciesNot calculated

README

Version 0.1.1 documentation

English | 简体中文

Alibaba Cloud Agent Identity CLI for Python

A command-line tool for managing AI Agent identities on Alibaba Cloud. It provides capabilities to create RAM Roles, Permission Policies, and Workload Identities.

Requirements

  • Python >= 3.8

Installation

pip install agent-identity-cli

For local development:

git clone <repository-url>
cd agent-identity-python-cli
pip install -e .

Configuration

Set the following environment variables before using the CLI:

# Required: Alibaba Cloud credentials
export ALIBABA_CLOUD_ACCESS_KEY_ID=<your_access_key_id>
export ALIBABA_CLOUD_ACCESS_KEY_SECRET=<your_access_key_secret>

# Optional: Agent Identity region, defaults to cn-beijing
export AGENT_IDENTITY_REGION_ID=cn-beijing

# Optional: Custom endpoint for Agent Identity API (for pre-release testing)
export AGENT_IDENTITY_ENDPOINT=agentidentity.cn-beijing.aliyuncs.com

CLI Usage

create-role

Create a RAM Role with Agent Identity trust policy and permission policy.

# Basic usage: auto-generate role name, trust policy allows all workload identities
agent-identity-cli create-role

# Specify role name
agent-identity-cli create-role --role-name my-agent-role

# Specify workload identity name (for trust policy)
agent-identity-cli create-role --workload-identity-name my-identity

# Full parameters
agent-identity-cli create-role \
  --role-name my-agent-role \
  --workload-identity-name my-identity

Parameters:

ParameterRequiredDescription
--role-nameNoRole name. Defaults to AgentIdentityRole-{workload-identity-name} or AgentIdentityRole-{random}
--workload-identity-nameNoWorkload Identity name for building trust policy. If not specified, allows all workload identities

Output:

  • Role ARN
  • Role Name
  • Policy Name
  • Trust Policy (JSON)
  • Permission Policy (JSON)

create-workload-identity

Create a Workload Identity with optional automatic Role creation.

# Auto-create associated Role
agent-identity-cli create-workload-identity --workload-identity-name my-identity

# Use existing Role
agent-identity-cli create-workload-identity \
  --workload-identity-name my-identity \
  --associated-role-arn acs:ram::123456789:role/my-role

# Full parameters
agent-identity-cli create-workload-identity \
  --workload-identity-name my-identity \
  --associated-role-arn acs:ram::123456789:role/my-role \
  --identity-provider-name my-idp \
  --allowed-resource-oauth2-return-urls "https://example.com/callback,https://app.example.com/oauth"

Parameters:

ParameterRequiredDescription
--workload-identity-nameYesWorkload Identity name
--associated-role-arnNoAssociated Role ARN. If not specified, auto-creates a new Role
--identity-provider-nameNoIdentity Provider name
--allowed-resource-oauth2-return-urlsNoOAuth2 callback URL list, comma-separated

Output:

  • Workload Identity ARN
  • Workload Identity Name
  • Role information (if a new Role was created)

Python SDK Usage

The CLI can also be used as a Python module for integration with other tools.

create_role

from agent_identity_cli import create_role, CreateRoleConfig

# Create Role (trust policy allows all workload identities)
result = create_role(CreateRoleConfig())
print(f"Role ARN: {result.role_arn}")
print(f"Trust Policy: {result.trust_policy}")
print(f"Permission Policy: {result.permission_policy}")

# Specify workload identity name
result = create_role(CreateRoleConfig(
    role_name="my-agent-role",
    workload_identity_name="my-identity",
))
print(f"Role ARN: {result.role_arn}")

create_workload_identity

from agent_identity_cli import create_workload_identity, CreateWorkloadIdentityConfig

# Auto-create Role
result = create_workload_identity(CreateWorkloadIdentityConfig(
    workload_identity_name="my-identity",
))
print(f"Workload Identity ARN: {result.workload_identity_arn}")
print(f"Role ARN: {result.role_result.role_arn}")

# Use existing Role
result = create_workload_identity(CreateWorkloadIdentityConfig(
    workload_identity_name="my-identity",
    associated_role_arn="acs:ram::123456789:role/my-role",
))

Data Models

CreateRoleConfig:

FieldTypeRequiredDescription
role_namestrNoRole name, auto-generated if not specified
workload_identity_namestrNoWorkload Identity name for trust policy

CreateRoleResult:

FieldTypeDescription
role_arnstrCreated Role ARN
role_namestrCreated Role name
trust_policydictTrust policy content
policy_namestrCreated permission policy name
permission_policydictPermission policy content

CreateWorkloadIdentityConfig:

FieldTypeRequiredDescription
workload_identity_namestrYesWorkload Identity name
associated_role_arnstrNoAssociated Role ARN
identity_provider_namestrNoIdentity Provider name
allowed_resource_oauth2_return_urlsList[str]NoOAuth2 callback URL list

CreateWorkloadIdentityResult:

FieldTypeDescription
workload_identity_arnstrCreated Workload Identity ARN
workload_identity_namestrCreated Workload Identity name
role_resultCreateRoleResultRole information (if a new Role was created)

Policy Formats

Trust Policy

{
  "Version": "1",
  "Statement": [{
    "Effect": "Allow",
    "Principal": {
      "Service": "workload.agentidentity.aliyuncs.com"
    },
    "Action": ["sts:AssumeRole", "sts:SetContext"],
    "Condition": {
      "StringEquals": {
        "sts:RequestContext/agentidentity:WorkloadIdentityArn": 
          "acs:agentidentity:{regionId}:{accountId}:workloadidentitydirectory/default/workloadidentity/{name}"
      }
    }
  }]
}
  • If --workload-identity-name is not specified, the Condition block is omitted, allowing all Workload Identities.

Permission Policy

{
  "Version": "1",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["agentidentitydata:GetResourceOAuth2Token"],
      "Resource": ["acs:agentidentity:{regionId}:{accountId}:workloadidentitydirectory/default/workloadidentity/{name}"]
    },
    {
      "Effect": "Allow",
      "Action": ["agentidentitydata:GetResourceAPIKey"],
      "Resource": ["acs:agentidentity:{regionId}:{accountId}:workloadidentitydirectory/default/workloadidentity/{name}"]
    }
  ]
}

License

Apache-2.0

Copyright (c) 2009-present, Alibaba Cloud All rights reserved.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 9

Native requirements
9 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
alibabacloud-agentidentity20250901
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
alibabacloud-agentidentity20250901>=0.0.1runtime
alibabacloud-credentials
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
alibabacloud-credentials>=0.3.0runtime
alibabacloud-ram20150501
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
alibabacloud-ram20150501>=1.0.0runtime
alibabacloud-sts20150401
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
alibabacloud-sts20150401>=1.0.0runtime
alibabacloud-tea-openapi
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
alibabacloud-tea-openapi<1.0.0,>=0.4.1runtime
darabonba-core
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
darabonba-core<2.0.0,>=1.0.0runtime
rich
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
rich>=13.0.0runtime
pytest-asyncio
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pytest-asyncio>=0.21.0; extra == "dev"runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pytest>=7.0.0; extra == "dev"runtime

Distribution files

2 collected
agent_identity_cli-0.1.1-py3-none-any.whl

bdist_wheel · 14.8 KB · Python py3

Source file
agent_identity_cli-0.1.1.tar.gz

sdist · 12.64 KB · Python source

Source file

Repository

PENDING
aliyun/agent-identity-dev-kit

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:26 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:a7a7cd109fe24bbbf709bef71d972e2630ea10093008eddee8c35d672b5c1c8f

Other collected versions

View all collected versions →