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

# Removing Tools

> Remove tools from agents and tasks by name, object reference, or both

## Removing Tools from Agent

### By Name (String)

```python theme={null}
agent.remove_tools("add")
agent.remove_tools(["add", "multiply"])
```

### By Object Reference

```python theme={null}
agent.remove_tools(multiply)
agent.remove_tools([add, multiply])
```

### Mixed (Name + Object)

```python theme={null}
agent.remove_tools([add, "multiply"])
agent.remove_tools(["add", multiply])
```

### Complete Agent Example

```python theme={null}
from upsonic import Agent, Task
from upsonic.tools import tool

@tool
def add(a: int, b: int) -> int:
    """Add two numbers."""
    return a + b

@tool
def multiply(a: int, b: int) -> int:
    """Multiply two numbers."""
    return a * b

agent = Agent("anthropic/claude-sonnet-4-5", tools=[add, multiply])

# Use both tools
task1 = Task(description="What is 5 + 3?")
result = agent.print_do(task1)
print("Result:", result)

# Remove add, keep multiply
agent.remove_tools("add")

# Now only multiply is available
task2 = Task(description="What is 6 * 7?")
result = agent.print_do(task2)
print("Result:", result)
```

## Removing Tools from Task

Removing tools from tasks requires the **agent reference**:

```python theme={null}
from upsonic import Agent, Task
from upsonic.tools import tool

@tool
def add(a: int, b: int) -> int:
    """Add two numbers."""
    return a + b

@tool
def multiply(a: int, b: int) -> int:
    """Multiply two numbers."""
    return a * b

agent = Agent("anthropic/claude-sonnet-4-5")
task = Task(description="Calculate 5 + 3", tools=[add, multiply])

# Remove from task (requires agent reference)
task.remove_tools("multiply", agent)

result = agent.print_do(task)
print("Result:", result)
```

### Task Removal Methods

```python theme={null}
task.remove_tools("add", agent)                  # By name
task.remove_tools(multiply, agent)               # By object
task.remove_tools([add, "multiply"], agent)       # Mixed
```

## Key Points

* **Remove by name**: Works for all tool types
* **Remove by object**: Removes entire container (ToolKit/Class/MCP/Agent) or single function
* **Mixed removal**: Combine names and objects in one call
* **Agent tools**: Removed from all future tasks
* **Task tools**: Requires agent reference for removal
