17 pages for maxturns.
Titles and paths first, then pages whose text carries it. Each row opens that page as this site last read it.
advisor-tool
Claude Developer Platform · in the page
agents-and-tools/tool-use/advisor-tool
…dvisor " + "now before committing to an approach."; const int MaxTurns = 10; // agent loop cap // Replace with your tool dispatch. Returns one tool_result block per tool_use block. List<B…
How the agent loop works
Claude Code CLI · in the page
agent-sdk/agent-loop
…e final text-only response. You can cap the loop with `max_turns` / `maxTurns`, which counts tool-use turns only. For example, `max_turns=2` in the loop above would have stopped before the edit step.…
Configure your agent
Claude Code CLI · in the page
agent-sdk/configuration
…edTools` / `allowed_tools`**: pre-approves a read-only tool list * **`maxTurns` / `max_turns`**: caps the turn count * **`cwd`**: sets the working directory <CodeGroup> ```typescript TypeScript the…
Hosting the Agent SDK
Claude Code CLI · in the page
agent-sdk/hosting
…ASK_PROMPT!; for await (const message of query({ prompt, options: { maxTurns: 20 } })) { console.log(message); } ``` ```python Python theme={null} import asyncio import os from cla…
Plugins in the SDK
Claude Code CLI · in the page
agent-sdk/plugins
…ns: { plugins: [{ type: "local", path: pluginPath }], maxTurns: 3 } })) { if (message.type === "system" && message.subtype === "init") { console.log("Loaded plu…
Agent SDK reference - Python
Claude Code CLI · in the page
agent-sdk/python
…ict[str, Any]] | None = None initialPrompt: str | None = None maxTurns: int | None = None background: bool | None = None effort: EffortLevel | int | None = None permissionMode: Per…
Work with sessions
Claude Code CLI · in the page
agent-sdk/sessions
…ions: { resume: sessionId, forkSession: true, maxTurns: 5 } })) { if (message.type === "system" && message.subtype === "init") { forkedId = message.sess…
Extend agents with skills
Claude Code CLI · in the page
agent-sdk/skills
…(const message of query({ prompt: "Hello Claude", options: { maxTurns: 1 } })) { if (message.type === "system" && message.subtype === "init") { console.log("Available commands:",…
Streaming Input
Claude Code CLI · in the page
agent-sdk/streaming-vs-single-mode
…ssage of query({ prompt: generateMessages(), options: { maxTurns: 10, allowedTools: ["Read", "Grep"] } })) { if (message.type === "result" && message.subtype === "success…
Subagents in the SDK
Claude Code CLI · in the page
agent-sdk/subagents
…in thread agent. Ignored when the agent is invoked as a subagent | | `maxTurns` | `number` | No | Maximum number of agentic turns before the agent stops. When the agent reaches the limit, Claude Code…
Track todos
Claude Code CLI · in the page
agent-sdk/todo-tracking
…ls where Claude Code otherwise doesn't provide them. options: { maxTurns: 15, permissionMode: "acceptEdits", env: { ...process.env, CLAUDE_CODE_ENABLE_TODO_TOOLS: "1" } }, })) { if (me…
Agent SDK reference - TypeScript
Claude Code CLI · in the page
agent-sdk/typescript
…// Pay startup cost upfront const warm = await startup({ options: { maxTurns: 3 } }); // Later, when a prompt is ready, this is immediate for await (const message of warm.query("What files are here…
Explore the .claude directory
Claude Code CLI · in the page
claude-directory
…description`, `tools`, `disallowedTools`, `model`, `permissionMode`, `maxTurns`, `skills`, `mcpServers`, `hooks`, `memory`, `background`, `effort`, `isolation`, `color`, `initialPrompt`, `omitClaudeMd…
Add components to a plugin
Claude Code CLI · in the page
plugins/components
…: * **Supported fields**: `name`, `description`, `model`, `effort`, `maxTurns`, `tools`, `disallowedTools`, `skills`, `memory`, `background`, `omitClaudeMd`, `isolation`, `color`, and the `cacheTtl`…
Create custom subagents
Claude Code CLI · in the page
sub-agents
…`disallowedTools`, `model`, `permissionMode`, `mcpServers`, `hooks`, `maxTurns`, `skills`, `initialPrompt`, `memory`, `effort`, `background`, `omitClaudeMd`, and `isolation`. * **Ignored fields**: `co…
Tools reference
Claude Code CLI · in the page
tools-reference
…n by returning a result. To cap how many turns a subagent runs, set `maxTurns` in the [subagent definition](/docs/en/sub-agents#supported-frontmatter-fields). When the subagent reaches the limit, Cla…
Week 35 · August 24–28, 2026
Claude Code CLI · in the page
whats-new/2026-w35
…t and no tool calls</div> <div>A subagent that stops at its <code>maxTurns</code> limit returns its output marked as partial, with a hint that Claude can <a href="/docs/en/sub-agents#resume-subage…