AWS SDK で ListFlows を使用する - AWS SDK コードサンプル

AWS Doc SDK Examples GitHub リポジトリには、他にも用意されている AWS SDK サンプルがあります。

AWS SDK で ListFlows を使用する

次のコード例は、ListFlows を使用する方法を示しています。

Python
SDK for Python (Boto3)
注記

GitHub には、その他のリソースもあります。AWS コード例リポジトリで完全な例を見つけて、設定と実行の方法を確認してください。

Amazon Bedrock フローを一覧表示します。

def list_flows(client): """ Lists versions of an Amazon Bedrock flow. Args: client: Amazon Bedrock agent boto3 client. flow_id (str): The identifier of the flow. Returns: Nothing. """ try: finished = False logger.info("Listing flows:") response = client.list_flows(maxResults=10) while finished is False: for flow in response['flowSummaries']: print(f"ID: {flow['id']}") print(f"Name: {flow['name']}") print( f"Description: {flow.get('description', 'No description')}") print(f"Latest version: {flow['version']}") print(f"Status: {flow['status']}\n") if 'nextToken' in response: next_token = response['nextToken'] response = client.list_flows(maxResults=10, nextToken=next_token) else: finished = True logging.info("Successfully listed flows.") except ClientError as e: logging.exception("Client error listing flow versions: %s", str(e)) raise except Exception as e: logging.exception("Unexpected error listing flow versions: %s", str(e)) raise
  • API の詳細については、「AWS SDK for Python (Boto3) API リファレンス」の「ListFlows」を参照してください。