A2AAgentSession Class
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.
Session for A2A based agents.
public sealed class A2AAgentSession : Microsoft.Agents.AI.AgentSession
type A2AAgentSession = class
inherit AgentSession
Public NotInheritable Class A2AAgentSession
Inherits AgentSession
- Inheritance
Properties
| Name | Description |
|---|---|
| ContextId |
Gets the ID for the current conversation with the A2A agent. |
| StateBag |
Gets any arbitrary state associated with this session. (Inherited from AgentSession) |
| TaskId |
Gets the ID for the task the agent is currently working on. |
| TaskState |
Gets the state of the task the agent is currently working on. |
Methods
| Name | Description |
|---|---|
| GetService(Type, Object) |
Asks the AgentSession for an object of the specified type |
| GetService<TService>(Object) |
Asks the AgentSession for an object of type |
Extension Methods
| Name | Description |
|---|---|
| SetInMemoryChatHistory(AgentSession, List<ChatMessage>, String, JsonSerializerOptions) |
Sets the in-memory chat message history for the specified agent session, replacing any existing messages. |
| TryGetInMemoryChatHistory(AgentSession, List<ChatMessage>, String, JsonSerializerOptions) |
Attempts to retrieve the in-memory chat history messages associated with the specified agent session, if the agent is storing memories in the session using the InMemoryChatHistoryProvider |