> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Calculator Tools

> Solve step-by-step arithmetic with CalculatorTools, filtering functions via include and exclude lists.

```python calculator_tools.py theme={null}
"""
Calculator Tools
=============================

Demonstrates calculator tools.
"""

from agno.agent import Agent
from agno.tools.calculator import CalculatorTools

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------


# Example 1: Include specific calculator functions for basic operations
basic_calc_agent = Agent(
    tools=[CalculatorTools(include_tools=["add", "subtract", "multiply", "divide"])],
    markdown=True,
)

# Example 2: Exclude advanced functions for simple use cases
simple_calc_agent = Agent(
    tools=[CalculatorTools(exclude_tools=["factorial", "is_prime", "exponentiate"])],
    markdown=True,
)

# Example 3: Full calculator functionality (default)
agent = Agent(
    tools=[CalculatorTools()],
    markdown=True,
)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    simple_calc_agent.print_response(
        "What is 10*5 then to the power of 2, do it step by step"
    )
```

## Run the Example

<Snippet file="create-venv-step.mdx" />

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno openai
```

**2. Export your OpenAI API key**

```bash Mac/Linux theme={null}
export OPENAI_API_KEY="your_openai_api_key_here"
```

```bash Windows theme={null}
$Env:OPENAI_API_KEY="your_openai_api_key_here"
```

**3. Run the example**

Save the code above as `calculator_tools.py`, then run:

```bash theme={null}
python calculator_tools.py
```

Full source: [cookbook/91\_tools/calculator\_tools.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/91_tools/calculator_tools.py)


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