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

### AgentResolutionError

```python
exception roboto.ai.agent.resolver.AgentResolutionError
```

`from roboto.ai.agent import AgentResolutionError`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent/resolver.py#L12-L18)

Bases: `ValueError`

Base class of the exceptions the SDK raises when the values for a launch of an agent do not match its variables.

`resolve_agent` raises its two subclasses, `UnknownAgentVariablesError` and `UnresolvedAgentVariablesError`. [`launch()`](/docs/reference/python-sdk/roboto/ai/agent/agent#roboto.ai.agent.agent.Agent.launch) reports either one as `RobotoInvalidRequestException`, with the same message.

### UnknownAgentVariablesError

```python
exception roboto.ai.agent.resolver.UnknownAgentVariablesError(names: list[str])
```

`from roboto.ai.agent import UnknownAgentVariablesError`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent/resolver.py#L33-L43)

Bases: [`AgentResolutionError`](/docs/reference/python-sdk/roboto/ai/agent/resolver#roboto.ai.agent.resolver.AgentResolutionError)

A launch of an agent has a value for a name that is not one of the agent's variables.

`resolve_agent` raises it, and its message names every such name. A launch form loaded before someone removed a variable from the agent sends one.

**Parameters**

- **names** (`list[str]`)

**Attributes**

- **UnknownAgentVariablesError.names**: Names in the launch's values that are not variables of the agent, sorted.

### UnresolvedAgentVariablesError

```python
exception roboto.ai.agent.resolver.UnresolvedAgentVariablesError(names: list[str])
```

`from roboto.ai.agent import UnresolvedAgentVariablesError`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent/resolver.py#L21-L30)

Bases: [`AgentResolutionError`](/docs/reference/python-sdk/roboto/ai/agent/resolver#roboto.ai.agent.resolver.AgentResolutionError)

A launch of an agent has no value for a required variable that has no default.

`resolve_agent` raises it, and its message names every such variable.

**Parameters**

- **names** (`list[str]`)

**Attributes**

- **UnresolvedAgentVariablesError.names**: Names of the required variables that have no value, sorted.

### resolve_agent()

```python
def roboto.ai.agent.resolver.resolve_agent(
    agent: roboto.ai.agent.record.AgentRecord,
    values: dict[str, str],
) -> roboto.ai.agent_thread.record.StartAgentThreadRequest
```

`from roboto.ai.agent import resolve_agent`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/ai/agent/resolver.py#L46-L72)

Build the request that starts a thread for one launch of an agent, with `values` in its placeholders.

Roboto calls this when [`launch()`](/docs/reference/python-sdk/roboto/ai/agent/agent#roboto.ai.agent.agent.Agent.launch) or a trigger with a [`StartAgentTarget`](/docs/reference/python-sdk/roboto/domain/triggers/targets#roboto.domain.triggers.targets.StartAgentTarget) launches an agent.

Each `{{name}}` placeholder in a string value of the agent's `request_template` becomes its variable's value, including a placeholder within longer text. Dictionary keys are left unchanged.

**Parameters**

- **agent** (`roboto.ai.agent.record.AgentRecord`): Record of the agent to launch.
- **values** (`dict[str, str]`): Value of each variable, keyed by variable name. A variable left out uses its default.

**Raises**

- [`UnknownAgentVariablesError`](/docs/reference/python-sdk/roboto/ai/agent/resolver#roboto.ai.agent.resolver.UnknownAgentVariablesError): A key in `values` names no variable of the agent.
- [`UnresolvedAgentVariablesError`](/docs/reference/python-sdk/roboto/ai/agent/resolver#roboto.ai.agent.resolver.UnresolvedAgentVariablesError): A required variable has no value in `values` and no default.
- `pydantic.ValidationError`: The request with the values filled in is not a valid [`StartAgentThreadRequest`](/docs/reference/python-sdk/roboto/ai/agent_thread/record#roboto.ai.agent_thread.record.StartAgentThreadRequest), such as when a value does not match a field's pattern.

**Returns**

- `roboto.ai.agent_thread.record.StartAgentThreadRequest`
