Day 32: Bedrock Converse API Tool Choice in Production

Day 32: Bedrock Converse API Tool Choice in Production

toolChoice is an IAM policy for the model’s hands. Leaving everything on vague auto is how agents call refund_customer while you asked for a dry-run summary. Day 32 makes tool choice a per-step decision, versions tools like APIs, and pins prompts so deploys are reproducible.

⚡ TL;DR: Force a specific tool for deterministic steps; use any when a tool is mandatory; reserve auto for allowlisted, low-risk hops. Pin prompt + tool schema versions. Dual-control still wraps mutating executions.

The three modes

tool_config_auto = {"tools": tools, "toolChoice": {"auto": {}}}
tool_config_force_search = {"tools": tools, "toolChoice": {"tool": {"name": "code_search"}}}
tool_config_must_act = {"tools": tools, "toolChoice": {"any": {}}}
toolChoice = {"auto": {}}

In Step Functions agents (Day 33), store the intended toolChoice in state so retries do not loosen policy.

Version tools like APIs

{
  "toolSpec": {
    "name": "create_ticket_v2",
    "description": "Create Jira ticket (v2 requires projectKey)",
    "inputSchema": {
      "json": {
        "type": "object",
        "required": ["projectKey", "summary", "idempotencyKey"],
        "properties": {
          "projectKey": {"type": "string"},
          "summary": {"type": "string", "maxLength": 200},
          "idempotencyKey": {"type": "string", "minLength": 8}
        },
        "additionalProperties": false
      }
    }
  }
}

Breaking renames without a version bump strand in-flight sessions. Keep v1 until traffic drains.

Prompt Management pins

Reference promptArn:version in deploy config — never floating latest in production. Pair with feature flags so you can roll back prompt and toolChoice together.

Production checklist

  • [ ] Per-step toolChoice in the agent graph
  • [ ] additionalProperties: false on tool schemas
  • [ ] Prompt + tool versions pinned
  • [ ] Metrics: tool call rate by name, forced vs auto
  • [ ] Tests: must call search before answer
  • [ ] Mutating tools still behind approval (Days 33/40)

Series navigation

← Day 31 · Day 33 →

Last updated September 11, 2026


Discover more from CheatCoders

Subscribe to get the latest posts sent to your email.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply