> ## 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

<div className="flex items-center gap-2">
  <Badge color="teal">Function</Badge>
</div>

> This function is defined in the [**protocols**](../modules/protocols) 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

<ParamField query="user_id" type="Any" required={true}>
  No description available.
</ParamField>

<ParamField query="agent_id" type="Any" required={true}>
  No description available.
</ParamField>

<ParamField query="run_id" type="Any" required={true}>
  No description available.
</ParamField>

<ParamField query="operation" type="str" required={false} default="'operation'">
  No description available.
</ParamField>

<ParamField query="backend" type="str" required={false}>
  No description available.
</ParamField>

### Exceptions

<AccordionGroup>
  <Accordion title="ScopeRequiredError">
    If none of user\_id/agent\_id/run\_id is provided.
  </Accordion>
</AccordionGroup>

## Uses

* `ScopeRequiredError`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/knowledge/protocols.py#L202">
  `praisonaiagents/knowledge/protocols.py` at line 202
</Card>
