# setActiveTools()

Select the active tools for a turn from the deployment's allowed tool surface.

Call `pi.setActiveTools()` inside `before_agent_start`:

```js
pi.on('before_agent_start', async (_event, ctx) => {
  if (ctx.external?.conversationType === 'channel') {
    await pi.setActiveTools(['read', 'grep', 'lookup_customer']);
  }
});
```

## Rules

* Pass an array containing at most 256 unique names.
* Names must be non-empty, trimmed strings.
* Every name must belong to the deployment's allowed built-in or extension tool set.
* An empty array intentionally disables all tools.

The method resolves to `true` when the selection is structurally accepted. Invalid selections throw. Salambo rejects names that are unavailable in the pinned deployment.

## Lifecycle

The hosted runtime applies active-tool selection from `before_agent_start`. Do not call this method during module discovery.

The resulting set is persisted with session state and restored on durable follow-up turns. The tools discovered from the deployed `.pi/extensions/` modules remain the default for new sessions.
