---
sidebar:
  hidden: true
title: roboto.ai.agent.record
---
## Module Contents

### AgentRecord

```python
class roboto.ai.agent.record.AgentRecord(/, **data: Any)
```

`from roboto.ai.agent import AgentRecord`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent/record.py#L133-L220)

Bases: `pydantic.BaseModel`

Data record of an agent, as the Roboto API returns it.

An agent is an AI worker an organization defines and runs on its data: a saved request to start a thread, with typed `{{name}}` placeholders, optionally paired with goals. Each launch fills the placeholders with its own values and starts a thread, so one agent, such as a triage agent with a fixed label vocabulary and a dataset ID placeholder, can run on many datasets. [`Agent`](/docs/reference/python-sdk/roboto/ai/agent/agent#roboto.ai.agent.agent.Agent) wraps this record with methods that act on the agent.

Building it raises `pydantic.ValidationError` when:

- `variables` and the placeholders in `request_template` do not name the same set of variables.
- Two variables share a name.
- A dictionary key in `request_template` holds a placeholder.

**Parameters**

- **data** (`Any`)

**Attributes**

- **AgentRecord.agent_id** (`str`): Unique ID of the agent, beginning with `agt_`.

- **AgentRecord.created** (`datetime.datetime`): Time the agent was created.

- **AgentRecord.created_by** (`str`): ID of the user who created the agent.

- **AgentRecord.description** (`str | None`) = `None`: Human-readable description of the agent, or `None` if it has none.

- **AgentRecord.modified** (`datetime.datetime`): Time the agent was last modified.

- **AgentRecord.modified_by** (`str`): ID of the user who last modified the agent.

- **AgentRecord.name** (`str`): Human-readable name of the agent, unique within its organization.

- **AgentRecord.org_id** (`str`): ID of the organization that owns the agent.

- **AgentRecord.request_template** (`roboto.ai.agent_thread.record.StartAgentThreadRequest`): Request that starts each of the agent's threads, with `{{name}}` placeholders where launch values go.

  A placeholder can appear anywhere in a string value, but not in a dictionary key, and fields of other types cannot hold one. Each launch fills the placeholders and starts a thread with the resulting [`StartAgentThreadRequest`](/docs/reference/python-sdk/roboto/ai/agent_thread/record#roboto.ai.agent_thread.record.StartAgentThreadRequest).

- **AgentRecord.subject** (`AgentSubject | None`) = `None`: Kind of resource the agent is launched on, or `None` for an agent with no subject.

  A chat agent that takes no dataset or session ID, for example, has no subject.

  Roboto computes it from `request_template` and `variables` with [`infer_agent_subject()`](/docs/reference/python-sdk/roboto/ai/agent/subject#roboto.ai.agent.subject.infer_agent_subject) each time it returns the record. It is not stored, and create and update requests do not take it.

- **AgentRecord.variables** (`list[TemplateVariable]`) = `None`: Variables of the agent, exactly one for each placeholder name in `request_template`.

### AgentSubject

```python
class roboto.ai.agent.record.AgentSubject
```

`from roboto.ai.agent import AgentSubject`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent/record.py#L45-L57)

Bases: `roboto.compat.StrEnum`

Subject of an agent: the kind of resource it is launched on.

An agent acts on a dataset or on a session, never both, because all of its goals must act on the same kind of resource. Roboto works the subject out from the agent's goals and variables, with [`infer_agent_subject()`](/docs/reference/python-sdk/roboto/ai/agent/subject#roboto.ai.agent.subject.infer_agent_subject), instead of storing it.

**Attributes**

- **AgentSubject.DATASET** = `'dataset'`: Datasets ([`Dataset`](/docs/reference/python-sdk/roboto/domain/datasets/dataset#roboto.domain.datasets.dataset.Dataset)).
- **AgentSubject.SESSION** = `'session'`: Sessions ([`Session`](/docs/reference/python-sdk/roboto/experimental/sessions/session#roboto.experimental.sessions.session.Session)).

### CreateAgentRequest

```python
class roboto.ai.agent.record.CreateAgentRequest(/, **data: Any)
```

`from roboto.ai.agent import CreateAgentRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent/record.py#L238-L254)

Bases: `pydantic.BaseModel`

Request body for [`create()`](/docs/reference/python-sdk/roboto/ai/agent/agent#roboto.ai.agent.agent.Agent.create).

Roboto sets the agent's ID, organization, and creation and modification fields.

**Parameters**

- **data** (`Any`)

**Attributes**

- **CreateAgentRequest.description** (`str | None`) = `None`: Human-readable description of the agent. `None` sets none.
- **CreateAgentRequest.name** (`str`): Human-readable name of the agent, unique within its organization.
- **CreateAgentRequest.request_template** (`roboto.ai.agent_thread.record.StartAgentThreadRequest`): Request that starts each of the agent's threads, as `AgentRecord.request_template` describes.
- **CreateAgentRequest.variables** (`list[TemplateVariable]`) = `None`: Variables of the agent, exactly one for each placeholder name in `request_template`. Defaults to none.

### LaunchAgentRequest

```python
class roboto.ai.agent.record.LaunchAgentRequest(/, **data: Any)
```

`from roboto.ai.agent import LaunchAgentRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent/record.py#L283-L308)

Bases: `pydantic.BaseModel`

Request body for [`launch()`](/docs/reference/python-sdk/roboto/ai/agent/agent#roboto.ai.agent.agent.Agent.launch).

Roboto fills `values` into the agent's request template and starts a thread in the agent's organization, whose `created_from_agent_id` names the agent.

**Parameters**

- **data** (`Any`)

**Attributes**

- **LaunchAgentRequest.analysis_scope** (`roboto.ai.core.AnalysisScope | None`) = `None`: Data the new thread analyzes, combined with the `analysis_scope` in the agent's request template.

  Each field set here replaces the template's, and each field left `None` keeps the template's. `None` keeps the template's scope unchanged.

- **LaunchAgentRequest.values** (`dict[str, str]`) = `None`: Value of each variable, keyed by variable name. A variable left out uses its default. Defaults to none.

  A key that names no variable of the agent raises `RobotoInvalidRequestException`.

- **LaunchAgentRequest.visibility** (`roboto.ai.agent_thread.record.ThreadVisibility`): Visibility of the new thread, which replaces the `visibility` in the agent's request template.

  Defaults to [`ORG`](/docs/reference/python-sdk/roboto/ai/core/record#roboto.ai.core.record.ThreadVisibility.ORG), which lets every member of the organization read the thread. `PRIVATE` limits it to the user who launches the agent.

### TemplateVariable

```python
class roboto.ai.agent.record.TemplateVariable(/, **data: Any)
```

`from roboto.ai.agent import TemplateVariable`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent/record.py#L60-L130)

Bases: `pydantic.BaseModel`

Variable of an agent: a named value that each launch fills into the agent's `{{name}}` placeholders.

Carried in `AgentRecord.variables`. Because an agent declares its variables instead of Roboto inferring them from its placeholders, the Roboto web app can show a typed input for each one, and a misspelled placeholder fails when the agent is saved instead of when it is launched.

Building it raises `pydantic.ValidationError` when:

- `name` does not match [`VARIABLE_NAME_RE`](/docs/reference/python-sdk/roboto/templating/substitution#roboto.templating.substitution.VARIABLE_NAME_RE).
- `required` is `False` and `default` is `None`.
- `collection_content_type` is set and `type` is not `TemplateVariableType.COLLECTION_ID`.

**Parameters**

- **data** (`Any`)

**Attributes**

- **TemplateVariable.collection_content_type** (`roboto.domain.collections.record.CollectionResourceType | None`) = `None`: Kind of resource a collection must hold to appear in the Roboto web app's collection picker for this variable.

  For example, a variable for a goal that creates events can require event collections. `None` offers every collection.

  Roboto does not check it at launch. Used only with `TemplateVariableType.COLLECTION_ID`.

- **TemplateVariable.default** (`str | None`) = `None`: Value used when a launch leaves the variable out, or `None` if the variable has none.

- **TemplateVariable.description** (`str | None`) = `None`: Human-readable description of the variable, shown next to its input in the Roboto web app's launch form.

- **TemplateVariable.name** (`str`): Name of the variable, which the agent's request template writes as `{{name}}`. Unique within the agent.

  A dotted name such as `dataset.id` is one name: `dataset.id` and `dataset.name` are two unrelated variables with two inputs at launch.

- **TemplateVariable.required** (`bool`) = `True`: Whether a launch must have a value for the variable.

  A launch that leaves the variable out uses `default`, and [`launch()`](/docs/reference/python-sdk/roboto/ai/agent/agent#roboto.ai.agent.agent.Agent.launch) raises `RobotoInvalidRequestException` when there is none. `False` requires a `default`.

- **TemplateVariable.type** (`TemplateVariableType`): Type of the variable's value, which decides how Roboto checks it at launch. Defaults to free-form text.

### TemplateVariableType

```python
class roboto.ai.agent.record.TemplateVariableType
```

`from roboto.ai.agent import TemplateVariableType`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent/record.py#L20-L42)

Bases: `roboto.compat.StrEnum`

Type of a template variable's value: how Roboto checks it when the agent is launched.

Every value fills its placeholders as text, whatever its type. When the agent is launched, Roboto checks that the resource an ID-typed value names exists in the agent's organization, and rejects the launch before it starts a thread when it does not. The Roboto web app offers a picker for a dataset or collection ID, and a text box for any other type.

**Attributes**

- **TemplateVariableType.COLLECTION_ID** = `'collection_id'`: ID of a collection.
- **TemplateVariableType.DATASET_ID** = `'dataset_id'`: ID of a dataset.
- **TemplateVariableType.DEVICE_ID** = `'device_id'`: ID of a device.
- **TemplateVariableType.SESSION_ID** = `'session_id'`: ID of a session.
- **TemplateVariableType.STRING** = `'string'`: Free-form text, which Roboto does not check.

### UpdateAgentRequest

```python
class roboto.ai.agent.record.UpdateAgentRequest(/, **data: Any)
```

`from roboto.ai.agent import UpdateAgentRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent/record.py#L257-L280)

Bases: `pydantic.BaseModel`

Request body for [`update()`](/docs/reference/python-sdk/roboto/ai/agent/agent#roboto.ai.agent.agent.Agent.update).

A field left unset (`NotSet`) is unchanged. Roboto checks the agent's variables against its placeholders after applying the update, so a request that changes the placeholders in `request_template` must also send the matching `variables`.

**Parameters**

- **data** (`Any`)

**Attributes**

- **UpdateAgentRequest.description** (`str | None | roboto.sentinels.NotSetType`): Human-readable description of the agent. `None` clears it.
- **UpdateAgentRequest.model_config**: Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- **UpdateAgentRequest.name** (`str | roboto.sentinels.NotSetType`): Human-readable name of the agent, unique within its organization.
- **UpdateAgentRequest.request_template** (`roboto.ai.agent_thread.record.StartAgentThreadRequest | roboto.sentinels.NotSetType`): Request that starts each of the agent's threads, as `AgentRecord.request_template` describes.
- **UpdateAgentRequest.variables** (`list[TemplateVariable] | roboto.sentinels.NotSetType`): Variables of the agent, exactly one for each placeholder name in `request_template`.

### extract_placeholders()

```python
def roboto.ai.agent.record.extract_placeholders(
    body: roboto.ai.agent_thread.record.StartAgentThreadRequest,
) -> set[str]
```

`from roboto.ai.agent import extract_placeholders`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent/record.py#L223-L235)

Return the name of every `{{name}}` placeholder in the string values of `body`.

Scans every string value in the request's JSON form, such as message text, the system prompt, and the values of a goal's label vocabulary.

**Parameters**

- **body** (`roboto.ai.agent_thread.record.StartAgentThreadRequest`): Request to scan, such as an agent's request template.

**Raises**

- `ValueError`: A dictionary key in `body` holds a placeholder.

**Returns**

- `set[str]`
