ProviderSessionState<TState>.GetOrInitializeState(AgentSession) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the state from the session's StateBag, or initializes it using the state initializer if not present.
public TState GetOrInitializeState(Microsoft.Agents.AI.AgentSession? session);
member this.GetOrInitializeState : Microsoft.Agents.AI.AgentSession -> 'State
Public Function GetOrInitializeState (session As AgentSession) As TState
Parameters
- session
- AgentSession
The agent session containing the StateBag.
Returns
The provider state.