Sprog

FoundryStateStore.GetOrCreateAsync Method

Definition

Returns a client bound to name, creating the store if it does not exist.

public static System.Threading.Tasks.Task<Azure.AI.AgentServer.Core.Storage.FoundryStateStore> GetOrCreateAsync(string name, Azure.Core.TokenCredential? credential = default, Uri? endpoint = default, bool userIsolation = false, int itemTtlSeconds = 2592000, string? description = default, System.Collections.Generic.IReadOnlyDictionary<string,string>? tags = default, string? userId = default, string apiVersion = "v1", System.Threading.CancellationToken cancellationToken = default);
static member GetOrCreateAsync : string * Azure.Core.TokenCredential * Uri * bool * int * string * System.Collections.Generic.IReadOnlyDictionary<string, string> * string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.AI.AgentServer.Core.Storage.FoundryStateStore>
Public Shared Function GetOrCreateAsync (name As String, Optional credential As TokenCredential = Nothing, Optional endpoint As Uri = Nothing, Optional userIsolation As Boolean = false, Optional itemTtlSeconds As Integer = 2592000, Optional description As String = Nothing, Optional tags As IReadOnlyDictionary(Of String, String) = Nothing, Optional userId As String = Nothing, Optional apiVersion As String = "v1", Optional cancellationToken As CancellationToken = Nothing) As Task(Of FoundryStateStore)

Parameters

name
String

The logical state-store name. Encode conversation/thread identity into this name when you need that scope.

credential
TokenCredential

A token credential used to authenticate to the storage service. May be null when using the non-hosted local fallback.

endpoint
Uri

Optional Foundry project endpoint (or full storage URL). Used only in Foundry hosting; non-hosted execution always uses the local fallback. When null in Foundry hosting, resolved from the FOUNDRY_PROJECT_ENDPOINT environment variable.

userIsolation
Boolean

Whether hosted item operations are partitioned per resolved user. Applied only when the store is created. The local fallback does not support user isolation.

itemTtlSeconds
Int32

Store-level default TTL inherited by every item. Applied only when the store is created.

description
String

Optional store description, set at creation.

tags
IReadOnlyDictionary<String,String>

Optional store metadata tags, set at creation.

userId
String

Delegated end-user identity for trusted callers.

apiVersion
String

Storage API version.

cancellationToken
CancellationToken

A cancellation token.

Returns

The bound, ready-to-use store client.

Applies to