# customTools

Canonical URL: https://developers.iagenify.com/sdk/agent/bridges/custom-tools/
Language: en

`customTools: { name: { description, parameters, category, run } }`

Tools of your own, declared beside the 35. They are permissioned, counted and shown exactly like the built-in ones.

Status: 4 categories · description is required · write by default

## Declaring one {#shape}

```javascript
const agent = api.agents.create({
  runtime: "local", machine: pc, model: "gemini-3.5-flash",
  customTools: {
    open_ticket: {
      description: "Open a ticket in our tracker. Returns its number and URL.",
      category: "write",
      parameters: {
        title:  { type: "string", required: true },
        body:   { type: "string" },
        labels: { type: "array", items: { type: "string" } },
      },
      async run({ title, body, labels }, { signal }) {
        const ticket = await tracker.create({ title, body, labels }, { signal });
        return { output: `Opened #${ticket.number}: ${ticket.url}`, summary: `#${ticket.number}`, meta: { url: ticket.url } };
      },
    },
  },
});
```

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `description` | string | required | **All the model knows about the tool.** An empty one is refused. |
| `run` | function | required | `(args, { signal }) => string \| { output, summary?, meta? }`. |
| `category` | string | write | `read` · `write` · `storage` · `exec`. |
| `parameters` | object | {} | What the model may send, in the same shape the built-in tools use. |

## The category is a real decision {#category}

| Choose | When | Consequence |
| --- | --- | --- |
| read | It only looks | Never asked, and runs in parallel with other reads |
| `write` | It changes something recoverable | Asked in ask, free in auto |
| `storage` | It changes something with no undo | Asked even in auto, « always » per target |
| exec | It runs something arbitrary | Asked in everything but full |

> **read is the one to be careful with**
>
> It is never asked and runs in parallel. A tool that sends, publishes or spends must not be declared read — and the three always-asked categories are not available to custom tools, so anything of that kind belongs in your own code, before the run.

## Names {#names}

Lowercase letters, digits and underscores, starting with a letter. A name belonging to a built-in tool — including `skill` and `task` — is refused with `invalid_custom_tool` rather than shadowing it.

## What run may return {#returning}

| Returned | Becomes |
| --- | --- |
| A string | The output. No summary. |
| `{ output }` | The output. Anything that is not a string is serialised as JSON. |
| `{ output, summary }` | Plus the line shown on `tool_end`. |
| `{ output, summary, meta }` | Plus whatever you want your interface to have. |

Throwing is fine: it becomes a failed tool result with your message, and the model adapts. The `signal` fires when the run is stopped — honour it on anything slow.

## They cost tokens, every turn {#cost}

A declaration is sent with every turn, so each custom tool adds to every step's bill. Declare what this run may actually call, not everything your application can do.

- [Categories](/sdk/agent/permissions/categories): What each one opens.
- [Options · tools and library](/sdk/ref/agents/options/tools): Choosing the built-in set alongside.

```python
def open_ticket(args):
    ticket = tracker.create(title=args["title"], body=args.get("body"), labels=args.get("labels") or [])
    return {"output": f"Opened #{ticket.number}: {ticket.url}"}

agent = api.agents.create(
    runtime="local", machine=pc, model="gemini-3.5-flash",
    tools={
        "open_ticket": {
            "description": "Open a ticket in our tracker. Returns its number and URL.",
            "category": "write",
            "parameters": {
                "type": "object",
                "properties": {
                    "title": {"type": "string"},
                    "body": {"type": "string"},
                    "labels": {"type": "array", "items": {"type": "string"}},
                },
                "required": ["title"],
            },
            "run": open_ticket,
        },
    },
)
```
