

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# セッションから会話履歴とコンテキストを取得する
<a name="sessions-retrieve-coversation"></a>

セッションの詳細、さまざまなチェックポイントでのインタラクション状態の詳細、すべての呼び出しの概要情報を取得するには、[GetSession](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_GetSession.html) API オペレーション、[ListInvocations](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_ListInvocations.html) API オペレーション、[GetInvocationStep](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_GetInvocationStep.html) API オペレーションを使用します。

次のコード例は、AWS SDK for Python (Boto3) と [GetInvocationStep](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_GetInvocationStep.html) API オペレーションを使用して、チェックポイントのテキストデータとイメージデータを取得する方法を説明しています。

```
def get_invocation_step(invocation_identifier, session_identifier, invocation_step_identifier):
try:
    response = client.get_invocation_step(
        sessionIdentifier=session_identifier,
        invocationIdentifier=invocation_identifier,
        invocationStepId=invocation_step_identifier
    )  ["invocationStep"]["payload"]["contentBlocks"]
    print(response)
except ClientError as e:
    print(f"Error: {e}")
```