# plan

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

`mode: "plan"`

Read-only, and the agent knows it: it is told to investigate and present a plan rather than attempt changes. The only mode that changes how it thinks, not just what it is asked.

Status: nothing is changed · refused before the callback · todo_write is the output

Every category but `read`, `memory` and `task` is refused outright — the callback is not even consulted, since there is nothing to decide. The refusal names the mode and says the user will switch it to execute.

```javascript
// What the model receives when it tries to write in plan mode
"Refused: plan mode is read-only. Present the plan; the user will switch mode to execute it."
```

## The instruction is the real feature {#instruction}

> **A refusal after the attempt costs a turn; an instruction before it costs nothing**
>
> The system prompt tells the agent, in plan mode, to investigate and then present a clear plan with todo_write. So it spends its steps reading and reasoning instead of discovering one refusal at a time.

## What it can still do {#available}

- Read, list, glob and grep the whole workspace.
- Search the web and open pages.
- Read connected storages with `query_storage`.
- Read its long-term notes, and search earlier sessions with `recall`.
- Delegate investigation to subagents — `task` is allowed, and its children are in plan mode too.
- Write a plan with `todo_write`.

## The two-phase pattern {#pattern}

```javascript
const agent = api.agents.create({
  runtime: "local", machine: pc, model: "gemini-3.5-flash",
  memory: true,                // so the plan survives into the second phase
  mode: "plan",
});

const plan = await agent.run({ inputs: "Migrate the date handling to UTC everywhere." });
console.log(plan.text, plan.todos);

// The person reads it and agrees
agent.setMode("auto");
await agent.run({ inputs: "Do it." });
```

With `memory: true` the second run already holds everything the first one read, so the plan is executed without re-investigating.

## Nothing is spent beyond the turns {#money}

`money` is refused like the rest, so a plan-mode run cannot buy space. Paid *reads* — a search, a page capture — are `read` and still happen, so a planning run is not free.

- [todo_write](/sdk/agent/tools/todo-write): Where a plan is written.
- [auto](/sdk/agent/modes/auto): The usual mode to switch to.
- [Sessions](/sdk/agent/sessions): Keeping the investigation between the two runs.

```python
# What the model receives when it tries to write in plan mode
"Refused: plan mode is read-only. Present the plan; the user will switch mode to execute it."
```

```python
agent = api.agents.create(
    runtime="local", machine=pc, model="gemini-3.5-flash",
    memory=True,                 # so the plan survives into the second phase
    mode="plan",
)

plan = agent.run(inputs="Migrate the date handling to UTC everywhere.")
print(plan["text"], plan["todos"])

# The person reads it and agrees
agent.set_mode("auto")
agent.run(inputs="Do it.")
```
