Skip to content
BytePatterns

AIP-C01 · Domain 1: Foundation Model Integration, Data Management, and Compliance · 31% of the exam

Task 1.6: Implement prompt engineering strategies and governance for FM interactions.

Prompts as managed assets: templates and versions in Prompt management, conversation context, prompt testing and regression, structured output, and multi-step prompt flows.

Study it

Sample questions

Try each one before opening the answer. Every option is explained, with the AWS documentation page that proves it.

Question 1 · choose 1

Several applications use the same customer-letter prompt, which contains placeholders for the customer name, product and tone. Prompt changes are currently made in application code, so a wording change needs three deployments, and nobody can say which wording produced a complaint last month. The team wants one shared template with variables, side-by-side testing of alternative wordings, immutable snapshots that applications pin to, and invocation of the template directly through the Converse API. Which solution meets these requirements?

  1. AStore the template as a JSON file in a versioned Amazon S3 bucket and have each application download the latest version at startup
  2. BStore the template in an AWS Systems Manager Parameter Store parameter with a label for each approved wording
  3. CKeep the template in code but generate it with a shared library that every application imports as a dependency
  4. DUse Amazon Bedrock Prompt management with variables and variants, create versions, and call Converse with the version ARN
Show the answer and why
  • AStore the template as a JSON file in a versioned Amazon S3 bucket and have each application download the latest version at startup

    Incorrect

    S3 versioning keeps history, but there is no variant testing, and the applications still have to assemble the request because Converse cannot invoke a file in S3.

  • BStore the template in an AWS Systems Manager Parameter Store parameter with a label for each approved wording

    Incorrect

    Parameter Store can hold text with labels, but it offers no variant comparison and cannot be invoked as a prompt by the Converse API.

  • CKeep the template in code but generate it with a shared library that every application imports as a dependency

    Incorrect

    A shared library still ties every wording change to a build and deployment of each application.

  • DUse Amazon Bedrock Prompt management with variables and variants, create versions, and call Converse with the version ARN

    Correct

    Prompt management stores templates with variables, lets you compare variants, creates immutable versions, and Converse accepts a prompt ARN as the model ID with promptVariables to fill the placeholders.

Prompt management treats prompts as managed assets: variables, variants for comparison, a draft and immutable versions, and direct invocation by ARN. Pinning applications to a version answers "which wording produced this output", and the invocation logs record the requests.

Question 2 · choose 1

An insurer extracts claim fields from adjuster notes with the Converse API. A downstream service parses the output as JSON, and about 2% of responses fail parsing because of missing fields or extra commentary. Adding more examples to the prompt reduced the rate only slightly. The team needs every response to match a fixed schema without adding retry loops. What should the developer do?

  1. APass the JSON schema in outputConfig.textFormat so that structured outputs constrain the response
  2. BAsk for XML instead of JSON in the system prompt because models follow XML tags more reliably
  3. CLower the temperature to 0 and add a stop sequence after the closing brace of the JSON object
  4. DAdd a Lambda function that validates each response and calls the model again until the JSON parses
Show the answer and why
  • APass the JSON schema in outputConfig.textFormat so that structured outputs constrain the response

    Correct

    Structured outputs constrain the model response to the supplied JSON schema, which removes parsing failures without custom retry logic.

  • BAsk for XML instead of JSON in the system prompt because models follow XML tags more reliably

    Incorrect

    Changing the format does not change the fact that prompt-based formatting is not guaranteed, and the downstream service expects JSON.

  • CLower the temperature to 0 and add a stop sequence after the closing brace of the JSON object

    Incorrect

    A low temperature makes output more deterministic but does not guarantee schema compliance, and a stop sequence only cuts the output off.

  • DAdd a Lambda function that validates each response and calls the model again until the JSON parses

    Incorrect

    Validation and retry is the prompt-based approach that structured outputs replace. It adds latency and cost and still has a failure rate.

Prompting raises the odds of well-formed output; structured outputs guarantee it by constraining generation to a JSON schema. Remember the supported subset of JSON Schema Draft 2020-12: for example, minLength and numeric minimum or maximum are rejected with a 400 error.

Question 3 · choose 1

A bank wants a loan pre-check workflow: classify the applicant's request, then either summarize the applicant's documents from a knowledge base or draft a decline letter, depending on the classification, and finally have a Lambda function format the result. Business analysts will maintain the workflow in a visual builder, the prompts already exist in Amazon Bedrock Prompt management, and changes must be released and rolled back without editing application code. Which solution meets these requirements?

  1. AUse Amazon EventBridge rules that route the classifier's output to targets based on event patterns
  2. BCreate one long prompt in Prompt management that asks the model to classify, summarize or decline, and format the result
  3. CBuild an Amazon Bedrock flow with prompt, condition, knowledge base and Lambda nodes, and invoke it through an alias
  4. DWrite a Lambda function that calls the classifier, the knowledge base and the formatter in sequence with if-else logic
Show the answer and why
  • AUse Amazon EventBridge rules that route the classifier's output to targets based on event patterns

    Incorrect

    EventBridge routes events between services, but it does not hold the multi-step prompt chain, call the knowledge base, or provide versioned releases of the workflow.

  • BCreate one long prompt in Prompt management that asks the model to classify, summarize or decline, and format the result

    Incorrect

    A single prompt cannot query the knowledge base or run the Lambda formatter, and it makes the branching unpredictable.

  • CBuild an Amazon Bedrock flow with prompt, condition, knowledge base and Lambda nodes, and invoke it through an alias

    Correct

    Flows chain prompt nodes, condition nodes and knowledge base and Lambda function nodes in a visual builder. Applications call an alias that points to an immutable version, so releases and rollbacks are alias changes.

  • DWrite a Lambda function that calls the classifier, the knowledge base and the formatter in sequence with if-else logic

    Incorrect

    A single function works but puts the branching in code, so analysts cannot maintain it visually and each change needs a deployment.

Prompt chains with conditional branches and pre- and post-processing are what Bedrock Flows is for. Prompt nodes can reuse Prompt management prompts, and versions with aliases give release and rollback without code changes.

Question 4 · choose 1

A prompt asks a model to classify each customer email for a router that does exact string matching on eight category names. The model often replies with a free-form summary of the email, so routing fails. The team must ship a prompt-only fix today, without changing the model, the inference settings or the router code. Which change best follows Amazon Bedrock prompt guidance?

  1. AAdd a role line such as "You are an expert email analyst"
  2. BList the eight category names as the answer choices at the end of the prompt
  3. CAsk the model to explain its reasoning step by step before it classifies
  4. DAdd a stop sequence after the first line of the output
Show the answer and why
  • AAdd a role line such as "You are an expert email analyst"

    Incorrect

    A persona shapes tone and expertise, as in a support assistant with a set persona. It does not define which outputs are allowed.

  • BList the eight category names as the answer choices at the end of the prompt

    Correct

    Guidance for classification is to name the choices explicitly, because without them the model tends to produce a free-form summary, and to place the choices at the end of the prompt.

  • CAsk the model to explain its reasoning step by step before it classifies

    Incorrect

    Step-by-step reasoning helps with multi-step deductions. It adds text around the label that the router must match exactly.

  • DAdd a stop sequence after the first line of the output

    Incorrect

    A stop sequence ends generation after a given string. A first line that is part of a summary is still not a category name.

Classification prompts work best when the allowed answers are named and placed where the model reads the task: at the end.

Question 5 · choose 1

A contract assistant builds each prompt in this order: the user's question, a 40,000-token contract, then several paragraphs of background about the client. Everything fits in the model's context window, but the model often answers a different question or summarizes the background. Reviewers need answers that consider the whole contract, and the team wants to change only the prompt. Where should the question go?

  1. AAt the end of the prompt, after the contract and the background
  2. BIn a knowledge base query that retrieves only the most similar clauses
  3. CAt the top as now, with maxTokens raised so that the model has room to answer
  4. DAt the top, followed by an instruction to restate the question before answering
Show the answer and why
  • AAt the end of the prompt, after the contract and the background

    Correct

    Putting the task or question at the end helps the model determine which information it has to find and stay focused on the task.

  • BIn a knowledge base query that retrieves only the most similar clauses

    Incorrect

    Retrieval fits large or many documents. Reviewers need the whole contract considered, and it already fits in the context window.

  • CAt the top as now, with maxTokens raised so that the model has room to answer

    Incorrect

    A larger response length helps when answers are cut off. The problem is what the model answers, not how much room it has.

  • DAt the top, followed by an instruction to restate the question before answering

    Incorrect

    The question would still come before 40,000 tokens of other text, which is the placement that makes the model lose the task.

For open-book questions, put the document first and the question last.

Question 6 · choose 2

A summarization feature must show exactly three bullets of at most 20 words each for every support ticket. Some outputs are long essays, and some drift into advice the support team never gave. Text cut off in the middle of a sentence is not acceptable on screen, and the team wants a prompt fix it can test this week rather than a training project. Which changes address both problems? (Choose TWO.)

  1. ALower maxTokens to 60 tokens for every summary request
  2. BTell the model to summarize only what the ticket says, with no advice
  3. CFine-tune the model on 200 approved three-bullet summaries
  4. DState the format: exactly three bullets of at most 20 words each
  5. EAdd a stop sequence after the third bullet marker
Show the answer and why
  • ALower maxTokens to 60 tokens for every summary request

    Incorrect

    A response length limit caps tokens, and the model stops wherever the cap falls, often mid-sentence. It also does nothing about the advice.

  • BTell the model to summarize only what the ticket says, with no advice

    Correct

    Simple, clear and complete instructions reduce ambiguity about the task, including what the summary may contain.

  • CFine-tune the model on 200 approved three-bullet summaries

    Incorrect

    Fine-tuning learns a task from labeled examples. It is the training project the team wants to avoid.

  • DState the format: exactly three bullets of at most 20 words each

    Correct

    Output indicators describe constraints on the output, such as format and length, so the model produces the expected shape.

  • EAdd a stop sequence after the third bullet marker

    Incorrect

    A stop sequence ends generation after a given string. It does not make the model write bullets or stay on topic.

Tell the model what to produce and from what: a scope instruction controls content, and an output indicator controls shape and length.

Question 7 · choose 1

A bank's support chat runs on Amazon API Gateway and an AWS Lambda function that calls the Converse API. Customers switch between the mobile app and the website in the middle of a conversation and expect the assistant to remember earlier turns. The function runs in hundreds of concurrent execution environments, each stored turn must be deleted automatically about 30 days after it is written, and to bound token cost only the 20 most recent turns may be sent to the model. Which design meets these requirements?

  1. AKeep each conversation in a variable declared outside the Lambda handler
  2. BHave each client app send the full conversation history with every request
  3. CIngest each turn into a knowledge base and retrieve the most similar turns
  4. DStore turns in DynamoDB with a time sort key and TTL, and query the newest 20
Show the answer and why
  • AKeep each conversation in a variable declared outside the Lambda handler

    Incorrect

    A variable outside the handler exists only in one execution environment. Requests land in any of hundreds of environments that never see it, and Lambda replaces environments every few hours.

  • BHave each client app send the full conversation history with every request

    Incorrect

    Client-held history works when one client holds the whole conversation. Here the other device lacks the earlier turns, and the history is not trimmed.

  • CIngest each turn into a knowledge base and retrieve the most similar turns

    Incorrect

    A knowledge base suits retrieval over documents. New turns are searchable only after a sync, and similarity does not return the most recent turns in order.

  • DStore turns in DynamoDB with a time sort key and TTL, and query the newest 20

    Correct

    Query returns a conversation's items sorted by sort key, and ScanIndexForward false with Limit 20 reads the newest turns. A TTL attribute lets DynamoDB delete expired items automatically.

Conversation context must live outside stateless compute. A keyed store with ordered reads and expiry gives every device and every execution environment the same bounded history.

Question 8 · choose 1

A travel-policy assistant calls an Amazon Nova model on Amazon Bedrock through the Converse API. Each prompt holds the instructions, three example answers, this year's travel policy and last year's policy, which stays in the prompt because employees often ask what changed. Reviewers found two faults: some answers copy wording from the example answers as if it were policy, and some present last year's rules as current. The policy is revised several times a year, and the fix must ship this week on the same model. What should the developer do?

  1. ASet temperature to 0 and lower top P on every request
  2. BLoad both policies into a knowledge base and retrieve passages per question
  3. CWrap each part in its own named markers and point the instructions at them
  4. DFine-tune the model on approved answers drawn from the current policy
Show the answer and why
  • ASet temperature to 0 and lower top P on every request

    Incorrect

    Lower values make the model favor higher-probability tokens, so answers vary less. Nothing in the prompt changes, so the model still cannot tell an example from policy or this year's rules from last year's.

  • BLoad both policies into a knowledge base and retrieve passages per question

    Incorrect

    A knowledge base finds passages relevant to each query, which suits large document sets. It does not stop the model from copying the examples or mark which policy is current, and leaving last year's policy out would break the comparison questions.

  • CWrap each part in its own named markers and point the instructions at them

    Correct

    Clear delimiters, such as start and end markers or tags, help the model tell the parts of a prompt apart. The instructions can then name each part: answer from this year's policy, use last year's only to compare, and never repeat the examples.

  • DFine-tune the model on approved answers drawn from the current policy

    Incorrect

    Fine-tuning adjusts model parameters with labeled training data. Every policy revision would need new data and a new training job, which does not fit a fix this week, and it does not label the texts in the prompt.

When one prompt carries several kinds of text, delimit each part and refer to the parts by name in the instructions.

Practise domain 1 →Practise all domains →