Class: ActiveAgent::Providers::Bedrock::Options

Inherits:
Common::BaseModel show all
Defined in:
lib/active_agent/providers/bedrock/options.rb

Overview

Configuration for AWS Bedrock provider.

AWS credentials are resolved in order:

  1. Explicit options (aws_access_key, aws_secret_key)

  2. Environment variables (AWS_REGION, AWS_ACCESS_KEY_ID, etc.)

  3. AWS SDK default chain (profiles, IAM roles, instance metadata)

Unlike the Anthropic provider, no API key is needed — authentication is handled entirely through AWS credentials.

Examples:

Minimal config (uses SDK default chain)

Bedrock::Options.new(aws_region: "eu-west-2")

Explicit credentials

Bedrock::Options.new(
  aws_region: "eu-west-2",
  aws_access_key: "AKIA...",
  aws_secret_key: "..."
)

With profile

Bedrock::Options.new(
  aws_region: "eu-west-2",
  aws_profile: "my-profile"
)

Instance Method Summary collapse

Methods inherited from Common::BaseModel

#<=>, #==, attribute, #deep_compact, #deep_dup, delegate_attributes, drop_attributes, inherited, #inspect, keys, #merge!, required_attributes, #to_h, #to_hash

Constructor Details

#initialize(kwargs = {}) ⇒ Options

Returns a new instance of Options.



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/active_agent/providers/bedrock/options.rb', line 48

def initialize(kwargs = {})
  kwargs = kwargs.deep_symbolize_keys if kwargs.respond_to?(:deep_symbolize_keys)

  super(**deep_compact(kwargs.except(:default_url_options).merge(
    aws_region:        kwargs[:aws_region]        || ENV["AWS_REGION"] || ENV["AWS_DEFAULT_REGION"],
    aws_access_key:    kwargs[:aws_access_key]    || ENV["AWS_ACCESS_KEY_ID"],
    aws_secret_key:    kwargs[:aws_secret_key]    || ENV["AWS_SECRET_ACCESS_KEY"],
    aws_session_token: kwargs[:aws_session_token] || ENV["AWS_SESSION_TOKEN"],
    aws_profile:       kwargs[:aws_profile]       || ENV["AWS_PROFILE"],
    aws_bearer_token:  kwargs[:aws_bearer_token]  || ENV["AWS_BEARER_TOKEN_BEDROCK"]
  )))
end

Instance Method Details

#extra_headersObject

Bedrock handles authentication at the client level (SigV4 or bearer token), so no extra headers are needed in request options.



63
64
65
# File 'lib/active_agent/providers/bedrock/options.rb', line 63

def extra_headers
  {}
end

#serializeObject

Excludes sensitive AWS credentials from serialized output. The provider’s client() method reads credentials directly from options attributes.



69
70
71
72
73
# File 'lib/active_agent/providers/bedrock/options.rb', line 69

def serialize
  attributes.symbolize_keys.except(
    :aws_access_key, :aws_secret_key, :aws_session_token, :aws_profile, :aws_bearer_token
  )
end