Bridges

customTools

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.

4 categoriesdescription is requiredwrite by default
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

Declaring one

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 } };
      },
    },
  },
});
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,
        },
    },
)
descriptionstringrequired

All the model knows about the tool. An empty one is refused.

runfunctionrequired

(args, { signal }) => string | { output, summary?, meta? }.

categorystringwrite

read · write · storage · exec.

parametersobject{}

What the model may send, in the same shape the built-in tools use.

The category is a real decision

ChooseWhenConsequence
readIt only looksNever asked, and runs in parallel with other reads
writeIt changes something recoverableAsked in ask, free in auto
storageIt changes something with no undoAsked even in auto, « always » per target
execIt runs something arbitraryAsked 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

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

ReturnedBecomes
A stringThe 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

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.