> ## 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.

# Create Version

> Create a version for your product.

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

> [!TIP]
>
> To get the version of one agent state, use [Get or Create Version](https://docs.galtea.ai/v5.17/sdk/api/version/get-or-create.md) instead. It returns the version that holds your facts, and creates it only the first time. So a script that runs again, or two jobs that run at the same time, reuse one version.

## Returns

Returns a [Version](https://docs.galtea.ai/v5.17/concepts/product/version.md) object for the given parameters, or `None` if an error occurs. When the platform stores it but cannot return it, `create` raises [`WrittenResourceUnreadableException`](https://docs.galtea.ai/v5.17/sdk/api/galtea#errors) instead: do not create it again. The returned object carries the `number` Galtea allocated, and the `name` the version is stored under.

## Example

```python theme={"system"}
version = galtea.versions.create(
    product_id=product_id,
    description="Demo version created via SDK",
)
```

## Parameters

**name** `string`

Your own label for the version. Leave it out and Galtea stores the version under its label, `v` followed by its [number](https://docs.galtea.ai/v5.17/concepts/product/version.md#how-a-version-is-identified), for example `v7`.

A create with no name needs an API that allocates version numbers. A self-hosted deployment older than that still requires a name and refuses the create. Pass a name against such a deployment.

> [!WARNING]
>
> A name of `v` followed by digits is reserved for version labels. The check ignores upper and lower case, so `V7` follows the same rule as `v7`. Galtea accepts such a name only when it is the version's own label, so version 7 accepts `v7` and refuses `v3`. It always refuses `v01`, `v007` and `v0`, because no version is ever labelled that way. A name such as `v1.0` is outside the reserved shape and stays valid.

**product\_id** `string` *required*

The ID of the product you want to create a version for.

**description** `string`

A textual description of the version.

**system\_prompt** `string`

The system prompt used with the model for this version.

**model\_id** `string`

Reference to a [model](https://docs.galtea.ai/v5.17/concepts/model.md) configured in the Galtea Platform, used for cost tracking on this version's traces. `versions.create` sends no facts. To link the model from a [model fact](https://docs.galtea.ai/v5.17/concepts/product/version.md#model-facts), use [`versions.get_or_create`](https://docs.galtea.ai/v5.17/sdk/api/version/get-or-create).

> [accordion] Example: linking a version to a model
>
> Use the [Model service](https://docs.galtea.ai/v5.17/sdk/api/model/service.md) to look up an existing model by name and pass its `id` to `versions.create`:
>
> ```python theme={"system"}
> # Look up an existing model by name (created earlier via galtea.models.create).
> selected_model = galtea.models.get_by_name(name=model_name)
>
> # Pass its id to versions.create so Galtea can track cost for this version's
> # traces using the model's per-token pricing.
> version = galtea.versions.create(
>     product_id=_demo_product_id,
>     model_id=selected_model.id,
>     description="Version linked to a model for cost tracking.",
> )
> ```
>
> See [`galtea.models.get_by_name`](https://docs.galtea.ai/v5.17/sdk/api/model/get-by-name) or [`galtea.models.list`](https://docs.galtea.ai/v5.17/sdk/api/model/list) for other ways to discover existing models.

**dataset\_description** `string`

Description of the dataset used for training or fine-tuning.

**dataset\_uri** `string`

A URI pointing to the dataset.

**conversation\_endpoint\_connection\_id** `string`

The ID of the [Endpoint Connection](https://docs.galtea.ai/v5.17/concepts/product/endpoint-connection.md) used for conversational interactions with your AI product.

**initialization\_endpoint\_connection\_id** `string`

The ID of the [Endpoint Connection](https://docs.galtea.ai/v5.17/concepts/product/endpoint-connection.md) executed before the conversation begins. Used to initialize a session and obtain a session ID. See [Version Endpoint Connections](https://docs.galtea.ai/v5.17/concepts/product/version.md#endpoint-connections) for more details.

**finalization\_endpoint\_connection\_id** `string`

The ID of the [Endpoint Connection](https://docs.galtea.ai/v5.17/concepts/product/endpoint-connection.md) executed after the conversation ends. Used to clean up resources.

**phone\_connection\_id** `string`

The ID of the [Phone Connection](https://docs.galtea.ai/v5.17/concepts/product/phone-connection.md) Galtea dials to reach your AI agent over the phone. A version's conversation target is mutually exclusive: provide one of a phone connection, a WebRTC connection (`web_rtc_connection_id`), or an endpoint connection (`conversation_endpoint_connection_id`), never more than one.

**web\_rtc\_connection\_id** `string`

The ID of the [WebRTC Connection](https://docs.galtea.ai/v5.17/concepts/product/webrtc-connection.md) Galtea uses to reach your AI agent over WebRTC. A version's conversation target is mutually exclusive: provide one of a WebRTC connection, a phone connection (`phone_connection_id`), or an endpoint connection (`conversation_endpoint_connection_id`), never more than one.

**endpoint\_connection\_id** `string`

\[!WARNING] Deprecated. Use `conversation_endpoint_connection_id` instead.
Legacy parameter maintained for backwards compatibility. Maps to `conversation_endpoint_connection_id`.

**guardrails** `string`

Configuration or description of safety guardrails applied.

**parent\_version\_id** `string`

The ID of the parent [version](https://docs.galtea.ai/v5.17/concepts/product/version.md) this version is iterated from. Setting it makes the new version a revision of the parent and records the lineage. The parent must belong to the same product. Leave it empty to create a root version. See [Version Lineage](https://docs.galtea.ai/v5.17/concepts/product/version.md#version-lineage) for details.

**otel\_input\_source\_rule** `dict`

Recovers a turn's input from a non-LLM span, for products whose user message is not on the LLM span. An object with `spanName`, `attribute`, `path` and an optional `predicate`. The API refuses a filter expression such as `[?(...)]` in `path` and in `predicate.path`. The version value overrides the product value, which overrides the organization value. See [Recover the turn input from a non-LLM span](https://docs.galtea.ai/v5.17/sdk/tutorials/monitor-real-user-traffic-with-opentelemetry.md#recover-the-turn-input-from-a-non-llm-span).

**otel\_output\_source\_rule** `dict`

Recovers a turn's output from a non-LLM span, for templated or non-LLM replies. Same four parts as `otel_input_source_rule`. The API refuses a filter expression such as `[?(...)]` in `path` and in `predicate.path`. The version value overrides the product value, which overrides the organization value. See [Recover replies that do not come from the LLM](https://docs.galtea.ai/v5.17/sdk/tutorials/monitor-real-user-traffic-with-opentelemetry.md#recover-replies-that-do-not-come-from-the-llm).


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