인사이트 조사 결과에서 권장 사항 생성
인사이트 결과를 검토한 후 동일한 에이전트 추적을 사용하여 향상된 시스템 프롬프트를 생성할 수 있습니다. 인사이트 조사 결과를 생성한 완료된 배치 평가를 StartRecommendation 가리킵니다.
권장 사항 생성은 현재 Builtin.Insight.FailureAnalysis 인사이트에만 지원되며, 현재는 시스템 프롬프트 권장 사항만 제공됩니다.
시스템 프롬프트 권장 사항 시작
현재 시스템 프롬프트를 제공하고 트레이스가 포함된 배치 평가를 참조합니다.
예
- AgentCore CLI
-
완료된 인사이트 실행에서 권장 사항을 생성합니다.
agentcore run recommendation --from-insights <id> --type system-prompt --bundle-name my_bundle --json
또는 배치 평가 ARN을 직접 참조합니다.
agentcore run recommendation --batch-evaluation-arn <arn> --type system-prompt --bundle-name my_bundle --json
- Interactive
-
-
를 실행agentcore하여 TUI를 연 다음 실행을 선택하고 권장 사항을 선택합니다.
마법사는 트레이스 소스(인사이트 실행 또는 배치 평가 ARN), 권장 사항 유형 및 구성 번들을 선택하는 방법을 안내합니다.
- AWS SDK (boto3)
-
import boto3
import uuid
client = boto3.client("bedrock-agentcore", region_name="us-west-2")
response = client.start_recommendation(
name=f"fix-rate-limiting-{uuid.uuid4().hex[:8]}",
type="SYSTEM_PROMPT_RECOMMENDATION",
recommendationConfig={
"systemPromptRecommendationConfig": {
"systemPrompt": {
"text": "You are a helpful customer support assistant. Help users with their orders and returns."
},
"agentTraces": {
"batchEvaluation": {
"batchEvaluationArn": "arn:aws:bedrock-agentcore:us-west-2:123456789012:batch-evaluate/insights-run-ABC1234567"
}
},
}
},
clientToken=str(uuid.uuid4()),
)
recommendation_id = response["recommendationId"]
print(f"Started recommendation: {recommendation_id}")
권장 프롬프트 검색
폴링이 완료될 때까지 폴링한 다음 결과를 검색합니다.
import time
while True:
rec = client.get_recommendation(recommendationId=recommendation_id)
if rec["status"] in ("COMPLETED", "FAILED"):
break
time.sleep(15)
if rec["status"] == "COMPLETED":
result = rec["recommendationResult"]["systemPromptRecommendationResult"]
print(f"Recommended prompt:\n{result['recommendedSystemPrompt']}")
print(f"\nExplanation:\n{result['explanation']}")
대체 추적 소스
배치 평가를 참조하는 대신 CloudWatch Logs를 통해 추적을 제공할 수도 있습니다.
"agentTraces": {
"cloudwatchLogs": {
"logGroupArns": [
"arn:aws:logs:us-west-2:123456789012:log-group:/aws/bedrock-agentcore/runtimes/MyAgent-abc123-DEFAULT"
],
"serviceNames": ["MyAgent.DEFAULT"],
"startTime": "2026-05-27T00:00:00Z",
"endTime": "2026-06-03T00:00:00Z",
}
}