CLOUD CONCEPT

Tool Use

Tool use enables a foundation-model application to request external functions, APIs, or utilities to retrieve information, perform calculations, or take actions.

Cloud Concepts Hub →

What is Tool Use

A foundation model can select a tool and generate structured arguments, while the application or managed agent runtime validates and executes the request. This connects language-based reasoning to current data and business systems, enabling AI agents to complete tasks rather than only generate text.

Tool use connects a foundation model to capabilities outside its learned parameters. A tool might look up an order, calculate a tax amount, search documents, create a support ticket, or reserve inventory. The model receives descriptions of available tools and their expected inputs, then can request an appropriate operation. The application or agent runtime executes the operation and returns its result to the model, which can explain the outcome or request another operation.

A typical interaction begins with a user asking, “Where is my shipment?” The application provides a tool definition for retrieving shipment status, including a structured input schema. The model requests that tool with an order identifier. Application code verifies the identifier and the user's authorization, calls the shipping system, and passes the response back to the model. The model then produces an answer grounded in the returned status rather than guessing from its training data. Generating a tool request is not the same as executing it successfully.

Tool use is a building block of AI agents. An agent combines a model with instructions, tools, and orchestration logic to pursue a goal through potentially multiple steps. For example, a customer-service agent could retrieve an order, check refund eligibility, request approval, and submit an authorized refund. Other business applications include scheduling appointments, investigating operational incidents, reconciling invoices, and checking inventory before preparing a sales quote. A single tool call does not necessarily make an application an autonomous agent; agent behavior depends on how it selects and coordinates actions toward a goal.

In cloud applications, tools commonly run as serverless functions, containerized services, or authenticated API endpoints. Tool definitions should describe purpose, required parameters, acceptable values, and possible results clearly. Prefer narrowly scoped business operations, such as retrieving an authenticated customer's orders, over unrestricted database queries or arbitrary command execution. Keep credentials in the execution environment rather than placing them in prompts, and enforce identity and authorization outside the model.

Security boundaries are essential because a model's proposed arguments are untrusted input. Validate schemas and business rules, restrict network destinations, and apply least-privilege permissions. Retrieved content and tool responses can contain prompt-injection attempts, so they must not be allowed to redefine tool permissions or approval requirements. High-impact actions, such as transferring money or deleting resources, should require explicit approval enforced by the application. Generated confirmation text alone is not evidence of authorization.

Tool use introduces latency, inference charges, API costs, and additional failure modes. Set timeouts, limit the number of tool calls, handle unavailable dependencies, and use bounded retries. Write operations need idempotency controls to prevent repeated requests from creating duplicate refunds or reservations. Record tool selections, validated arguments, execution outcomes, and approvals with appropriate protection for sensitive data. Evaluate both task completion and whether the application chose safe, appropriate actions.

Tool use does not retrain the model, guarantee factual answers, or automatically grant access to enterprise systems. Retrieval-augmented generation supplies external information for generating answers; retrieval can itself be exposed as a tool, but tools also support calculations and state-changing operations. For predictable, fixed procedures, a deterministic workflow may be simpler and safer than allowing a model to choose every step. Use agentic selection where flexibility provides a clear business benefit, while retaining deterministic controls around execution.

Key aspects of Tool Use

Effective tool use combines clear interfaces and flexible model-driven selection with deterministic security, reliability, and execution controls.

Explicit tool contracts

Define each tool's purpose, input schema, and expected output clearly. Narrow business-level interfaces reduce ambiguous selections and make requests easier to validate.

Separation of selection and execution

The model proposes a tool call, but application code or a managed runtime performs the operation. Treat the proposal as untrusted input and verify execution results before reporting success.

Goal-directed agent orchestration

Agents can select tools, examine results, and coordinate further actions toward a business goal. Bound the number of steps and provide clear stopping or escalation conditions.

Authorization and approval controls

Enforce user-specific access and least-privilege permissions outside the model. Require application-enforced approval for consequential actions such as payments or destructive changes.

Reliable execution

Use timeouts, bounded retries, and explicit error handling for external dependencies. Apply idempotency controls to state-changing operations so repeated requests do not create duplicate effects.

Traceability and evaluation

Capture tool requests, outcomes, and approval decisions while protecting sensitive data. Test tool-selection accuracy, argument validity, authorization enforcement, and end-to-end task completion.

Cloud services for Tool Use

Amazon Bedrock provides model capabilities and managed agent orchestration, while AWS Lambda or APIs exposed through Amazon API Gateway connect tool requests to business operations. AWS Step Functions can place those operations inside controlled workflows with retries, error paths, and approval integration. IAM limits the AWS permissions available to each execution component. Together, these services separate model-driven tool selection from controlled execution: the application still validates arguments, enforces user authorization, checks outcomes, and decides when a human must approve an action.

Amazon Bedrock

Amazon Bedrock supports tool use with compatible foundation models, enabling structured requests that application code can execute and return as tool results. Agents for Amazon Bedrock can orchestrate configured action groups, including operations implemented through AWS Lambda or returned to the application for execution.

Open Amazon Bedrock →
AWS Lambda image AWS Lambda

AWS Lambda can implement tool operations such as checking inventory or creating a support ticket. Function code should validate arguments, enforce business rules, and use narrowly scoped permissions when accessing downstream systems.

Open AWS Lambda →
Amazon API Gateway image Amazon API Gateway

Amazon API Gateway exposes backend operations through managed API endpoints that a tool executor can call. Configured authentication, authorization, throttling, and request validation help control access, while backend code remains responsible for business-level checks.

Open Amazon API Gateway →
AWS Step Functions image AWS Step Functions

AWS Step Functions can coordinate deterministic workflows invoked by an agent or orchestrate application steps around model calls. It supports explicit state transitions, retries, error handling, and callback patterns that can support approval processes.

Open AWS Step Functions →