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

# Dynamic turns

> Change the model, instructions, tools, and sampling settings between Go agent turns.

Dynamic turn callbacks let routing react to run state without rebuilding the agent. They run before each model request and receive the current turn context.

```go theme={null}
agent := phaseoagent.CreateAgent(phaseoagent.AgentDefinition{
  ID: "support-agent",
  DynamicModel: func(turn phaseoagent.TurnContext) string {
    if turn.Run.StepCount > 3 { return "openai/gpt-5.4" }
    return "openai/gpt-5.4-nano"
  },
  DynamicInstructions: func(turn phaseoagent.TurnContext) string {
    return fmt.Sprintf("Resolve the request. Current context: %v", turn.Context)
  },
})
```

You can also configure dynamic tools and per-turn `Temperature`, `MaxOutputTokens`, and `TopP` values.

## Let a tool influence the next turn

Set `NextTurn` on a tool to change the immediately following model request. These overrides are stored in paused state, so they survive an approval checkpoint, and expire after the next turn.

Use dynamic callbacks for policy that should be recalculated every turn. Use `NextTurn` for a tool-specific handoff such as switching models after repository inspection.
