AI Cloud Architect

Implementing programmatic tool calling on Amazon Bedrock

AWSHow-to by Shreyas Subramanian, River Xie and Pratik RaichuraAWS Artificial Intelligence Blog

In this post, we show three ways to implement Programmatic tool calling (PTC) on Amazon Bedrock: a self-hosted Docker sandbox on ECS for maximum control, a managed solution using Amazon Bedrock AgentCore Code Interpreter, and an Anthropic SDK-compatible path through a proxy for teams that prefer that developer experience.

Read the original (opens the source's page in a new tab)

AI: Summary

What it is

Programmatic tool calling has the model write one Python block that runs tool calls in a sandbox, so only the final result returns to the model; AWS shows three ways to build it on Bedrock.

Who it is for

Teams building multi-tool AI agents on Bedrock who want fewer model round trips and smaller context use, and need to pick between self-hosted, managed or proxy setups.

Key points

  • Self-hosted option runs a Docker sandbox on ECS with no network and a read-only filesystem.
  • Managed option uses Amazon Bedrock AgentCore Code Interpreter with pre-loaded tool functions.
  • Proxy option lets the Anthropic SDK call Bedrock by changing base_url.
  • AWS reports 87-92% token reduction in its own expense-audit test; the test used eight team members and one task.

The same at other vendors