agentix.providers.bedrock¶
bedrock ¶
AWS Bedrock model adapter (Converse API).
The Bedrock Converse API gives one uniform tool-use shape across every model
Bedrock hosts (Claude, Llama, Mistral, Nova, …), so a single adapter covers them
all — pick the model with model=<modelId>. Install with
pip install "agentix[bedrock]"; auth/region come from the standard AWS chain
(env vars, ~/.aws/config, instance role).
boto3 is synchronous, so each call is dispatched to a worker thread via
:func:asyncio.to_thread to keep the loop non-blocking. Pricing is account- and
region-specific — register it with :func:agentix.register_price if you want
cost_usd populated (otherwise 0.0).
BedrockModel ¶
BedrockModel(
*,
model: str,
max_tokens: int = 4096,
region_name: str | None = None,
client: Any = None,
**extra: Any,
)
A :class:~agentix.model.ModelFn backed by bedrock-runtime.converse.
model is a Bedrock model id or inference-profile id (e.g.
"anthropic.claude-3-5-sonnet-20241022-v2:0" or
"us.anthropic.claude-opus-4-..."). extra is forwarded to converse
(e.g. additionalModelRequestFields for thinking, guardrailConfig).
max_tokens sets inferenceConfig.maxTokens. For tests, inject
client= — any object with a sync converse(**kwargs).