AWS Certified Developer – Associate
Bedrock Converse API, tool use and prompt caching for DVA-C03
The Amazon Bedrock User Guide says the Converse API gives one message-based request format for every Bedrock model that supports messages, on the bedrock-runtime endpoint. With toolConfig the model asks for a tool and your code runs it. Prompt caching reuses a static prompt prefix to cut latency and input token cost.
What is the Converse API?
The DVA-C03 exam guide lists "Integrate managed AWS AI services into applications" as content added to Task 1.1 since DVA-C02, and Amazon Bedrock is on its in-scope services list.
The Converse API is the Converse and ConverseStream operations. It is available on the bedrock-runtime endpoint only. InvokeModel also works for conversations, but each model expects its own request body. Converse uses the same structure for all models that support messages, so the code is written once.
modelId names the model or other resource to run. messages is an array in which each message has a role of user or assistant and a content array. system holds system prompts. inferenceConfig holds the common parameters maxTokens, temperature, topP and stopSequences, and additionalModelRequestFields carries model-specific ones.
Bedrock does not store the content you send. To keep context, include all earlier messages in each request. Calling Converse needs the bedrock:InvokeModel permission, and ConverseStream needs bedrock:InvokeModelWithResponseStream. The response has output, stopReason, usage and metrics.
How does tool use work?
The model never calls a tool directly. You send tool definitions with the message, and the model decides when one is needed. In Converse a definition is a toolSpec with a name, a description and an inputSchema, inside toolConfig.
Client-side tool use is available with the Responses, Chat Completions, Converse and InvokeModel APIs. In Converse the response comes back with a stopReason of tool_use and a toolUse block that holds the toolUseId, the tool name and the input. Your code runs the tool, then sends another Converse request with a user message that contains a toolResult with the same toolUseId. The model then writes its final answer.
Server-side tool use means Amazon Bedrock runs the tool. You register a Lambda function or an AgentCore Gateway and Bedrock invokes it for the model. The guide says this mode is currently available on the Responses API.
Prompt caching, batch inference and inference profiles
Prompt caching has two types. Implicit caching needs no change to the request and is best effort; put static content first and changing content last. Explicit caching uses cache checkpoints, a cachePoint in the Converse API. The whole prefix before a checkpoint must meet the model's minimum, which ranges from 512 to 4,096 tokens. Below the minimum the request still succeeds but nothing is cached.
The cache has a time to live that resets on each hit, and many models use 5 minutes. Tokens read from the cache are billed at the cache-read rate, and tokens written at the cache-write rate, which can be higher than the standard input rate. Prompt caching works with on-demand inference and not with the batch inference API.
Batch inference handles many prompts asynchronously. You put model inputs in files in an S3 bucket, submit one job, and collect the output files from S3. Inputs use the InvokeModel or Converse format. A Converse-format job does not support tool calling, and batch inference is not supported for provisioned models.
An inference profile defines a model and the Regions that requests can be routed to. Cross-Region profiles are predefined by Bedrock. An application inference profile is one you create to track usage and cost, with tags that work for cost allocation. You use a profile by passing its ARN when you call InvokeModel or Converse.
Where the exam catches people
- Believing
Converseis called on the Bedrock control plane endpoint: the Converse API is available onbedrock-runtimeonly. - Believing Bedrock runs your tool when
Conversereturns a tool request: with Converse your application runs it and sends back atoolResult. Server-side tool use is on the Responses API. - Believing a cache checkpoint placed before the long static content caches it: a checkpoint caches the prefix that comes before it, and that prefix must meet the model's minimum token count.
- Believing prompt caching also applies to batch inference jobs: it is supported for on-demand inference only.
- Believing tags in
requestMetadatasplit model cost by team: tags on an application inference profile do that.
Written from these sources
- Inference using Converse API
- Use a tool to complete an Amazon Bedrock model response
- Client-side tool use
- Prompt caching for faster model inference
- Process multiple prompts with batch inference
- Set up a model invocation resource using inference profiles
- Comparison of DVA-C02 and DVA-C03
- DVA-C03 in-scope AWS services