Certopolis

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 Converse is called on the Bedrock control plane endpoint: the Converse API is available on bedrock-runtime only.
  • Believing Bedrock runs your tool when Converse returns a tool request: with Converse your application runs it and sends back a toolResult. 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 requestMetadata split model cost by team: tags on an application inference profile do that.

Written from these sources

Try 3 questions on this

Pick an answer to see why each option is right or wrong.

  1. A developer's application calls Amazon Bedrock models from two different providers. Each provider expects a different request body, so the developer maintains separate request code for each model. The developer wants one message-based request format that works across the Bedrock models that support messages. Which solution will meet these requirements?

    Right. In the game that’s Renown for your Development with AWS Services building.

    Not that one: A is right. In the game your Development with AWS Services building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    Each turn goes in the messages field with a user or assistant role. The API is served only by the bedrock-runtime endpoint.

    Written from docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html

  2. A developer is adding a tool to an Amazon Bedrock application so that the model can get the current balance of a customer's loyalty account from an internal HTTPS service. Whenever the model asks for a balance, the service must be called and the balance must be returned to the model so that it can finish its answer. Which solutions will meet these requirements? (Select TWO.)

    Right. In the game that’s Renown for your Development with AWS Services building.

    Not that one: A,D is right. In the game your Development with AWS Services building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    In server-side tool use, currently available on the Responses API, the developer registers a Lambda function or an AgentCore Gateway and Bedrock invokes the tool on the model's behalf. Either one gets the balance to the model.

    Written from docs.aws.amazon.com/bedrock/latest/userguide/tool-use.html

  3. A support chatbot sends Amazon Bedrock Converse requests that each contain 200 tokens of fixed instructions, then the same 3,000-token product manual, then the user's question. The model supports implicit and explicit prompt caching, with a minimum of 1,024 tokens per cache checkpoint. The developer must cut input token cost and latency for the repeated content. Which solutions will meet these requirements? (Select TWO.)

    Right. In the game that’s Renown for your Development with AWS Services building.

    Not that one: B,C is right. In the game your Development with AWS Services building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    Explicit caching uses cache checkpoints, and a checkpoint caches the prefix before it only if that prefix meets the model's minimum token count. A checkpoint after the manual has a 3,200-token prefix, so it caches. Either approach cuts input token cost and latency for the repeated instructions and manual.

    Written from docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html

Ask for something