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

# Camel.terminators.token limit terminator

<a id="camel.terminators.token_limit_terminator" />

<a id="camel.terminators.token_limit_terminator.TokenLimitTerminator" />

## TokenLimitTerminator

```python theme={"system"}
class TokenLimitTerminator(BaseTerminator):
```

Terminate agent if number of tokens reached to token limit threshold.

**Parameters:**

* **token\_limit** (int): Token limit threshold.

<a id="camel.terminators.token_limit_terminator.TokenLimitTerminator.__init__" />

### **init**

```python theme={"system"}
def __init__(self, token_limit: int):
```

<a id="camel.terminators.token_limit_terminator.TokenLimitTerminator._validate" />

### \_validate

```python theme={"system"}
def _validate(self):
```

<a id="camel.terminators.token_limit_terminator.TokenLimitTerminator.is_terminated" />

### is\_terminated

```python theme={"system"}
def is_terminated(self, num_tokens: int):
```

Whether terminate the agent by checking number of
used tokens reached to token limit.

**Parameters:**

* **num\_tokens** (int): Number of tokens.

**Returns:**

tuple: A tuple containing whether the agent should be
terminated and a string of termination reason.

<a id="camel.terminators.token_limit_terminator.TokenLimitTerminator.reset" />

### reset

```python theme={"system"}
def reset(self):
```

Reset the terminator.
