흐름 실행 시작
흐름 실행을 실행하려면 Amazon Bedrock Agents 런타임 엔드포인트를 사용하여 StartFlowExecution 요청을 전송합니다. 요청에서 실행하려는 흐름의 흐름 ID와 흐름 별칭 ID를 지정합니다. 다음을 지정할 수도 있습니다.
{
"inputs": [{
"nodeName": "FlowInputNode",
"nodeOutputName": "document",
"content": {
"document": "Test"
}
}],
"name": "MyExecution"
}
응답은 흐름 실행의 Amazon 리소스 이름(ARN)입니다. executionArn을 사용하여 흐름 실행이 완료되거나 조건 노드가 조건을 평가하는 경우와 같이 흐름의 현재 상태를 폴링할 수 있습니다.
{
"executionArn": "arn:aws:bedrock:us-west-2:111122223333:flow/FLOWID/alias/TSTALIASID/execution/MyExecution"
}
흐름 실행 진행 상황 추적
GetFlowExecution 작업을 사용하여 실행 ARN으로 식별하는 흐름의 현재 상태를 가져옵니다. 흐름 상태는 Running, Succeeded, Failed, TimedOut 또는 Aborted입니다.
{
"endedAt": null,
"errors": null,
"executionArn": "arn:aws:bedrock:us-west-2:111122223333:flow/FLOWID/alias/TSTALIASID/execution/MyExecution",
"flowAliasIdentifier": "TSTALIASID",
"flowIdentifier": "FLOWID",
"flowVersion": "DRAFT",
"startedAt": "2025-03-20T23:32:28.899221162Z",
"status": "Running"
}
오류(예: 제한 시간이 초과된 Lambda 노드)는 다음 예제와 같이 errors 배열에 반환됩니다.
"errors": [{
"nodeName": "LambdaNode1",
"errorType": "ExecutionTimedOut",
"message": "Call to lambda function timed out"
}],
흐름 실행 결과 가져오기
Amazon Bedrock은 흐름의 출력을 흐름의 출력 노드에 씁니다. 흐름이 완료되거나 흐름이 실행되는 동안(사용 사례에 따라 다름) 출력을 가져올 수 있습니다.
흐름이 먼저 완료되도록 하려면 GetFlowExecution을 직접 호출하고 응답의 status 필드 값이 Succeeded인지 확인합니다.
흐름 실행에서 출력 이벤트 목록을 가져오려면 ListFlowExecutionEvents를 직접 호출합니다. 응답에서 flowExecutionEvents의 flowOutputEvent 객체를 확인합니다. 예를 들어 content 필드에서 흐름의 출력을 가져올 수 있습니다.
{
"flowOutputEvent": {
"content": {
"document": "The model response."
},
"nodeName": "FlowOutputNode"
}
}
eventType 쿼리 파라미터를 Flow로 설정하여 ListFlowExecutions의 출력을 입력 및 출력 노드로만 제한할 수 있습니다.
이벤트 보기
흐름 실행을 디버깅하기 위해 ListFlowExecutionEvents 작업을 사용하여 흐름이 실행되는 동안 노드가 생성하는 이벤트를 볼 수 있습니다. 다음 예제와 유사한 응답에서 모든 노드(중간 노드 포함)의 입력 및 출력을 보려면 eventType 쿼리 파라미터를 Node로 설정합니다.
{
"flowExecutionEvents": [{
"nodeOutputEvent": {
"fields": [{
"content": {
"document": "History book"
},
"name": "document"
}],
"nodeName": "FlowInputNode",
"timestamp": "2025-05-05T18:38:56.637867516Z"
}
},
{
"nodeInputEvent": {
"fields": [{
"content": {
"document": "History book"
},
"name": "book"
}],
"nodeName": "Prompt_1",
"timestamp": "2025-05-05T18:38:57.434600163Z"
}
},
{
"nodeOutputEvent": {
"fields": [{
"content": {
"document": "Here's a summary of the history book."
},
"name": "modelCompletion"
}],
"nodeName": "Prompt_1",
"timestamp": "2025-05-05T18:39:06.034157077Z"
}
},
{
"nodeInputEvent": {
"fields": [{
"content": {
"document": "Here's a summary of the history book."
},
"name": "document"
}],
"nodeName": "FlowOutputNode",
"timestamp": "2025-05-05T18:39:06.453128251Z"
}
}
]
}
흐름 실행의 스냅샷 가져오기
Amazon Bedrock은 흐름 실행이 시작될 때 흐름 정의 및 메타데이터의 스냅샷을 자동으로 생성합니다. 이는 흐름이 비동기적으로 실행되는 동안 흐름을 업데이트할 수 있기 때문에 유용합니다. 이 스냅샷을 검색하려면 GetExecutionFlowSnapshot 작업을 직접 호출합니다. 응답에는 다음 흐름 필드가 포함됩니다.
-
customerEncryptionKeyArn - 흐름을 암호화하는 AWS KMS 키의 ARN입니다.
-
정의 - 흐름의 정의입니다.
-
executionRoleArn - 흐름 실행에 사용되는 IAM 서비스 역할의 ARN입니다.
-
flowAliasIdentifier - 흐름의 별칭 ID입니다.
-
flowIdentifier - 흐름의 ID입니다.
-
flowVersion - 흐름의 버전입니다.
{
"customerEncryptionKeyArn": null,
"definition": "{flow-definition}",
"executionRoleArn": "arn:aws:iam::111122223333:role/name",
"flowAliasIdentifier": "TSTALIASID",
"flowIdentifier": "FLOWID",
"flowVersion": "DRAFT"
}
흐름 실행 나열
ListFlowExecutions 작업을 직접 호출하여 흐름 실행 목록을 가져올 수 있습니다. 응답에는 흐름 또는 흐름 별칭에 대한 현재 AWS 리전의 각 흐름 실행에 대한 정보가 포함된 flowExecutionSummaries 배열이 포함됩니다. 각 요소에는 실행 ARN, 시작 시간, 흐름의 현재 상태와 같은 정보가 포함됩니다.
{
"flowExecutionSummaries": [{
"createdAt": "2025-03-11T23:21:02.875598966Z",
"endedAt": null,
"executionArn": "arn:aws:bedrock:us-west-2:111122223333:flow/FLOWID/alias/TSTALIASID/execution/MyExecution",
"flowAliasIdentifier": "TSTALIASID",
"flowIdentifier": "FLOWID",
"flowVersion": "DRAFT",
"status": "Running"
}]
}
실행 중인 흐름 실행 중지
실행 중인 흐름 실행을 중지해야 하는 경우 StopFlowExecution 작업을 직접 호출하고 중지하려는 실행의 흐름 ID, 흐름 별칭 ID 및 흐름 실행 ID를 전달합니다.