Expand description
Amazon Bedrock Converse API adapter. Pure translation, no I/O; the SigV4
signing that authenticates the dial is a separate axis
([crate::auth::aws], applied by the transport in super::endpoints).
Converse is Bedrock’s provider-neutral chat surface, so agentd speaks ONE dialect to every Bedrock model (Anthropic, Llama, Titan, …). It differs from both in-binary dialects in ways the loop never sees:
- the model id rides the URL path (
/model/{modelId}/converse), not the body — so there is nomodelfield here (seeconverse_path); - content is a list of blocks keyed by shape (
{"text":…},{"toolUse":…},{"toolResult":…}) — notypetag; systemis a block list, inference knobs live underinferenceConfig, and tools undertoolConfig.tools[].toolSpecwith the JSON Schema nested one level asinputSchema.json;- Bedrock validates strict user/assistant alternation, so consecutive same-role turns (notably the N tool results of one assistant turn) are merged into a single message with N content blocks.
Auth is SigV4 only (no bearer/api-key), so token is ignored here.
Constants§
- DEFAULT_
PATH - A placeholder default path. Bedrock’s real path is computed per-request from
the model id (
converse_path); this is only the host-only resolve-time fallback and is always overridden before a dial.
Functions§
- build_
request - Build the Converse request body (JSON bytes) + headers.
tokenis ignored — Bedrock authenticates by SigV4 (added by the transport), never a bearer. - converse_
path - The Converse request path for
model:/model/{modelId}/converse. The model id is a single opaque path parameter, so it is fully percent-encoded (unreservedA-Za-z0-9-._~pass; everything else — notably the:of a versioned id like…-v2:0, and the://of an inference-profile ARN — becomes%XX). This exact string is BOTH sent on the wire and fed to the SigV4 signer, so the canonical URI the signature covers matches the request-target byte-for-byte (the signer does not re-encode). - parse_
response - Parse a Converse response body into the neutral
Response. Tolerant: missing usage → zero; an unknown stop reason →StopReason::Other.