@galdor/provider-bedrock
v0.3.1
Published
Amazon Bedrock (Anthropic Claude on the Bedrock Runtime) provider adapter for galdor-bun.
Readme
@galdor/provider-bedrock
The Amazon Bedrock provider adapter for
galdor, speaking the Bedrock Runtime
Converse API. Implements the core Provider interface, so it drops into any
graph, agent, or council. Also ships a Bedrock embedder (Amazon Titan /
Cohere) for the memory stack.
Bundles the full AWS credential chain, SigV4 request signing, and an
event-stream decoder — no AWS SDK client required. Covers generate + streaming,
tool calling, vision, reasoning/thinking (with signature and redacted-thinking
round-trips), the typed error taxonomy with Retry-After, and cancellation.
Install
bun add @galdor/provider-bedrock # or: npm install @galdor/provider-bedrockCredentials
Resolved by the AWS default provider chain (environment variables → shared
~/.aws config → ECS container credentials → EC2 IMDS / task role). Only
region is required; static keys are optional.
Usage
import { newBedrock } from "@galdor/provider-bedrock";
import { userMessage, messageText } from "@galdor/core/schema";
const provider = newBedrock({ region: "us-east-1" }); // default AWS chain
const res = await provider.generate({
model: "anthropic.claude-3-haiku-20240307-v1:0",
messages: [userMessage("Explain MCP in one sentence.")],
});
console.log(messageText(res.message), res.usage);Embeddings
import { newEmbedder } from "@galdor/provider-bedrock"; // re-exported from the package entry
const embedder = newEmbedder({ region: "us-east-1", model: "amazon.titan-embed-text-v2:0", dim: 1024 });
const [vec] = await embedder.embed(["quito ecuador capital"]);Titan and Cohere embedding families are supported; unknown model ids are rejected at construction, and throttling/5xx responses are retried with backoff.
License
Apache-2.0
