16 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 for each tool_use block. L…
migration
Claude Developer Platform · in the page
managed-agents/migration
…, it runs without reaching your client. | | `max_turns` (typescript: `maxTurns`) | Count turns client-side. | ## Migration checklist 1. [Create an environment](https://platform.claude.com/docs/en/ma…
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`. Count each turn with tool calls, plus one for the final text-only response. Without that extra turn, the run ends with…
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 ```typescript TypeScript theme={null} impo…
Hosting the Agent SDK
Claude Code CLI · in the page
agent-sdk/hosting
….TASK_PROMPT!; for await (const message of query({ prompt, options: { maxTurns: 20 } })) { console.log(message); } ``` ```python Python theme={null} import asyncio import os from claude_agent_sdk…
Plugins in the SDK
Claude Code CLI · in the page
agent-sdk/plugins
…ptions: { plugins: [{ type: "local", path: pluginPath }], maxTurns: 3 } })) { if (message.type === "system" && message.subtype === "init") { console.log("Loaded plugins:",…
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
…options: { resume: sessionId, forkSession: true, maxTurns: 5 } })) { if (message.type === "system" && message.subtype === "init") { forkedId = message.session_id;…
Extend agents with skills
Claude Code CLI · in the page
agent-sdk/skills
…wait (const message of query({ prompt: "Hello Claude", options: { maxTurns: 1 } })) { if (message.type === "system" && message.subtype === "init") { console.log("Available commands:", messag…
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
…dels where Claude Code otherwise doesn't provide them. options: { maxTurns: 15, permissionMode: "acceptEdits", env: { ...process.env, CLAUDE_CODE_ENABLE_TODO_TOOLS: "1" } }, })) { if (messag…
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`, `autoCompactWindow`, `skills`, `mcpServers`, `hooks`, `memory`, `background`, `effort`, `isolation`, `color`, `initialP…
Add components to a plugin
Claude Code CLI · in the page
plugins/components
…: * **Supported fields**: `name`, `description`, `model`, `effort`, `maxTurns`, `autoCompactWindow`, `tools`, `disallowedTools`, `skills`, `memory`, `background`, `omitClaudeMd`, `isolation`, `color`…
Create custom subagents
Claude Code CLI · in the page
sub-agents
…`disallowedTools`, `model`, `permissionMode`, `mcpServers`, `hooks`, `maxTurns`, `autoCompactWindow`, `skills`, `initialPrompt`, `memory`, `effort`, `background`, `omitClaudeMd`, and `isolation`. * **…
Tools reference
Claude Code CLI · in the page
tools-reference
…nstead of starting fresh To cap how many turns a subagent runs, set `maxTurns` in the [subagent definition](https://code.claude.com/docs/en/sub-agents.md#supported-frontmatter-fields). Which tools a…