Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Defining a tool

Focus mode
Defining a tool - Amazon Nova

A critical step in the tool calling workflow is defining the tool. The tool definition must include all of the necessary context to guide the model on when it is appropriate to invoke the tool.

To define a tool, create a tool configuration and pass it with the user message to the API. The tool configuration schema expects an array of tools and optionally a tool choice parameter.

Note

Amazon Nova supports the auto, any, and tool options for toolChoice. For more information, see ToolChoice in the Amazon Bedrock API documentation and Use a tool to complete an Amazon Bedrock model response.

Here is an example of how to define a tool:

tool_config = { "tools": [ { "toolSpec": { "name": "top_song", "description": "Get the most popular song played on a radio station.", "inputSchema": { "json": { "type": "object", "properties": { "sign": { "type": "string", "description": "The call sign for the radio station for which you want the most popular song. Example calls signs are WZPZ, and WKRP." } }, "required": [ "sign" ] } } } } ], }

The name, description, and the input schema must be explicit with the exact functionality of the tool. Ensure any key differentiators for when to use the tool are reflected in the tool configuration.

Note

Amazon Nova understanding models currently support only a subset of JsonSchema functionality when used to define the ToolInputSchema in Converse API.

  • The top level schema must be of type Object.

  • Only three fields are supported in the top-level Object - type (must be set to ‘object’), properties, and required.

For tool calling, the inference parameters should be set as inf_params = {"topP": 1, "temperature": 1} and additionalModelRequestFields= {"inferenceConfig": {"topK":1}}. This is because we encourage greedy decoding parameters for Amazon Nova tool calling.

Here is an example of calling a tool with the Converse API:

import json import boto3 client = boto3.client("bedrock-runtime", region_name="us-east-1") input_text = "What is the most popular song on WZPZ?" messages = [{ "role": "user", "content": [{"text": input_text}] }] inf_params = {"maxTokens": 1000, "topP": 1, "temperature": 1} response = client.converse( modelId="us.amazon.nova-lite-v1:0", messages=messages, toolConfig=tool_config, inferenceConfig=inf_params, additionalModelRequestFields= {"inferenceConfig": {"topK":1}} ) messages.append(response["output"]["message"]) # Pretty print the response JSON. print("[Full Response]") print(json.dumps(response, indent=2)) # Print the tool content for easy readability. tool = next( block["toolUse"] for block in response["output"]["message"]["content"] if "toolUse" in block ) print("\n[Tool Response]") print(tool)
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.