> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-typedoc-upgrade.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# endTurn

> TypeScript SDK reference

> **endTurn**(`opts?`): `void`

Defined in: [src/genai/api.ts:183](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/api.ts#L183)

End the current Turn. No-op if no Turn is active.

## Parameters

### opts?

`SpanEndOptions`

## Returns

`void`

## Examples

```ts twoslash theme={null}
// @noErrors
weave.endTurn();
```

```ts twoslash theme={null}
// @noErrors
weave.endTurn({endTime: new Date('2026-05-29T10:00:01.700Z')});
```

```ts twoslash theme={null}
// @noErrors
weave.endTurn({error: new Error('agent loop diverged')});
```
