> ## 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 becomes eligible for evaluation

> [!WARNING]
>
> You are reading the docs of Galtea 5.10. [Read this page in the latest version](https://docs.galtea.ai/sdk/api/session/finish.md).

## Overview

The `finish()` method marks a session as finished when its conversation is over. Finishing sets the session status to `COMPLETED` and closes it.

Finishing also makes the session eligible for evaluation right away. A [Monitor](https://docs.galtea.ai/v5.10/concepts/product/monitor.md) 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

**session\_id** `string` *required*

The ID of the session to finish.

**stopping\_reason** `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 finished `Session` object, with status `COMPLETED`.

## Example

```python theme={"system"}
# Call finish when the conversation is over. This closes the session (status COMPLETED)
# and makes it 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 a trace follows the product's closed-session policy. By default the trace is kept and the session reopens for a fresh score; the policy can also be set to drop the trace silently, or to reject it with an error. See [Session](https://docs.galtea.ai/v5.10/concepts/product/version/session.md).

> [!NOTE]
>
> To mark a session as failed instead of completed, use [Update Session](https://docs.galtea.ai/v5.10/sdk/api/session/update.md) 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](https://docs.galtea.ai/v5.10/sdk/api/session/create.md) - Create a new session
* [Update Session](https://docs.galtea.ai/v5.10/sdk/api/session/update.md) - Update a session's fields
* [Get Session](https://docs.galtea.ai/v5.10/sdk/api/session/get.md) - Retrieve a session
* [List Sessions](https://docs.galtea.ai/v5.10/sdk/api/session/list.md) - List all sessions


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.