# ask

Canonical URL: https://developers.iagenify.com/sdk/agent/modes/ask/
Language: en

`mode: "ask"`

The default. Reading is free; everything that changes anything comes to your callback first, with the arguments in hand.

Status: the default · reads are free · always for a first run

This is the mode to use when you do not yet know what an agent will do with a task — which is most first runs, and every run on material you did not write.

## What is asked {#what}

| Category | In ask mode |
| --- | --- |
| `read` · `memory` · `task` | allowed, never asked |
| `write` | asked — and `always` remembers that tool for the session |
| exec | asked — `always` on a plain command is written to disk |
| `storage` | asked — `always` is per storage, for the session |
| `dns` | asked — `always` is per domain, for the session |
| `send` · `publish` · `money` | asked every time, no `always` |

```javascript
const agent = api.agents.create({
  runtime: "local",
  machine: pc,
  model: "gemini-3.5-flash",
  mode: "ask",
  onPermission: async ({ tool, category, args }) => {
    if (category === "exec") return "deny";          // no commands at all
    if (tool === "write" && args.path.startsWith("src/")) return "always";
    return "once";
  },
});
```

## Without a callback it can only read {#no-callback}

> **No onPermission means every change is refused**
>
> The refusal is explicit — « this action needs the user's approval and no one can approve it » — and it goes back to the model, which adapts. So an agent in ask mode with no callback behaves close to plan mode, without saying so in its instructions.

## A refusal is information {#refusals}

`deny` is not an error: the tool returns « Refused by the user. » as its result and the loop continues. The model is told not to retry a refused tool, and to adapt or explain instead.

## Where to go from here {#moving}

- Repetitive edits on a project you trust → [auto](/sdk/agent/modes/auto).
- You want a plan before anything moves → [plan](/sdk/agent/modes/plan).
- A watched run where you approve as you go → stay here.

- [Permissions](/sdk/agent/permissions): The callback, its answers, and where « always » is kept.
- [auto](/sdk/agent/modes/auto): The next step up.

```python
def on_permission(request):
    if request["category"] == "exec":
        return "deny"                                   # no commands at all
    if request["tool"] == "write" and request["args"].get("path", "").startswith("src/"):
        return "always"
    return "once"

agent = api.agents.create(
    runtime="local",
    machine=pc,
    model="gemini-3.5-flash",
    mode="ask",
    on_permission=on_permission,
)
```
