Learning resourcesReviewed · Anthropic

Configure your agent: Claude Agent SDK

Configure your agent is a Claude Agent SDK documentation page for TypeScript and Python developers that explains how to configure agent sessions: the options object, model and fallback choice, settings files, environment variables, working directory, turn and spending limits, and changes during a session. Listing tools in allowedTools or allowed_tools pre-approves them but does not restrict the agent to them; unlisted tools stay available and the permission mode decides whether they run.

Researched 14 Nov 2026

In short.

Configure your agent is a Claude Agent SDK documentation page for TypeScript and Python developers that explains how to configure agent sessions: the options object, model and fallback choice, settings files, environment variables, working directory, turn and spending limits, and changes during a session. It explains how session options interact with settings files, environment variables, working directories and runtime controls. Listing tools in allowedTools or allowed_tools pre-approves them but does not restrict the agent to them; unlisted tools stay available and the permission mode decides whether they run. When env is supplied, TypeScript uses it in place of the inherited subprocess environment, while Python merges the supplied values over the inherited environment. The guide also explains the different interfaces for changing a running session. Turn and spending caps are disabled unless configured. No code was executed; runtime behavior, model availability and actual costs are not assessed.

Researched and written by an AI model and checked by a second AI model. How it works

Coverage is limited to the complete selected page at [https://code.claude.com/docs/en/agent-sdk/configuration.md], including both language examples, permission and environment caveats, limit semantics, runtime configuration notes and the feature table. The documentation index and all linked references are excluded. Installation, authentication, model availability, pricing, licence terms, security enforcement and runtime outcomes remain unknown or not assessed where the page supplies no evidence. No code was executed.

The overview

Identity

Configure your agent is a Claude Agent SDK documentation page at [https://code.claude.com/docs/en/agent-sdk/configuration.md]. It teaches developers how to configure SDK sessions in TypeScript and Python.

The resource is a configuration guide rather than an SDK package or complete application. It combines explanations, paired language examples and links to feature-specific references.

Assessment

The guide is useful when a developer needs to understand which controls belong in session options, settings files or the subprocess environment. Its strongest practical details concern behavior that can be easy to misread: tool pre-approval, environment inheritance, limit handling and persistent settings changes.

It is insufficient on its own for a first installation or deployment decision. Complete option types, defaults, authentication instructions and security configuration are not established here. The examples have not been executed, and operational reliability is not assessed.

Users

The intended readers are TypeScript and Python developers building applications around Claude agent sessions. Beginners get paired examples and explanations of working directories, settings and limits; experienced developers get language-specific behavior and runtime configuration details.

Developers maintaining longer conversations or applications with separate project contexts may particularly benefit from the streaming-input, settings-source and working-directory guidance. Complete tenant isolation is not demonstrated on this page.

Capabilities

The guide covers choosing a model and fallback models, pre-approving tools, loading settings, setting environment variables, choosing a working directory, granting access to additional directories, and limiting turns and spend.

It also explains model and permission changes during streaming sessions. A reference table points to options for prompts, external tool servers through MCP, subagents, hooks, skills, plugins, structured output, session persistence, file checkpoints, effort and sandboxing. Those linked features are identified, but their full configuration is outside this page.

Using it

Requirements

Following the examples requires the corresponding SDK package and a TypeScript or Python execution environment. The imports shown are @anthropic-ai/claude-agent-sdk and claude_agent_sdk. Repository examples also require an accessible project directory.

The SDK runs a Claude Code subprocess. The page mentions environment variables including PATH, HOME and ANTHROPIC_API_KEY, but does not provide installation commands, runtime version requirements or a complete authentication procedure. Minimum SDK versions for the described methods are unknown from this page.

Mechanism

Each query() accepts an optional configuration object: Options in TypeScript or ClaudeAgentOptions in Python. Sessions also read configuration from settings and environment variables. settingSources or setting_sources selects user, project and local filesystem sources; an empty array disables those sources. An explicit settings value overrides those filesystem settings, while managed policy settings rank higher.

When env is supplied, TypeScript replaces the subprocess environment; Python merges the supplied values over the inherited environment. Leaving env unset inherits the environment in both languages. The cwd option determines the working directory and influences project settings, hooks, skill discovery and session storage.

Fallback models handle an overloaded or unavailable primary model, which is retried at the start of each user turn. Streaming sessions support model and permission setters. TypeScript exposes these on the query() return object; Python uses ClaudeSDKClient because its query() returns an iterator without control methods.

Setup

The documented starting point is to pass a model, tool approvals, turn limit and cwd through the options object. TypeScript uses names such as allowedTools and maxTurns; Python uses allowed_tools and max_turns. These lists pre-approve calls; for unlisted tools, the session's permission mode decides whether the call runs.

For TypeScript environment overrides, the example spreads process.env before adding ANTHROPIC_BASE_URL so inherited variables remain available. Python adds the gateway variable through its merging env option.

Choose cwd when starting the session: neither SDK provides a setter for changing it later. additionalDirectories in TypeScript and add_dirs in Python grant additional file access rather than loading those directories' configuration.

Example

The first example asks an agent to summarize a repository's open TODOs. It selects a model, pre-approves Read, Glob and Grep, sets an eight-turn limit and points cwd at the repository. The code prints a successful result message. The approval list alone does not establish read-only enforcement because other tools remain available and the permission mode decides whether they run.

A second example illustrates two conversation turns with a model and permission-mode change between them. TypeScript holds the second prompt until the setters finish; Python sends the second query after calling the client setters. These are documented examples, not observed execution results.

Assessment & evidence

Limitations

allowedTools and allowed_tools are pre-approval lists, not exclusive lists of available tools. The page's repository example therefore needs an appropriate permission mode before its read-only description can be treated as enforced behavior.

Limit handling differs by input mode. A single-shot query yields the limit result and then raises; streaming input keeps the session alive. The turn count resets for each queued streaming message, while spending accumulates. A zero turn limit means unlimited turns, unlike a zero spending cap, which is invalid.

The options objects do not expose temperature, top_p or max_tokens. Full defaults, fallback-chain limits, sandbox behavior and runtime settings version requirements are delegated to linked references. No installation, performance, security or deployment results are available.

Reasoning

The documented interactions make this guide particularly useful for configuring predictable sessions: identical-looking environment overrides behave differently across languages, tool approval does not define all permitted access, and streaming changes how limits apply. These details give developers concrete questions to resolve before integrating an agent.

Its value is configuration guidance rather than evidence of agent quality. The page does not demonstrate task accuracy, response speed, savings or production isolation, so conclusions about those outcomes would exceed the evidence.

Alternatives

For direct control of temperature, top_p or max_tokens, the page points readers to the Messages API instead of the SDK options object. It suggests effort settings or a spending cap for other forms of control, without establishing them as equivalent to those API parameters.

Within the SDK, single-shot queries suit a single request, while streaming input supports ongoing interaction and configuration changes. The page links to a quickstart and complete examples for broader implementation guidance. It provides no comparison with competing SDKs.

Evidence

The evidence is the complete documentation page at [https://code.claude.com/docs/en/agent-sdk/configuration.md], including its explanations, TypeScript and Python examples, notes and feature-reference table. Linked pages are excluded.

The captured source revision is sha256:bc2e046b5f4129dae0aac5bb4987570eb21ece05edfadb99da0dc18b5de82c65. Its examples describe intended SDK behavior; no execution logs, measured results or independent compatibility evidence accompany the page.

Access & freshness

Costs

Actual cost is unknown. The page supplies no model price table, representative usage total or benchmark supporting its suggestion that smaller models can be faster and cheaper.

maxBudgetUsd or max_budget_usd sets a spending cap; leaving it unset disables the cap, while setting it to zero is rejected at startup. During streaming input, spending accumulates across messages. Once the cap is reached, later messages receive the budget-limit result until a /clear resets the budget.

The guide states that each model has a separate prompt cache. After a model switch, the next request recomputes the full conversation without cache reuse at the new model's rates. The resulting monetary impact is not quantified.

Rights

The page does not state licence or redistribution terms for its prose, code examples or SDK packages. Rights to reuse, modify or redistribute those materials cannot be determined from this evidence.

Freshness

The page was captured on 2026-11-14 at 17:53:42.690 UTC. It supplies no publication date, last-updated date or SDK package version.

The model identifiers shown are documentation examples. Their current availability, installed-version compatibility and pricing are not established here. The page refers elsewhere for version requirements on TypeScript settings methods, leaving those requirements unknown within this scope.

Actions

Before implementing a session, explicitly choose its model, working directory, settings sources, permission mode and appropriate limits. For a read-only task, choose a restrictive permission mode (see [https://code.claude.com/docs/en/agent-sdk/permissions.md#allow-and-deny-rules] for allow and deny rules) instead of relying solely on tool pre-approval. Account for the language-specific environment behavior and handle both limit result messages and single-shot exceptions.

Confirm defaults and installed-version support in the linked language references: [https://code.claude.com/docs/en/agent-sdk/typescript.md#options] and [https://code.claude.com/docs/en/agent-sdk/python.md#claudeagentoptions]. setModel()/set_model(), setPermissionMode()/set_permission_mode() and TypeScript's applyFlagSettings() change the running session, while TypeScript's updateSettings() writes one allowlisted key to a settings file: a localSettings write takes effect on the next request and persists for later sessions that load local settings, and a userSettings write (effortLevel only) saves a default without changing the running session's effort. applyFlagSettings() accepts settings-file keys.

Evidence for this report

selected-page.txtselected · checked 2026-11-14