Share via


AIAgent.DeserializeThread(JsonElement, JsonSerializerOptions) Method

Definition

Deserializes an agent thread from its JSON serialized representation.

public abstract Microsoft.Agents.AI.AgentThread DeserializeThread(System.Text.Json.JsonElement serializedThread, System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = default);
abstract member DeserializeThread : System.Text.Json.JsonElement * System.Text.Json.JsonSerializerOptions -> Microsoft.Agents.AI.AgentThread
Public MustOverride Function DeserializeThread (serializedThread As JsonElement, Optional jsonSerializerOptions As JsonSerializerOptions = Nothing) As AgentThread

Parameters

serializedThread
JsonElement

A JsonElement containing the serialized thread state.

jsonSerializerOptions
JsonSerializerOptions

Optional settings to customize the deserialization process.

Returns

A restored AgentThread instance with the state from serializedThread.

Exceptions

The serializedThread is not in the expected format.

The serialized data is invalid or cannot be deserialized.

Remarks

This method enables restoration of conversation threads from previously saved state, allowing conversations to resume across application restarts or be migrated between different agent instances.

Applies to