Skip to main content

User SDK reference

User SDK reference

Customer-hosted cloud features

note

Some features are only available on customer-hosted clouds. Reach out to support@anyscale.com for info.

User SDK

anyscale.user.list

List collaborators within the organization.

Arguments

  • email (str | None) = None: Filter collaborators by exact email address.
  • name (str | None) = None: Filter collaborators by exact display name.
  • collaborator_type (str | None) = None: Filter by collaborator type. Accepts values such as 'all_accounts', 'only_service_accounts', or 'only_user_accounts'.
  • is_service_account (bool | None) = None: If provided, filter collaborators by whether they are service accounts.
  • max_items (int | None) = None: Maximum total number of users to yield (default: iterate all).
  • page_size (int | None) = None: Number of users fetched per API request (default: API default).

Returns: ResultIterator[User]

Examples

import anyscale

for user in anyscale.user.list(max_items=10):
print(user.email)

anyscale.user.get

Retrieve a single collaborator by email or name.

Arguments

  • email (str | None) = None: Email address of the user to retrieve.
  • name (str | None) = None: Display name of the user to retrieve.
  • collaborator_type (str | None) = None: Optional collaborator type constraint when fetching the user.
  • is_service_account (bool | None) = None: Filter by whether the user is a service account.

Returns: User

Examples

import anyscale

user = anyscale.user.get(email="owner@anyscale.com")
print(user.permission_level)

User models

User

Collaborator returned by anyscale.user APIs.

Fields

  • email (str): Email address associated with the collaborator.
  • name (str): Display name of the collaborator.
  • created_at (datetime): Timestamp for when the collaborator was created.
  • permission_level (str): Organization permission level for the collaborator.
  • user_id (str | None): Optional user ID backing the collaborator (may be absent for service accounts).

Python Methods

def to_dict(self) -> Dict[str, Any]
"""Return a dictionary representation of the model."""

Examples

import anyscale

for user in anyscale.user.list(max_items=5):
print(f"{user.email} ({user.permission_level})")