AI AgentsLangChain

How do you dynamically select tools for each model call?

Question 300 of 324 · Updated

On this page

Direct answer#

In modern LangChain, use wrap_model_call middleware to inspect the current ModelRequest, select a permitted subset of the available tools, and pass a request with the overridden tool list to the next handler. A selector can use trusted runtime context, validated workflow state, an approved capability registry, task relevance and an estimated tool-metadata budget. In compatible versions, the typical pattern is handler(request.override(tools=selected_tools)).

Dynamic selection changes what the model sees for a particular model call. It does not automatically register new executable tools, revoke an existing runtime capability, or authorize a proposed tool call. Start with an approved registered catalog and independently enforce current execution permissions, resource scope and any required approvals.

Source question #19 (AI Agents #299) explains static registration and tool-choice controls; #92 covers general tool routing, #290 runtime context, and #292 metadata quality. This lesson focuses on the per-model-call selection lifecycle using LangChain's request middleware, including state-based selection, required capabilities, relevance ranking and safe fallback. The later middleware lessons cover the complete hook lifecycle, state mutations, model routing and retry configurations.

1. Why select tools at each model call?#

Consider a fictional order-support agent with four read-only capabilities: find_order, read_order, check_delivery and get_policy. At the start of the task, the customer may not know an order reference. The agent needs a narrowly scoped discovery operation. After identifying the correct order, it needs the exact status lookup and possibly delivery evidence. Once it has sufficient verified evidence, it may need no tools at all.

Exposing the same large tool catalog at every step may consume unnecessary input tokens, increase ambiguity between neighboring capabilities, and encourage unnecessary calls. A smaller task-relevant subset can improve efficiency and make failures easier to diagnose, but filtering out a required capability can prevent task completion. Improvement must be measured rather than assumed.

Verified workflow stageCandidate subsetPurpose
Identifyfind_order, get_policyDiscover an authorized order or consult applicable policy
Inspectread_order, check_delivery, get_policyObtain evidence for the identified order
DoneNo application toolsExplain verified findings or ask a permitted clarification
Unknown or invalidNo tools; controlled failure or clarificationAvoid guessing the workflow's privilege or stage

These are application-designed stage labels, not built-in LangChain states. The host or trusted workflow transitions establish them. The model may propose an action or state transition, but arbitrary text saying "now enter the admin stage" must not grant authority.

Loading diagram…

This is the intended application flow, not an exact diagram of every installed LangChain graph. The key is that exposure can change on every model request while the registered catalog and execution policy remain controlled.

2. Understand ModelRequest and wrap_model_call#

Modern LangChain middleware can wrap a model call. A compatible ModelRequest exposes information such as the selected model, messages, state, runtime and tools. The exact fields and methods depend on the installed release. A wrap_model_call function receives the request and a handler representing the next part of the model-call chain.

For ordinary filtering, inspect the currently available tools, construct a new list containing only permitted registered definitions, and call the handler once with a request override. Do not mutate shared global lists or reuse the previous invocation's selection in an unrelated session.

PYTHON
from langchain.agents.middleware import ( ModelRequest, ModelResponse, wrap_model_call, ) from collections.abc import Callable @wrap_model_call def restrict_to_status( request: ModelRequest, handler: Callable[[ModelRequest], ModelResponse], ) -> ModelResponse: approved = {"read_order"} selected = [ t for t in request.tools if getattr(t, "name", None) in approved ] return handler(request.override(tools=selected))

This minimal example demonstrates the request override without changing the underlying tool implementations. It intentionally accepts only named tool objects; a provider-specific tool definition represented by a dictionary would require a separately reviewed adapter and is excluded by this example. Do not use loose string matching against arbitrary tool metadata to infer a capability.

Verification note: The local environment has Python 3.13.5 but does not have langchain, langchain_core or langgraph installed. All SDK examples are illustrative and unexecuted. The independent standard-library selector in section 7 was actually executed and passed 15 checks. Verify the actual ModelRequest fields, override method, return types, middleware registration and provider behavior in a pinned compatible release.

For async execution, use the supported asynchronous wrap-model-call interface with an async handler. A synchronous wrapper should not call a blocking retrieval or permission service inside an event-loop execution path. Verify the installed middleware signatures rather than assume the synchronous wrapper is automatically converted into a suitable asynchronous one.

3. Filter existing tools versus register new tools#

A runtime may maintain a registered set of executable tools and present only a subset on a particular model call.

OperationWhat changesWhat does not automatically change
Static registrationTool implementations an agent is configured to dispatchCurrent caller's resource permissions
Per-request filteringTool definitions supplied to the model for one callAll registered implementations or execution authorization
Named tool choiceThe model's selection constraint, when supportedAuthorization for the tool's arguments
Dynamic registrationAdds or resolves executable implementations through a supported mechanismTrust, approval or authorization merely by discovery

The safe introductory pattern is filtering a known registered catalog. If a model is shown a newly constructed tool that the execution node does not know how to dispatch, the call may fail even though the model can generate the requested name. Some framework releases support dynamically registered tools with additional tool-execution middleware; that is a distinct integration problem. Do not assume changing request.tools alone makes an arbitrary callable executable.

A provider may also support built-in tools, structured-output tool definitions or other special capabilities. These can have different routing and execution semantics. Treat them explicitly and test their actual representation. Do not drop a framework-managed structured-output definition accidentally, and do not allow a provider-native capability merely because it is not an ordinary Python tool object.

The registration invariant#

For this lesson's conservative local-tool pattern, every selected name must resolve to one exact registered implementation and every registered implementation must have an approved capability descriptor. Duplicate tool names or ambiguous mappings should cause configuration validation to fail before deployment.

A trusted capability registry should identify a stable name, implementation revision, public schema, approved purposes or stages, permission requirement, side-effect class, owner and optional metadata-cost estimate. Descriptions help the model understand a tool, but a description cannot grant a permission or alter the implementation's trust level.

4. Use trusted runtime context and validated state#

The selector needs two kinds of information.

Runtime context contains application-owned invocation dependencies, such as authenticated tenant, granted capability identifiers, deployment profile and a scoped policy service. Graph state contains evolving workflow data, such as verified phase, identified order reference, evidence completeness and remaining work. State can be checkpointed, while live context dependencies need to be reconstructed on resume.

A selected subset may depend on both. For example, the inspection stage can enable read_order only when a trusted transition has established the target order, and a delivery lookup only when the current role and task allow it.

The following example shows the framework wiring. It uses four fictional tool objects and two custom state stages. The trusted host supplies a context containing capabilities and an initial phase. To observe different selections during one actual run, a reviewed tool or graph transition must update phase after verified evidence; a static initial phase by itself does not change automatically.

PYTHON
from dataclasses import dataclass from typing import NotRequired from langchain.agents import AgentState, create_agent from langchain.agents.middleware import wrap_model_call from langchain.tools import tool @dataclass(frozen=True) class SupportContext: capabilities: frozenset[str] class SupportState(AgentState): phase: NotRequired[str] @tool def find_order(reference: str) -> str: """Find the matching fictional order for a known customer reference.""" return "O-1" if reference == "demo-reference" else "unavailable" @tool def read_order(order_id: str) -> str: """Read a fictional order status by its exact identifier.""" return "shipped" if order_id == "O-1" else "unavailable" @tool def check_delivery(order_id: str) -> str: """Read fictional delivery evidence without changing a shipment.""" return "in transit" if order_id == "O-1" else "unavailable" @tool def get_policy(topic: str) -> str: """Read a fictional support policy.""" return "Use verified delivery evidence." STAGE_TOOLS = { "identify": frozenset({"find_order", "get_policy"}), "inspect": frozenset({"read_order", "check_delivery", "get_policy"}), "done": frozenset(), } @wrap_model_call def select_support_tools(request, handler): ctx = request.runtime.context if not isinstance(ctx, SupportContext): raise PermissionError("missing trusted context") stage = request.state.get("phase") approved = STAGE_TOOLS.get(stage, frozenset()) & ctx.capabilities selected = [t for t in request.tools if getattr(t, "name", None) in approved] return handler(request.override(tools=selected)) agent = create_agent( model="openai:gpt-4o-mini", tools=[find_order, read_order, check_delivery, get_policy], state_schema=SupportState, context_schema=SupportContext, middleware=[select_support_tools], system_prompt="Use fictional verified evidence; do not invent results.", ) # Construct from authorized application policy, not user-supplied grants. context = SupportContext(frozenset({"read_order", "check_delivery"})) result = agent.invoke( {"messages": [{"role": "user", "content": "Check fictional order O-1."}], "phase": "inspect"}, context=context, )

This SDK illustration is unexecuted. It demonstrates filtering an already registered set, not a complete production security boundary. The tools operate solely on synthetic public fixtures; a real tool must enforce resource permissions at execution, even if its name was filtered out. The supplied context is a snapshot, not proof that access remains valid. The model identifier is illustrative. Check the actual middleware and invocation interfaces in the installed release.

The example does not automatically transition from identify to inspect. For a multi-stage agent, use a verified state update, for example a supported Command from an authorized discovery tool, to record the identified reference and transition phase. The next model request will evaluate the new state. See the earlier state-update lesson (#295) for the Command and correlated ToolMessage contract. Reject unexpected transitions; do not treat a persisted or model-written stage label as authorization.

Loading diagram…

In a real application, Clarify may terminate the current invocation and wait for the user, rather than immediately loop. The state machine is an application design; it is not a guarantee about the runtime's internal termination behavior.

5. Permission-aware relevance filtering#

Choose in a deliberate order. Security eligibility is a hard constraint; relevance is an optimization.

Eligible tools = registered capabilities ∩ current allowed capabilities ∩ tools valid for the workflow stage.

The selector then reserves required eligible capabilities, ranks optional eligible tools and applies resource constraints. If a required tool is missing, the application should not silently proceed as if it has complete access.

Selection methodUseful whenMain limitation
Deterministic stage rulesStructured workflows with clear prerequisitesMay be inflexible for open-ended tasks
Keyword or tag matchingSmall catalog with well-defined topicsCan miss paraphrases and ambiguous requests
Semantic retrieval over approved metadataLarge catalog with varied tasksRanking errors, index freshness and retrieval cost
Model-assisted selectionComplex task intentAdditional model cost, nondeterminism and injection risk
Hybrid filteringProduction catalogs with policy and relevance needsMore components to validate and observe

Even when using semantic or model-based ranking, do not let the selector expand the eligible set. Filter by trusted permission before sending metadata to an external ranking model. Tool metadata itself may be private or untrusted. Validate ranked names against the current registry and eligibility set again after ranking.

Reserve required tools before optional tools. A relevance score can be low for an essential capability because the user's wording does not mention it explicitly. For example, if delivery evidence depends on reading an exact order, the status lookup must remain available in the inspection stage even when the phrase "delivery" ranks check_delivery first.

Use deterministic tie-breaking for equal scores so decisions are reproducible. If optional metadata exceeds the budget, choose a smaller relevant subset, not an unauthorized broader tool. When no authorized tool can satisfy a task, explain the limitation or request clarification rather than invent a result.

6. Empty tool sets, fallback and termination#

An empty tool list has several possible meanings. Distinguish an intentionally tool-free finalization stage from a missing required capability, invalid state, denied permission or exhausted budget.

Selection outcomeApplication behavior
Verified task completeAllow a supported text-only continuation or terminate deterministically
Required capability unavailableReport inability to obtain required evidence or route to an approved clarification
Unknown phaseFail closed and diagnose workflow state
Optional ranking returns no useful candidatesKeep required eligible tools; otherwise clarify if needed
Permission service unavailableDeny by default rather than restore the full catalog
Metadata budget too smallUse an approved larger budget or stop; do not silently remove a required tool
Provider rejects empty toolsUse a compatible unbound model call or terminate without another model call

The minimal SDK example in section 4 only demonstrates a subset override; it does not distinguish these outcome reasons or implement fallback. A production wrapper must do so. In a supported runtime, an intentionally empty list can permit a text response without application tool calls. The actual adapter may reject incompatible forced tool-choice settings or combine the request with framework-generated structured-output tools. Test the effective request rather than infer behavior solely from the length of request.tools.

A fixed tool_choice that requires a particular tool may conflict with the dynamically selected subset. Adjust supported selection settings consistently with the subset, or use a reviewed configuration that permits no call. Do not automatically force the model to call a tool when no required prerequisites exist.

Loading diagram…

Fallback never means exposing every tool when the selector fails. A fallback can preserve a smaller reviewed eligible subset, ask the user for missing information, or route to a deterministic workflow. A safe degraded path is explicit and bounded.

7. Tested Python implementation: permission-first selection with a token budget#

The following dependency-free example represents the selector as a pure function and the execution gate as a separate predicate. It tests a small immutable capability catalog with stage constraints, required tools, optional relevance scores and estimated metadata cost. It is not an implementation of LangChain's internal ModelRequest or middleware engine.

PYTHON
from dataclasses import dataclass from collections.abc import Mapping @dataclass(frozen=True) class ToolSpec: name: str stages: frozenset[str] tokens: int CATALOG = ( ToolSpec('find_order', frozenset({'identify'}), 100), ToolSpec('read_order', frozenset({'inspect'}), 120), ToolSpec('check_delivery', frozenset({'inspect'}), 90), ToolSpec('get_policy', frozenset({'identify','inspect'}), 80), ) @dataclass(frozen=True) class Selection: names: tuple[str, ...] estimated_tokens: int missing_required: bool = False REQUIRED = {'identify': 'find_order', 'inspect': 'read_order'} def select(stage: str, registered: frozenset[str], granted: frozenset[str], scores: Mapping[str, int], budget: int) -> Selection: if type(budget) is not int or budget < 0: raise ValueError('invalid budget') if stage == 'done': return Selection((), 0) if stage not in REQUIRED: return Selection((), 0, True) eligible = {t.name: t for t in CATALOG if t.name in registered & granted and stage in t.stages} required = eligible.get(REQUIRED[stage]) if required is None or required.tokens > budget: return Selection((), 0, True) names, used = [required.name], required.tokens optional = sorted((t for t in eligible.values() if t != required), key=lambda t: (-scores.get(t.name, 0), t.name)) for t in optional: if scores.get(t.name, 0) > 0 and used + t.tokens <= budget: names.append(t.name) used += t.tokens return Selection(tuple(names), used) def can_execute(name, selection, registered, current_grants, resource_allowed): return (name in selection.names and name in registered & current_grants and resource_allowed) reg = frozenset(t.name for t in CATALOG) scores = {'get_policy': 5, 'check_delivery': 10, 'delete_order': 999} a = select('identify', reg, reg, scores, 200) b = select('inspect', reg, reg, scores, 250) assert a == Selection(('find_order','get_policy'),180) assert b == Selection(('read_order','check_delivery'),210) assert select('done',reg,reg,scores,300) == Selection((),0) assert select('unknown',reg,reg,scores,300).missing_required assert select('inspect',reg,reg-{'read_order'},scores,300).missing_required assert select('inspect',reg-{'read_order'},reg,scores,300).missing_required assert select('inspect',reg,reg,scores,119).missing_required assert select('inspect',reg,reg,{},300).names == ('read_order',) assert 'delete_order' not in b.names assert can_execute('read_order', b, reg, reg, True) assert not can_execute('read_order', b, reg, reg-{'read_order'}, True) assert not can_execute('read_order', b, reg, reg, False) assert not can_execute('find_order', b, reg, reg, True) assert select('inspect',reg,reg,{'check_delivery':5,'get_policy':5},210).names == ('read_order','check_delivery') try: select('inspect',reg,reg,scores,-1) except ValueError: pass else: raise AssertionError('invalid budget accepted') print('15 checks passed')

Actual local execution on Python 3.13.5 printed:

15 checks passed
ScenarioVerified behavior
Identify stage, budget 200find_order and get_policy; estimated 180 tokens
Inspect stage, budget 250read_order and check_delivery; estimated 210 tokens
Completed stageEmpty subset, not an error
Invalid stageEmpty subset with missing-required indicator
Required permission revokedMissing-required result
Required tool not registeredMissing-required result
Required tool exceeds budgetMissing-required result
No positive optional relevanceRequired tool preserved
Unregistered high-scoring tooldelete_order excluded
Authorized current proposalExecution predicate permits it
Permission revoked after selectionExecution predicate denies it
Resource authorization deniedExecution predicate denies it
Tool absent from current subsetExecution predicate denies it
Equal optional scoresDeterministic name tie-break
Negative budgetRejected

The metadata estimates are invented teaching values, not measurements of a provider's tool schema. The greedy optional ranking is not a globally optimal knapsack solver; a different combination of lower-scoring tools might produce greater total utility within a budget. In practice, measured completion and safety matter more than optimizing a hypothetical score.

The example assumes the stage, registered set, grants, scores and resource_allowed verdict are properly validated and derived from trusted application mechanisms where required. It does not authenticate a caller, implement a policy service, verify score ranges, validate arbitrary external catalogs or execute a domain operation. Its missing_required flag intentionally groups several failure reasons; a production selection result should distinguish denied permissions, invalid workflow state, missing registration and insufficient budget. A host must consume that flag and choose a controlled path, not call the model and pretend required evidence is available.

8. Integrate the selector with the actual middleware boundary#

A production selector can reuse the pure selection logic in a supported wrapper. Resolve candidate names to the exact existing tool objects, record the selection reason, and pass the subset to the next handler. The following illustrates the integration pattern without claiming a particular application policy-service API.

PYTHON
# Illustrative pseudocode for a compatible wrap_model_call middleware. # The host provides the trusted policy and ranking service functions. @wrap_model_call def filtered_model_call(request, handler): context = request.runtime.context stage = verified_stage(request.state) grants = current_capabilities(context) registry = {tool.name: tool for tool in request.tools} selection = select( stage, frozenset(registry), grants, relevant_scores(stage, request.messages, grants), budget=250, ) if selection.missing_required: raise RequiredCapabilityUnavailable("Required evidence unavailable.") tools = [registry[name] for name in selection.names] return handler(request.override(tools=tools))

The named policy functions and exception in this pseudocode must be supplied by the application. The registry comprehension assumes unique ordinary named tool objects; validate duplicates and handle nonstandard provider definitions separately before using this pattern. The relevance function must receive only approved metadata and task data appropriate for that service. This snippet was not executed and is not a complete standalone program.

If multiple middleware components modify tool exposure, define their ordering and ensure the final model request cannot restore a forbidden capability. A later override that reintroduces tools can invalidate an earlier filtering decision. Inspect actual composed behavior. If a runtime supports state-based or model-based selector middleware, treat it as one component of the same security design rather than assuming it performs authorization.

Keep per-call selections associated with the correct run and request, especially when model calls overlap. Do not store the last selected subset in a process-global mutable variable. In an application that requires exposure membership at execution, correlate the proposal with the actual authorized selection snapshot and recheck live policy. Tool filtering is not automatically a dispatch restriction.

Loading diagram…

The diagram omits provider and middleware implementation details. Model-call wrapping and tool-call wrapping are separate boundaries.

9. Estimate context-token savings and selection overhead#

Suppose a fictional catalog contains 60 tools with an average of 100 logical metadata tokens each. The complete catalog is approximately 6,000 tokens per model request. If a selector exposes six tools on each of four requests, the average selected metadata is approximately 600 tokens per request.

Unfiltered tool metadata: 60 × 100 × 4 = 24,000 tokens.

Filtered tool metadata: 6 × 100 × 4 = 2,400 tokens.

Hypothetical gross reduction: 21,600 logical input tokens, or 90% of tool metadata in this constructed example.

At an illustrative uncached input price of USD 2 per million tokens, that corresponds to USD 0.0432 per run before considering selector costs and billing differences. These are hypothetical figures, not current provider prices or a measured LangChain benchmark. Actual schemas vary, providers count tokens differently, and cached prefixes may change the charge. A selector that adds a separate model call or vector-search request can offset the savings.

Measure the complete workflow, including ranking latency, metadata serialization, extra model calls, retries caused by missing tools, answer accuracy and cost per verified successful task. Lower metadata usage is not an improvement if the agent loses an essential capability and repeatedly fails to finish.

A bounded optional selection may use estimated per-tool cost and a context reserve for messages, retrieved evidence and output. Confirm actual request sizes using provider-specific token accounting when available. An estimate does not replace a hard context-window limit.

10. Evaluation and production release gates#

Evaluate the selector and the full agent separately. Build labeled tasks with required and acceptable optional capabilities, expected stage transitions and examples where no tool should be available.

A useful coverage metric is required-tool recall: the number of required eligible tool instances present in the selected subsets divided by the total number of required eligible tool instances in the evaluation. Count required tools that are denied by policy separately rather than penalizing a safe denial. A task with unavailable required access should produce a controlled failure, not a false success.

Measure exposure violations independently: any tool present in the selected subset despite lacking permission, registration or stage eligibility is a critical policy failure. Also track unauthorized proposals and actual unauthorized executions as separate metrics. A proposal rejected by the execution gate is not an executed violation.

Integration testRequired outcome
First model callActual provider-bound tool definitions match expected authorized subset
Trusted state transitionNext call recomputes subset without mutating a shared catalog
Required capability has low relevanceRetained if eligible and within the approved required budget
Irrelevant high-scoring toolCannot bypass stage or permission constraints
Unknown stage or absent contextControlled fail-closed path
Empty subsetCompatible no-tool response or deliberate termination
Permission revoked after exposureExecution denied
Proposal for hidden registered toolRejected under the conservative dispatch policy
Multiple concurrent sessionsEach sees its own authorized subset
Structured-output strategy enabledRequired framework definitions and selection controls remain compatible
Provider/tool-schema changeActual converted request and supported selection semantics revalidated
Selector timeout or outageApproved bounded fallback, never unrestricted catalog

Use mocked or scripted model requests to exercise the actual installed middleware and execution graph. Verify the effective provider-bound tool list, not just the pure selector return value. Include malicious metadata, prompt-injection fixtures, stale checkpoint state, unknown names and repeated denied proposals. Then use separately approved synthetic live-model tests to measure completion, task quality and cost.

Compare static and dynamic policies on the same held-out workloads. Keep the model revision, prompt, registered implementations, authorization policy and task fixtures controlled where feasible. Report required-tool recall, mean selected metadata cost, selector latency, downstream call count, verified completion and denied execution outcomes. Do not claim a quality improvement from a fabricated or small scripted score.

Record selection-policy version, registry revision, workflow phase, safe selected identifiers, estimated and observed metadata sizes, fallback reason, proposal and execution verdict. Avoid logging full private user messages or secret-bearing tool definitions. Roll out selector changes with a reviewed canary and a safe rollback profile that does not increase permissions.

Common mistakes#

  • Filtering after sending the entire catalog to an external model selector can disclose unauthorized metadata.
  • Adding tools to ModelRequest does not automatically create a registered executable implementation.
  • Treating workflow phase or a rank score as authorization permits untrusted state to expand privileges.
  • Removing every low-scoring tool may hide required evidence.
  • Overwriting a shared global tool list can leak capabilities across concurrent users.
  • Forcing a tool when the subset is empty can create invalid requests or repeated calls.
  • Returning an unrestricted catalog after a selector error defeats the security boundary.
  • Measuring only metadata savings can hide task failure and retry amplification.

Interview-ready answer#

I register an approved LangChain tool catalog, then use wrap_model_call middleware to inspect each ModelRequest and construct a smaller subset with a supported request override. I use trusted runtime context and verified workflow state to filter by capability permissions and stage, reserve required tools, and rank optional tools within a metadata budget. I preserve exact registered tool identities and verify provider compatibility, including empty subsets and structured-output interactions. Exposure is not execution authorization: every proposed call is independently checked against current policy, resource scope and the relevant selection. I test missing required capabilities, permission revocation, fallback behavior and concurrent isolation, and measure required-tool recall, verified completion and end-to-end cost.

Official documentation research leads and verification status#

Authorized offline research exception applied. The official documentation URLs are research leads, not live-accessed citations. The standalone selector and execution predicate ran on Python 3.13.5 and passed all 15 checks. LangChain, langchain_core and langgraph were absent, so SDK examples, actual middleware ordering, dynamic request override, provider tool schema and empty-tool behavior were not executed or version-verified. The example workloads, scores, budgets, tool metadata estimates and prices are synthetic. Mermaid diagrams use standard triple-backtick fences; rendering and public website display were not verified.

References

  1. 1.
    LangChain agentsdocs.langchain.com
  2. 2.
  3. 3.
  4. 4.
    LangChain runtimedocs.langchain.com
  5. 5.
  6. 6.
    LangChain toolsdocs.langchain.com
  7. 7.
    LangChain modelsdocs.langchain.com
  8. 8.
    LangChain API referencereference.langchain.com

Related questions

Explore other topics:Forward Deployed EngineeringLarge Language ModelsRetrieval-Augmented GenerationMLOps

Machinoai Logo
Machinoai

Your edge in the AI era. Deep dives into machine learning concepts, paper explainers, verified industry jobs, and developer tools.

© 2026 Machinoai. All rights reserved.