Let’s Get Certified
Module 08 / 21 · Implementation and integration

Give an agent a bounded tool contract

Design an agent that can recover from a tool timeout without duplicating an authorized transaction.

Give an agent a bounded tool contract

Work through the decision

A parts assistant can look up a quote and submit an order. Users authorize a spending limit, but a delayed response causes a second submission. How should the workflow protect the transaction?

Check your reasoning

Carry the caller's identity and approved amount into a deterministic order service. Validate the schema and enforce an idempotency key before persisting a purchase. Recover the prior result on retry. Pause for fresh approval if quantity or price changes.

Watch the source lesson at 2:34:34

Compare the choices

Scope session memory
Separate sessions and durable user preferences; retain only authorized context. Clear or expire state when its purpose ends.
Require approval for material actions
Pause before consequential operations, show the proposed arguments and bind approval to those exact values.
Validate tool calls at the service boundary
Check typed parameters, caller permission and idempotency. A model proposal gains authority only through the service.
Coordinate bounded specialist steps
Assign narrow roles, explicit tool sets and a completion limit. Pass structured results and record the handoff so loops terminate.

Deploy a tool-using agent on Bedrock AgentCore

Use AgentCore Runtime to host the existing agent. Gateway exposes permitted tools, Identity handles trusted credentials, and Memory can preserve authorized context across turns. Keep order authorization and deduplication in the order service. If a timeout follows a write, use its idempotency key to recover the result before proposing another order.

Apply it on AWS

A short tool call can fit a Lambda function. A longer-running tool server may need a container or managed runtime. An MCP tool schema describes the interface; enforce user permissions, maximum amounts and time limits in the service that performs the action.

AgentCore components at 2:33:52 · Work through the deployment at 2:37:56

Practice the guide skills

  1. Choose session state for an active case and explicitly authorized durable memory for returning users. Compare retention and access boundaries. Watch 2:34:34
  2. Split a fulfillment goal into stock lookup, quote and approved submission. Define dependencies, stop conditions and error states. Watch 2:29:15
  3. Restrict tool permissions, schema and budget. Require approval before irreversible writes and reject changed arguments. Watch 2:45:20
  4. Assign retrieval and fulfillment to scoped specialists; define who coordinates their outputs and when the workflow ends. Watch 2:48:00
  5. Capture the price, quantity and recipient a reviewer authorized. Route ambiguous or high-impact choices to that reviewer. Watch 2:47:32
  6. Give every order a typed tool contract, timeout and idempotency key. Simulate a delayed reply and verify one purchase. Watch 2:40:01
  7. Compare a short stateless Lambda tool with a long-running tool service. Consider a managed AgentCore runtime, Gateway for tools, Memory for context and Identity for authorized access. Watch 2:41:15

Official objectives for this lesson

Related lesson · Choose an AWS delivery model for generative AI

Knowledge check

Give an agent a bounded tool contract quiz

Answer 3 questions. Check each answer for an explanation.

Worked example · Give an agent a bounded tool contract