Skip to main content

Bedrock

memledger uses Amazon Bedrock for two distinct paths:

PathDefault modelWhy Bedrock
Embeddingsamazon.titan-embed-text-v2:0 (1024-dim)Native AWS, no API key on the agent pod
LLM-as-judge (RAGAS Tier 2)bedrock/us.anthropic.claude-sonnet-4-6 (LiteLLM-routed)Same IRSA covers both paths

Both paths authenticate via the agent pod's IRSA credentials — no API keys, no static secrets.

Embedding configuration

from memledger.models import EmbeddingConfig

embedding_config = EmbeddingConfig(
provider="bedrock",
model="amazon.titan-embed-text-v2:0",
dimensions=1024,
)

EmbeddingConfig does not accept a region parameter. The Bedrock region resolves through the standard AWS SDK chain:

  1. AWS_REGION env var
  2. AWS_DEFAULT_REGION env var
  3. boto3 session region (~/.aws/config + active profile)

LLM-as-judge configuration

The RAGAS Tier 2 judge model is selected via env:

export MEMLEDGER_JUDGE_MODEL=bedrock/us.anthropic.claude-sonnet-4-6

LiteLLM routes the call. Auth uses the same IRSA credentials as the embedding path — the IRSA role just needs bedrock:InvokeModel on both ARNs.

Cross-region inference profiles use the us.anthropic.<family>-<size>-<version> form. See LiteLLM's provider list for the full set of supported model strings.

IRSA policy

{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": ["bedrock:InvokeModel"],
"Resource": [
"arn:aws:bedrock:<region>::foundation-model/amazon.titan-embed-text-v2:0",
"arn:aws:bedrock:<region>::foundation-model/us.anthropic.claude-sonnet-4-*"
]
}]
}

Model access

Before the first call, request access to the model in the Bedrock console under "Model access". Approval is typically immediate for Titan and minutes for Claude. The IAM policy above won't grant invocation rights until model access is approved.

When not to use Bedrock

  • You need a non-Bedrock model in the same workload — use any LiteLLM provider (OpenAI, Anthropic direct, Ollama, vLLM, etc.).
  • You want lower-cost embeddings — use local fastembed (see the OSS Quickstart).
  • You need an embedding dim other than 1024 — match your storage backend's vector column dimension; switching providers across a dim boundary requires re-indexing.

Validated against

See Backend Validation for the smoke-test transcripts that exercise Bedrock embeddings against Aurora and OpenSearch.

Next steps