# estimate_text_tokens

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/context_doctor/estimate_text_tokens)

Estimate tokens using the same four-characters-per-token rule as whip.

## Signature

```python
estimate_text_tokens(
    text: str,
) -> int
```

## Returns

`int`

Estimated token count.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/2069079e09546060f5b52b2cd4f0e3c813e820f3/libs/code/deepagents_code/context_doctor.py#L41)