Make agent and compaction model IDs configurable via SSM
This commit is contained in:
25
agentclaw/app/agent_claw_main/config.py
Normal file
25
agentclaw/app/agent_claw_main/config.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""Config loader — fetches model IDs from SSM Parameter Store at cold start."""
|
||||
|
||||
import boto3
|
||||
|
||||
_DEFAULTS = {
|
||||
'/agent-claw/config/agent_model_id': 'us.anthropic.claude-sonnet-4-6',
|
||||
'/agent-claw/config/compaction_model_id': 'us.anthropic.claude-3-5-haiku-20241022-v1:0',
|
||||
}
|
||||
|
||||
|
||||
def _load():
|
||||
ssm = boto3.client('ssm', region_name='us-east-1')
|
||||
names = list(_DEFAULTS.keys())
|
||||
try:
|
||||
resp = ssm.get_parameters(Names=names)
|
||||
found = {p['Name']: p['Value'] for p in resp['Parameters']}
|
||||
except Exception:
|
||||
found = {}
|
||||
return {name: found.get(name, default) for name, default in _DEFAULTS.items()}
|
||||
|
||||
|
||||
_params = _load()
|
||||
|
||||
AGENT_MODEL_ID: str = _params['/agent-claw/config/agent_model_id']
|
||||
COMPACTION_MODEL_ID: str = _params['/agent-claw/config/compaction_model_id']
|
||||
Reference in New Issue
Block a user