---
title: Custom Tools
slug: custom-tools
---

The Agent SDK supports defining custom Python tools that run securely in sandboxed environments on remote Cua Computers. This enables safe execution of user-defined functions, isolation of dependencies, and robust automation workflows.

## Custom Tools

Define a custom tool for an agent:

```python
def calculate(a: int, b: int) -> int:
    """Calculate the sum of two integers"""
    return a + b

# Use with agent
agent = ComputerAgent(
    model="cua/anthropic/claude-sonnet-4.5",
    tools=[computer, calculate]
)
```

## Sandboxed Tools

Define a sandboxed tool:

```python
from computer.helpers import sandboxed

@sandboxed()
def read_file(location: str) -> str:
    """Read contents of a file"""
    with open(location, 'r') as f:
        return f.read()
```

You can then register this as a tool for your agent:

```python
from agent import ComputerAgent
from computer import Computer

computer = Computer(...)
agent = ComputerAgent(
    model="cua/anthropic/claude-sonnet-4.5",
    tools=[computer, read_file],
)
```
