Modes

ask

mode: "ask"

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

the defaultreads are freealways for a first run
Using Python?

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

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

CategoryIn ask mode
read · memory · taskallowed, never asked
writeasked — and always remembers that tool for the session
execasked — always on a plain command is written to disk
storageasked — always is per storage, for the session
dnsasked — always is per domain, for the session
send · publish · moneyasked every time, no always
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";
  },
});
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,
)

Without a callback it can only read

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

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

  • Repetitive edits on a project you trust → auto.
  • You want a plan before anything moves → plan.
  • A watched run where you approve as you go → stay here.