Overview
Thefinish() method marks a session as finished when its conversation is over. Finishing sets the session status to COMPLETED and closes it: the session accepts no more turns.
Finishing also makes the session eligible for evaluation right away. A Monitor scores only closed sessions, so an explicit finish gets the session picked up on the next scan instead of waiting for the product’s inactivity auto-close window.
Parameters
string
required
The ID of the session to finish.
string
Free-text reason the conversation ended (for example
GOAL_ACHIEVED). When omitted, the default FINISHED is sent, because the API requires a non-empty stopping reason.Returns
Returns the finishedSession object, with status COMPLETED.
Example
Notes
To mark a session as failed instead of completed, use Update Session with
status="FAILED" (for example galtea.sessions.update(session_id=..., status="FAILED", error="...")). Setting error alone records the message but leaves the session open.Related Methods
- Create Session - Create a new session
- Update Session - Update a session’s fields
- Get Session - Retrieve a session
- List Sessions - List all sessions