단계 5: Runtime 생성
cd /workspace/workshop-module-1/agentcore-reference && source .venv/bin/activateAgentCore Runtime 생성
python3 << 'PATCH'
import re
f = 'scripts/agentcore_agent_runtime.py'
c = open(f).read()
if '--disable-memory' in c:
print('Already patched')
else:
c = re.sub(r",\n\s+'--authorizer-config',[^\n]+", "", c)
c = c.replace("'--region', get_aws_region()\n ]",
"'--region', get_aws_region(),\n '--disable-memory'\n ]")
oauth = "f'\\n\\nyes\\n{oauth_discovery_url}\\n{oauth_client_id}\\n\\n\\n\\n' + 'no\\n' * 5"
if 'run_with_pty' in c:
s = c.index(" # Use pseudo-terminal")
e = c.index(" result = run_with_pty(configure_cmd, oauth_input)") + len(" result = run_with_pty(configure_cmd, oauth_input)")
c = c[:s] + f" result = subprocess.run(configure_cmd, check=False, capture_output=True, text=True, timeout=600, shell=False, input={oauth})" + c[e:]
elif "input='no\\n' * 10" in c:
c = c.replace("input='no\\n' * 10", f"input={oauth}")
open(f, 'w').write(c)
print('Patched: PTY -> subprocess.run + --disable-memory')
PATCH검증
콘솔 검증

코드 분석: 에이전트 런타임
TroubleshootingAgent 클래스 구조
시스템 프롬프트 핵심 구조
섹션
내용
목적
Dockerfile 분석
main.py 엔트리포인트
이 시점의 아키텍처
마지막 업데이트