Read model-id from SSM and pass to BedrockModel in main.py
This commit is contained in:
@@ -4,7 +4,9 @@ agent-claw Runtime 1 — main assistant agent.
|
||||
Entrypoint for AgentCore CodeZip deployment.
|
||||
"""
|
||||
import os
|
||||
import boto3
|
||||
from strands import Agent, tool
|
||||
from strands.models import BedrockModel
|
||||
from bedrock_agentcore.runtime import BedrockAgentCoreApp
|
||||
|
||||
from channels.telegram import TelegramAdapter
|
||||
@@ -15,6 +17,10 @@ from tools import messaging
|
||||
|
||||
app = BedrockAgentCoreApp()
|
||||
|
||||
# Read model ID from SSM once at module load (cached for warm invocations)
|
||||
_ssm = boto3.client("ssm", region_name=os.environ.get("AWS_REGION_NAME", "us-east-1"))
|
||||
_model_id = _ssm.get_parameter(Name="/agent-claw/model-id")["Parameter"]["Value"]
|
||||
|
||||
|
||||
# ── Tool definitions ──────────────────────────────────────────────────────
|
||||
|
||||
@@ -77,6 +83,7 @@ def main(payload: dict, context) -> dict:
|
||||
|
||||
# Create and run Strands agent
|
||||
agent = Agent(
|
||||
model=BedrockModel(model_id=_model_id),
|
||||
system_prompt=system_prompt,
|
||||
tools=[send_message, web_search, web_fetch, read_workspace_file, write_workspace_file],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user