---
question: How do I attach tools in Agent.New()?
kind: task
via_web: na
via_cli: na
via_python: available
via_api: na
via_config: na
ref_python: tools=[...]
prereq: The agent is an engine agent, a class with a `New()` method. See [Create an agent](/user-guide/build/agents/creating-an-agent?via=python).
next:
  - /capabilities/build/agents/add-sub-agents
  - /capabilities/build/agents/test-an-agent
  - /capabilities/build/tools/overview
---

# Give it tools

A tool is a function the model can call. An engine agent gets its tools in `New()`, from workflows, from integrations, or from plain functions. A workspace agent has none.

## Web UI

Not applicable. Edit Agent lists an agent's **Tools** read-only, and a workspace agent has none: attach tools in `New()` with the Python steps.

## CLI

Not applicable. There is no `abi new tool` command, and no command attaches a tool: use the Python steps.

## Python

Every step below goes inside `New()`, imports included. The engine takes every `Expose` class of your package that an `agents/` file holds, workflows included, for an agent and calls its `New()`: a workflow imported at the top of the file breaks the API's startup.

### Get tools from a workflow

A workflow returns its tools with `as_tools()`:

```python title="agents/ReviewerAgent.py"
    @classmethod
    def New(cls, agent_shared_state=None, agent_configuration=None) -> "ReviewerAgent":
        from my_module.workflows.CustomersWorkflow import (
            CustomersWorkflow,
            CustomersWorkflowConfiguration,
        )

        tools: list = []
        tools += CustomersWorkflow(CustomersWorkflowConfiguration()).as_tools()
```

### Get tools from an integration

By convention, an integration file has a module-level `as_tools(configuration)`. Skip it when its key is missing:

```python title="agents/ReviewerAgent.py"
        from my_module import ABIModule
        from my_module.integrations.MyIntegration import MyIntegrationConfiguration, as_tools

        api_key = ABIModule.get_instance().configuration.my_api_key
        if api_key:
            tools += as_tools(MyIntegrationConfiguration(api_key=api_key))
```

### Or write a function

Any LangChain tool works. The model picks a tool from its name and docstring. A `@tool` function is an object, not a class, so it can live at the top of the file:

```python title="agents/ReviewerAgent.py"
from langchain_core.tools import tool


@tool
def count_words(text: str) -> int:
    """Count the words in a text."""
    return len(text.split())
```

Then, in `New()`:

```python title="agents/ReviewerAgent.py"
        tools.append(count_words)
```

### Pass them to the agent

Give the list to the constructor at the end of `New()`. The scaffold also writes each tool's name and description into the system prompt, in place of `[TOOLS]`:

```python title="agents/ReviewerAgent.py"
        return cls(
            name=cls.name,
            description=cls.description,
            chat_model=chat_model,
            tools=tools,
            agents=agents,
            memory=None,
            state=agent_shared_state,
            configuration=agent_configuration,
        )
```

Restart the engine to load the change.

## REST API

Not applicable. No HTTP call attaches a tool: the list is built in `New()`. Module tools with a `run` get their own route, on [Tools](/user-guide/build/tools/overview#module-tools).

## Config

Not applicable. `config.yaml` does not list an agent's tools; it holds the keys integrations need ([Add credentials](/user-guide/build/integrations/add-credentials)).

## What the agent always has

Besides the tools you pass, every agent gets default tools, and one `transfer_to_<name>` tool per sub-agent. The chat model has to support tool calling. See the key concepts on [Tools](/user-guide/build/tools/overview#key-concepts).
