A2a Session
One conversation with the A2A agent. A session spans many turns (one user message and the server's streamed reply each) that all share the same contextId.
The context id is issued by the server. A new session sends its first message with an empty context id and adopts the id from the response; a resumed session starts with a known id. The server keeps a conversation for about 30 minutes. If it no longer knows the id it silently starts a new conversation and returns a different id, which this session adopts. Watch contextId to notice that (and to store the id for later resumption within the same process).
Only one turn can run at a time. Create sessions with A2aSessionManager.startSession.
Properties
Id of the task of the running turn; null between turns.
Errors raised by turns and by stop. Not replayed to late collectors.
Current lifecycle state.
Functions
Reports the outcome of a device action to the server, which paused the task after sending it (see A2aEvent.DeviceActionEvent), and streams the events of the resumed task.
Sends text as one turn and streams the server's responses as A2aEvents. Text typed or spoken in another language is translated to English first when SessionConfig.autoTranslate is on; pass the language as locale when it is known (for example the voice recognition locale), or leave it null to let the translator detect it. If translation fails the original text is sent. The returned flow is cold: the turn starts when it is collected.