Comparison

    Bedrock InvokeModel vs Converse API: How Payload Formats Change Inspection and Redaction

    InvokeModel carries model-specific JSON in its request and response bodies, so an inspection control needs a parser for each model family. Converse uses one unified message schema, so a single parser can cover system prompts, message history, tool blocks and document or image content. Both formats have streaming variants, and each can carry sensitive data in several places. A control that handles only one format, or only the first user message, will miss content. Design extraction per format, apply one policy to the extracted content, and retain evidence of what was inspected and changed.

    Evidence to retain for each interaction

    • Request identifier, timestamp, caller identity and the API operation used
    • Payload format and the extractor that parsed it
    • Policy name and version applied
    • Findings by type and by location, such as system prompt, message index or tool result
    • Action taken for each finding: allow, redact or block
    • For streams, where in the response an intervention occurred and what the caller received

    Why the payload format matters to a security control

    Prompts sent to a model API often contain more than the author of the application intended. Users paste internal documents, customer records and credentials. Applications add retrieved context. Models then generate output that can repeat or transform that material. Any control that inspects and redacts this traffic has to find the text first, and where the text sits depends on which API the caller used.

    Regulated enterprises commonly use both InvokeModel and Converse, sometimes in the same account and sometimes in the same application. InvokeModel passes a body whose structure is defined by the model being called. Converse wraps the interaction in a common message structure regardless of model. A detector written against one shape can silently return no findings on the other, because the fields it looks for are absent or named differently. The failure mode is not an error. It is a clean result on content that was never examined.

    Where sensitive data can appear in each format

    The table summarizes the inspection concerns that differ most. The detail inside each field varies by model under InvokeModel, so treat it as a checklist of locations to cover, not a field reference.

    • Request structure: InvokeModel: a model-specific JSON body, so the location of the prompt depends on the model family. Converse: a common message structure with typed content blocks.
    • System prompts: InvokeModel: may sit in a dedicated field or be folded into the prompt text, depending on the model. Converse: carried separately from the conversation, so it must be extracted separately.
    • Multi-turn history: InvokeModel: history is encoded in whatever form the model body expects. Converse: an ordered array of messages with roles. Earlier turns can hold data that the latest turn does not.
    • Tool use and tool results: InvokeModel: represented in model-specific structures where supported. Converse: distinct tool use and tool result blocks. Tool arguments and returned records can contain regulated data.
    • Documents and images: InvokeModel: embedded according to the model's schema. Converse: dedicated content block types. Text inside a document or image needs extraction before it can be inspected.
    • Response body: InvokeModel: model-specific output structure. Converse: a consistent output message. Both can contain generated text, tool requests and echoed input.

    What differs in practice: parsing versus normalizing

    With InvokeModel, the extraction step is the hard part. Each model family you allow needs a mapping from its body schema to the text and structured values that policy should see. New models or changed body formats require new mappings. If the control cannot parse a body, it must decide whether to allow, block or escalate. Defaulting to allow is the common and most dangerous choice.

    With Converse, extraction is simpler because the schema is shared, but coverage is easy to overstate. The message array, the system prompt, tool use blocks, tool result blocks and document or image blocks are all separate places. An implementation that inspects only the text of the last user message misses most of them. Tool results deserve particular attention because they often hold the most sensitive data in the exchange: database rows, file contents or API responses that the user never typed.

    The practical approach is to normalize. Write a per-format extractor that outputs a common internal representation, a list of content segments with a location label such as system, message index, tool result or response. Run detection and redaction against that representation, then write changes back into the original structure so the call still validates. Keeping the location label also makes the evidence more useful later.

    Streaming responses: InvokeModelWithResponseStream and ConverseStream

    Streaming changes the enforcement problem because the response arrives in pieces. A sensitive value can be split across chunks, so inspecting each chunk alone can miss it. Redacting after the caller has already received the text is too late.

    There are three common designs. The first buffers the full response, inspects it and releases it, which gives complete coverage but removes the benefit of streaming. The second holds a sliding window of recent content and releases text only after it has been checked, which keeps latency low but means a match that straddles the window edge needs deliberate handling. The third passes chunks through and terminates the stream on a policy hit, which is fast but means some content may already have been delivered. Which one fits depends on the data class and the consequence of partial exposure.

    Decide in advance what happens on a mid-stream hit: redact and continue, replace the remainder with a notice, or end the stream with an error the application can handle. Record the decision either way. Streaming formats also differ between InvokeModel and Converse in how events are structured, so the stream reader needs the same per-format treatment as the request parser.

    Designing inspection that works across both formats

    Place the control where it sees every call before it reaches the model and every response before it reaches the caller. Provider-side detection, including Amazon Bedrock Guardrails and the ApplyGuardrail API, can be one input to this design. Test any such feature against both formats and both streaming variants rather than assuming equal coverage, and check what record of each decision it produces. An in-path layer is where you apply your own policy consistently and retain your own evidence.

    The steps below describe a workable sequence.

    • Inventory which operations and model families your applications call, including streaming variants.
    • Build an extractor per format that emits labeled content segments, and fail closed on bodies it cannot parse.
    • Apply one policy to all segments, with an outcome of allow, redact or block for each finding.
    • Write redactions back into the original structure and confirm the call still validates.
    • Inspect responses and stream events with the chosen buffering approach.
    • Test with fixtures containing sensitive values in every location listed in the table.

    Where Trussed fits

    Trussed enforces policy in the execution path across models, agents and tools, with outcomes of allow, redact or block on individual interactions and tool calls. Enforcement happens at runtime, not after the fact, and it generates audit-ready evidence mapped to frameworks such as HIPAA, NYDFS and NIST. It can be deployed self-managed in the customer cloud, with configurable retention and data residency.

    The design questions above apply whatever tool you use. Check that the control parses every payload shape you allow, handles streaming deliberately, and records each decision in a form an auditor can read.

    Two formats, one enforcement point

    InvokeModel

    Model-specific JSON bodies that require per-model extraction.

    Converse

    Unified message schema with typed content blocks.

    Streaming variants

    Incremental responses that must be inspected before they reach the caller.

    Policy and evidence

    One policy applied to extracted content, with a record of the decision.

    Review your Bedrock enforcement path

    Walk through how policy is enforced in the execution path and what evidence each decision produces.

    Talk to an Expert