Configuration System¶
The Bedrock Swarm configuration system provides a structured way to configure AWS credentials and other system settings.
AWS Configuration¶
The primary configuration class is AWSConfig, which manages AWS credentials and settings:
from bedrock_swarm.config import AWSConfig
# Basic configuration
config = AWSConfig(
region="us-west-2"
)
# Configuration with profile
config = AWSConfig(
region="us-west-2",
profile="development"
)
# Configuration with custom endpoint
config = AWSConfig(
region="us-west-2",
profile="development",
endpoint_url="https://custom.endpoint"
)
Configuration Options¶
The AWSConfig class supports these options:
region(required): The AWS region to use (e.g., "us-west-2")profile(optional): AWS profile name from your credentials fileendpoint_url(optional): Custom endpoint URL for AWS services
Usage with Agency¶
The configuration can be used when creating an agency:
from bedrock_swarm.agency import Agency
from bedrock_swarm.config import AWSConfig
# Create AWS configuration
aws_config = AWSConfig(
region="us-west-2",
profile="development"
)
# Create agency with configuration
agency = Agency(
aws_config=aws_config,
agents=[...]
)
Best Practices¶
-
Environment Variables: Use environment variables for sensitive information:
-
Profile Management: Use AWS profiles to manage multiple configurations:
-
Custom Endpoints: Use custom endpoints for testing or special setups:
Security Considerations¶
- Never hardcode AWS credentials in your code
- Use IAM roles and temporary credentials when possible
- Follow the principle of least privilege when setting up AWS permissions
- Regularly rotate credentials and audit access
Configuration Validation¶
The configuration system validates: - Required region parameter - Valid AWS region format - Valid endpoint URL format (if provided) - Profile name format (if provided)
Error Handling¶
Common configuration errors: