Module bedrock

Module bedrock 

Source
Expand description

The AWS Bedrock provider adapter (AI-01).

AWS Bedrock hosts foundation models (Anthropic Claude, Meta Llama, Mistral, etc.) behind a unified invoke API. For Claude models, Bedrock’s InvokeModel endpoint accepts the SAME Anthropic messages body format as the native Anthropic API (POST /v1/messages), so this adapter DELEGATES the body translation to the Anthropic adapter and OVERRIDES the path to the Bedrock invoke format:

POST /model/{provider_model}/invoke

where {provider_model} is the Bedrock model identifier (e.g. anthropic.claude-3-5-sonnet-20241022-v2:0).

§SigV4 signing

Bedrock requires AWS Signature Version 4 (SigV4) on every request. SigV4 is a request-signing scheme that adds an Authorization header computed from the AWS access key ID, secret access key, region, service name (bedrock), and the canonical request (method, path, headers, body hash). The signing is applied by the TRANSPORT layer (the dataplane’s ai_proxy), not the adapter — the adapter is a pure translator and never touches credentials. The operator configures AWS credentials via the provider’s auth header (the transport applies them) or via environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION) that the transport resolves at request time.

In the current implementation, SigV4 signing is NOT yet wired in the transport — the adapter produces the correct path and body, but the transport applies the verbatim auth header from the provider’s config (the same mechanism every other provider uses). A future extension will add SigV4 signing as a transport-level concern. Until then, Bedrock providers that accept a static API key (or a proxy that handles signing upstream) work unchanged; raw Bedrock endpoints requiring SigV4 will return 403 until the signing is wired.

§Streaming

Bedrock streaming uses a different endpoint (/model/{id}/invoke- with-response-stream) and a different event format (AWS Event Stream, not SSE). The current adapter does NOT translate Bedrock streaming events; a streaming request to a Bedrock provider will fall back to non-streaming (the stream flag is dropped). A future extension will add Bedrock event-stream parsing.

Structs§

BedrockAdapter
The AWS Bedrock adapter (AI-01). Stateless singleton; delegates body translation to the Anthropic adapter (Bedrock Claude models use the Anthropic messages format) and overrides the path to the Bedrock invoke format.