에이전트 초기화 흐름
마지막 업데이트
마지막 업데이트
class TroubleshootingAgent:
def __init__(self, bearer_token, memory_hook=None,
bedrock_model_id="global.anthropic.claude-sonnet-4-20250514-v1:0"):
self.model = BedrockModel(model_id=self.model_id)
# Gateway URL 조회
gateway_url = get_ssm_parameter("/app/troubleshooting/agentcore/gateway_url")
self.tools = [current_time]
# MCP 클라이언트 초기화
if gateway_url and bearer_token != "dummy":
self.gateway_client = MCPClient(
lambda: streamablehttp_client(
gateway_url,
headers={"Authorization": f"Bearer {bearer_token}"},
)
)
self.gateway_client.start()
mcp_tools = self.gateway_client.list_tools_sync()
self.tools.extend(mcp_tools)
# Agent 생성
self.agent = Agent(
model=self.model,
system_prompt=self.system_prompt,
tools=self.tools,
hooks=[self.memory_hook] if self.memory_hook else [],
)**CRITICAL DATABASE CONNECTIVITY RULES:**
- Source: ALWAYS use EC2 instance ID (e.g., i-1234567890abcdef0) - NEVER use IPs
- Database Destination: If "database" in hostname, ALWAYS use resolved IP address
- Port: Database connections default to port 3306 (MySQL)
- Protocol: Use TCP for database connections
- CRITICAL: NEVER use action="fix" without explicit user consent