> ## Documentation Index
> Fetch the complete documentation index at: https://docs.galtea.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Finish Session

> Mark a session as finished (closed) so it accepts no more turns and becomes eligible for evaluation

## Overview

The `finish()` 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](/concepts/product/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

<ResponseField name="session_id" type="string" required>
  The ID of the session to finish.
</ResponseField>

<ResponseField name="stopping_reason" type="string" optional>
  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.
</ResponseField>

## Returns

Returns the finished `Session` object, with status `COMPLETED`.

## Example

```python theme={"system"}
# Call finish when the conversation is over. This closes the session (status COMPLETED)
# so it accepts no more turns and becomes eligible for monitor evaluation on the next scan.
galtea.sessions.finish(session_id=session.id, stopping_reason="GOAL_ACHIEVED")
```

To send the default stopping reason, omit the argument:

```python theme={"system"}
# Omit stopping_reason to send the default reason ("FINISHED"). The API requires a
# non-empty reason, so the SDK substitutes this token for you.
galtea.sessions.finish(session_id=session.id)
```

## Notes

<Warning>
  Only call `finish()` when the conversation is truly over. A finished session is closed, so a later attempt to append an inference result follows the product's closed-session policy: it is either rejected with an error or silently discarded (the default). See [Session](/concepts/product/version/session).
</Warning>

<Note>
  To mark a session as failed instead of completed, use [Update Session](/sdk/api/session/update) with `status="FAILED"` (for example `galtea.sessions.update(session_id=..., status="FAILED", error="...")`). Setting `error` alone records the message but leaves the session open.
</Note>

## Related Methods

* [Create Session](/sdk/api/session/create) - Create a new session
* [Update Session](/sdk/api/session/update) - Update a session's fields
* [Get Session](/sdk/api/session/get) - Retrieve a session
* [List Sessions](/sdk/api/session/list) - List all sessions
