> ## Documentation Index
> Fetch the complete documentation index at: https://infisical.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Remove users and groups

> Remove users and groups from an Agent Vault delegation with the Python SDK.

`client.agent_vault.delegations.remove_subjects()` removes users and groups from a machine identity's delegation. Pass at least one ID. The client must log in as a user or machine identity with the **Admin** role in the [Agent Vault project](https://infisical.com/docs/documentation/platform/agent-vault/access-control#product-membership).

* If the delegation no longer covers a user, the proxy refuses the sessions that the machine identity created on behalf of the user until the delegation covers the user again (to end those sessions for good, [revoke them](https://infisical.com/docs/sdks/languages/python/agent-vault/revoke-session.md))
* If you remove the last user or group, Infisical deletes the delegation

## Parameters

**project\_id** `str` *required*

The ID of the [Agent Vault project](https://infisical.com/docs/documentation/platform/agent-vault/projects.md#find-the-project-id) that the delegation is in.

**machine\_identity\_id** `str` *required*

The ID of the machine identity.

**user\_ids** `List[str]`

The IDs of the users to remove (up to 100).

**group\_ids** `List[str]`

The IDs of the groups to remove (up to 100).

## Returns

**delegation** `Optional[AgentVaultDelegation]`

The delegation after the change, with `missingAccessBundles`, or `None` if Infisical deleted the delegation.

```python Basic theme={"dark"}
delegation = client.agent_vault.delegations.remove_subjects(
    project_id="<project-id>",
    machine_identity_id="<machine-identity-id>",
    user_ids=["<user-id>"],  # Optional
    group_ids=["<group-id>"],  # Optional
)
```

```json Response theme={"dark"}
null
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.