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

# Require Scope • AI Agent SDK

> require_scope: Enforce that at least one scope identifier is provided.

# require\_scope

Function

> This function is defined in the [**protocols**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/protocols.md) module.

Enforce that at least one scope identifier is provided.

Shared helper so every knowledge adapter enforces the same tenant-scope
contract (mem0 already did via its own `_check_scope`). Without this, an
unscoped call that raises `ScopeRequiredError` on the mem0 backend would
silently return or wipe *every* tenant's data on the Chroma/SQLite backends
— a data-loss/leak hazard depending purely on which backend is installed.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def require_scope(user_id: Any, agent_id: Any, run_id: Any, operation: str, backend: str) -> None
```

## Parameters

**user\_id** `Any` *required*

No description available.

**agent\_id** `Any` *required*

No description available.

**run\_id** `Any` *required*

No description available.

**operation** `str` (default: 'operation')

No description available.

**backend** `str`

No description available.

### Exceptions

> [accordion] ScopeRequiredError
>
> If none of user\_id/agent\_id/run\_id is provided.

## Uses

* `ScopeRequiredError`

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/knowledge/protocols.py#L202)
>
> `praisonaiagents/knowledge/protocols.py` at line 202


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