---
title: "Tools"
description: "Register custom tools and control access for each agent."
---

The current manifest format has no version number. Each agent's model, tool rules and resource grants live in its `agents.<name>` block in `beeuni.yaml`. Write its prompt inline with `prompt`, or use `prompt_file` to point to `agents/<name>.md`.

<a id="builtin-tools"></a>
<a id="beeuni-tools-in-beeuniyaml"></a>

## Built-in tools

The built-in tools are `web_search`, `image_search`, `image_gen`, `scrape_webpage`, `memory` and `show`. They need no registry entry in the current format. Connected application actions are accessed through `beeuni connectors`; connector grants control access. Harness tools such as `read`, `edit`, `bash` and `task` are separate.

## Image generation

`image_gen` generates or edits images with an image model the project can use. Ask for an image in chat; the agent chooses the tool, and the reply shows the results. Files are saved under `output/images/` in the session workspace.

A call accepts up to four prompts. For edits, reference PNG, JPEG or WebP files inside the workspace. The tool limits generation to 10 images per turn and 50 per session. To disable it for an agent, set `image_gen: deny` in that agent's `permission` block. Model availability and credentials are resolved by the gateway; adding the tool does not provide access to an image model.

<a id="register-project-tools"></a>

## Register a tool

A tool name uses snake_case, up to 64 characters. Do not use a harness tool name or the `pty_` prefix. A module path is repository-relative and ends in `.ts`, `.js`, `.mts`, `.mjs`, `.cts` or `.cjs`. The current format rejects `beeuni:<name>` values: built-in tools need no entry.

```yaml
default_agent: assistant
env:
  required: [ORDERS_API_KEY]
tools:
  lookup_order: tools/lookup_order.ts
agents:
  assistant:
    prompt: Answer order questions using lookup_order.
    tools: [lookup_order, web_search]
    secrets: [ORDERS_API_KEY]
```

<a id="write-a-project-tool"></a>

## Write a project tool

```bash
beeuni secrets set ORDERS_API_KEY=-
```

Export an object with a non-empty `description`, a JSON Schema object in `parameters`, and `execute(args, context)`. Return text or a JSON value; throw an error with a useful message on failure. `context` provides `sessionId`, `agent`, `directory`, `env` and `signal`. Read current secret values from `context.env`, and pass `context.signal` to requests so stopping a turn cancels them.

```ts
// tools/lookup_order.ts
export default {
  description: 'Look up an order by id. Returns its status and carrier.',
  parameters: {
    type: 'object',
    properties: { id: { type: 'string', description: 'The order id' } },
    required: ['id'],
  },
  async execute(args, context) {
    const key = context.env.ORDERS_API_KEY
    if (!key) throw new Error('ORDERS_API_KEY is not set')
    const response = await fetch(
      `https://orders.example.com/v1/orders/${encodeURIComponent(args.id)}`,
      {
        headers: { authorization: `Bearer ${key}` },
        signal: context.signal,
      },
    )
    if (!response.ok) throw new Error(`orders API answered ${response.status}`)
    return await response.json()
  },
}
```

TypeScript runs without a build step. Use `fetch`, `node:*` modules and relative imports. External packages must already resolve in the project; tools do not install dependencies. A module that fails to load is left out while the others still load. Large outputs are saved to a file and the model receives an excerpt and its path.

<a id="eject-or-override-a-beeuni-tool"></a>

## Override a Beeuni tool

A project module with a Beeuni tool name replaces that tool. `beeuni tools eject web_search` copies its source into the project and updates the registry. Beeuni no longer updates the copy. To return to the maintained tool, remove its registry entry and module. Keep the arguments and output shape when overriding a tool so its UI still renders correctly.

```bash
beeuni tools eject web_search
```

<a id="who-may-use-which-tool"></a>

<a id="give-each-agent-its-tools"></a>

## Tool access

An agent’s `tools` accepts `all`, `none`, a list or `{ exclude: [...] }`. Unknown tool names and the old `{ bash: false }` map are errors in the current format. On pi, a subagent receives the intersection of its tools and its parent’s tools. OpenCode applies the subagent’s own list. On OpenCode, `bash` includes terminal tools, and `write`, `edit` and `apply_patch` share a permission group.

```yaml
agents:
  assistant:
    tools: "*"
  researcher:
    tools: [read, grep, web_search, lookup_order]
  reviewer:
    tools:
      exclude: [bash, write, edit]
  greeter:
    tools: none
```

`tools` controls which tools the model sees. `permission` controls whether a visible tool call runs (`allow`), waits for approval (`ask`) or is refused (`deny`). File and shell rules can match patterns. In the current format, do not set `permission.skill` or `permission.task`: use `skills` and `subagents`.

<a id="agents-without-the-project-repository"></a>

## Without a repository

Allowed project tools load with their transitive relative imports; other repository files and `node_modules` are not included. `context.directory` remains `/workspace`. Clone the project explicitly when a tool needs its files.

<a id="test-a-tool"></a>

## Check the result

```bash
beeuni validate
beeuni tools ls
beeuni tools ls --json
beeuni sessions new --wait --prompt "Call lookup_order once with id A-1042 and print its output."
```

Merge configuration changes into the project’s default branch. New sessions use them, and running sessions pick up supported changes through configuration reload. A new agent cannot run before its declaration reaches the default branch. See [Runtime](/docs/work/runtime#config-convergence).

<a id="legacy-versions"></a>

## Legacy versions

Versions 1 (`beeuni.toml`) and 2 still run. Use **Customize → Upgrades** or `beeuni projects upgrade` to ask an agent to convert the project to the current format and open a change request. Review the result before merging. `beeuni migrate` previews the conversion without changing files. Use `beeuni migrate --write` to apply it, then run `beeuni validate`. See [Legacy TOML](/docs/project/legacy-toml).
