BedrockAgentCore / Client / ingest_data

ingest_data

BedrockAgentCore.Client.ingest_data(**kwargs)

Submits content directly for ingestion to generate long-term memory records in a AgentCore Memory resource.

To use this operation, you must have the bedrock-agentcore:IngestData permission.

See also: AWS API Documentation

Request Syntax

response = client.ingest_data(
    memoryId='string',
    source={
        'inline': {
            'payload': [
                {
                    'conversational': {
                        'content': {
                            'text': 'string'
                        },
                        'role': 'ASSISTANT'|'USER'|'TOOL'|'OTHER'
                    },
                    'json': {
                        'content': {...}|[...]|123|123.4|'string'|True|None
                    }
                },
            ]
        }
    },
    contentTimestamp=datetime(2015, 1, 1),
    actorId='string',
    sessionId='string',
    extractionConfig={
        'namespaceVariables': {
            'string': 'string'
        }
    },
    metadata={
        'string': {
            'stringValue': 'string'
        }
    },
    clientToken='string'
)
Parameters:
  • memoryId (string) –

    [REQUIRED]

    The identifier of the AgentCore Memory resource to ingest content into.

  • source (dict) –

    [REQUIRED]

    The content to ingest. Only inline content is supported.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: inline.

    • inline (dict) –

      The content included directly in the request.

      • payload (list) – [REQUIRED]

        The list of content payload items to ingest.

        • (dict) –

          A single content payload item to ingest. A payload item contains either conversational or JSON content.

          Note

          This is a Tagged Union structure. Only one of the following top level keys can be set: conversational, json.

          • conversational (dict) –

            The conversational content for this payload item.

            • content (dict) – [REQUIRED]

              The content of the conversation message.

              Note

              This is a Tagged Union structure. Only one of the following top level keys can be set: text.

              • text (string) –

                The text content of the memory item.

            • role (string) – [REQUIRED]

              The role of the participant in the conversation (for example, “user” or “assistant”).

          • json (dict) –

            The JSON content for this payload item.

            • content (document) – [REQUIRED]

              The JSON content of the payload. Accepts any JSON value, including objects, arrays, strings, numbers, booleans, and null. The maximum size is 100 KB.

  • contentTimestamp (datetime) –

    [REQUIRED]

    The timestamp of when the content occurred.

  • actorId (string) –

    [REQUIRED]

    The identifier of the actor associated with this content. An actor represents an entity that participates in sessions and generates content.

  • sessionId (string) – The identifier of the session that the content belongs to. If not provided, a session identifier is generated and returned in the response.

  • extractionConfig (dict) –

    The extraction configuration for long-term memory records. Use this parameter to specify namespace variable keys and their values for namespace substitution during extraction.

    • namespaceVariables (dict) –

      A map of namespaceKeys to their values. The service substitutes these values into namespaceTemplates during long-term memory extraction to control namespace hierarchy.

      • (string) –

        The name of the namespace variable key. The name cannot be a built-in variable name ( actorId, sessionId, or memoryStrategyId).

        • (string) –

          The value of a namespace variable key.

  • metadata (dict) –

    The key-value metadata to attach to the content.

    • (string) –

      • (dict) –

        Value associated with the eventMetadata key.

        Note

        This is a Tagged Union structure. Only one of the following top level keys can be set: stringValue.

        • stringValue (string) –

          Value associated with the eventMetadata key.

  • clientToken (string) –

    A unique, case-sensitive identifier to ensure that the operation completes no more than one time. If this token matches a previous request, AgentCore ignores the request, but does not return an error.

    This field is autopopulated if not provided.

Return type:

dict

Returns:

Response Syntax

{
    'sessionId': 'string'
}

Response Structure

  • (dict) –

    • sessionId (string) –

      The identifier of the session that the service ingested the content into. This value echoes the session identifier from the request, or the identifier that the service generated when you did not provide one.

Exceptions