> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# PermissionHandler

> Decide what to do with an agent permission request (e.g.

Decide what to do with an agent permission request (e.g. running a shell
command). Return one of `request.options` (or its `optionId`), or the
shorthands `"allow"` / `"reject"` for a one-shot decision (the `_once`
option variant when offered).

Set client-wide as a default for every session, or per session via
`createSession({ onPermission })` / `session.onPermission` — the session
handler wins. `request.call` carries the merged snapshot of the gated tool
call (title, kind, `rawInput`, …).

```typescript
type PermissionHandler = (request: PermissionRequest) => string | Promise<string> | { optionId: string } | Promise<{ optionId: string }>
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.