Skip to content

Tool call data structures

You might be looking for...

This section describes the main classes for tool calls:

  • AIToolCall, which is a data structure representing a tool call.
  • ComputerUseAction, which is a data structure representing a tool call that uses the computer.

Visual explanation

As always, visualization should help you understand the class hierarchy of the messages:

Message class hierarchy

Note

To make this section more readable, we're not showing the full path of the classes, but they can also be imported from the conatus.models.inputs_outputs.tool_calls module.

Tool call specifications

AIToolCall dataclass

AIToolCall(
    name: str,
    returned_arguments: dict[str, JSONType] | str,
    call_id: str | None = None,
    type: Literal["function"] = "function",
    requires_local_execution: bool = True,
    could_be_structured_output: bool = False,
)

Tool call by the AI.

This is contained in the AssistantAIMessage .

This is the tool call data returned by the AI provider. What's raw about it is the arguments field, which is a stringified JSON.

We also provide properties to convert the returned_arguments field to a dictionary or a stringified JSON.

For more information on its incomplete counterpart, see IncompleteAIToolCall .

name instance-attribute

name: str

The name of the tool called.

returned_arguments instance-attribute

returned_arguments: dict[str, JSONType] | str

The arguments of the tool call, as returned by the AI.

We do not apply any pre-processing to the arguments, so they can be either a dictionary or a stringified JSON.

The arguments_as_dict property converts the stringified JSON to a dictionary if necessary.

The arguments_as_str property returns the stringified JSON.

call_id class-attribute instance-attribute

call_id: str | None = None

The ID of the tool call, as given by the AI provider.

This is the ID of the tool call as given by the AI provider. Some providers require that tool responses reference the ID of the tool call.

type class-attribute instance-attribute

type: Literal['function'] = 'function'

The type of the tool call. Always "function".

requires_local_execution class-attribute instance-attribute

requires_local_execution: bool = True

Whether the tool call requires local execution.

If False, the tool calls is meant to be executed on the server side.

could_be_structured_output class-attribute instance-attribute

could_be_structured_output: bool = False

Whether the tool could be a structured output in disguise.

Some AI providers (e.g. Anthropic) will return a structured output in the form of a tool call.

arguments_as_dict property

arguments_as_dict: dict[str, JSONType]

The arguments of the tool call as a dictionary.

RETURNS DESCRIPTION
dict[str, JSONType]

The arguments of the tool call as a dictionary.

RAISES DESCRIPTION
TypeError

If the returned arguments are not a dictionary.

arguments_as_str property

arguments_as_str: str

The arguments of the tool call as a string.

Converts the dictionary to a stringified JSON if necessary.

RETURNS DESCRIPTION
str

The arguments of the tool call as a string.

__hash__

__hash__() -> int

Hash the tool call.

Here, we use the arguments as a string.

RETURNS DESCRIPTION
int

The hash of the tool call.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def __hash__(self) -> int:
    """Hash the tool call.

    Here, we use the arguments as a string.

    Returns:
        The hash of the tool call.
    """
    return hash((self.call_id, self.name, self.arguments_as_str))

Computer use actions

ComputerUseAction module-attribute

Union type for all the computer use actions.

CUAction dataclass

CUAction(
    environment: ComputerUseEnvironment,
    environment_variable: RuntimeVariable,
    call_id: str | None,
)

Bases: ABC

A computer use action.

This common class defines a few properties that are common to all the computer use actions:

environment instance-attribute

environment: ComputerUseEnvironment

The environment in which the action is executed.

environment_variable instance-attribute

environment_variable: RuntimeVariable

The variable to execute the action on.

call_id instance-attribute

call_id: str | None

The ID of the tool call.

arguments_as_str property

arguments_as_str: str

The arguments of the action as a string.

arguments_as_dict property

arguments_as_dict: dict[str, JSONType]

The arguments of the action as a dictionary.

name property

name: str

The name of the action.

requires_local_execution property writable

requires_local_execution: bool

Whether the action requires local execution.

returned_arguments property

returned_arguments: str | None

The returned arguments of the action.

safe_asdict abstractmethod

safe_asdict() -> dict[str, JSONType]

The arguments of the action as a dictionary.

We do this in order not to use asdict on the action, which might fail if the action contains a field that is not JSON serializable (in our case, the environment_variable field).

RETURNS DESCRIPTION
dict[str, JSONType]

The arguments of the action as a dictionary.

Source code in conatus/models/inputs_outputs/tool_calls.py
@abstractmethod
def safe_asdict(self) -> dict[str, JSONType]:
    """The arguments of the action as a dictionary.

    We do this in order not to use [`asdict`][dataclasses.asdict] on the
    action, which might fail if the action contains a field that is not
    JSON serializable (in our case, the [`environment_variable`
    ][conatus.models.inputs_outputs.tool_calls.CUAction.environment_variable]
    field).

    Returns:
        The arguments of the action as a dictionary.
    """

CULeftMouseDown dataclass

CULeftMouseDown(
    environment: ComputerUseEnvironment,
    environment_variable: RuntimeVariable,
    call_id: str | None,
    xy: tuple[int, int] | None = None,
    type: Literal["left_mouse_down"] = "left_mouse_down",
)

Bases: CUAction

A left mouse down action.

ATTRIBUTE DESCRIPTION
xy

The coordinates of the mouse down.
If None, the mouse down is at the current mouse position.

TYPE: tuple[int, int] | None

type

The type of the action. Always "left_mouse_down".

TYPE: Literal['left_mouse_down']

safe_asdict

safe_asdict() -> dict[str, JSONType]

The arguments of the action as a dictionary.

They can later be added to other; we're just making sure that the arguments that are passed here don't include ones that have issue with deepcopy.

RETURNS DESCRIPTION
dict[str, JSONType]

A dictionary of the arguments of the action.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def safe_asdict(self) -> dict[str, JSONType]:
    """The arguments of the action as a dictionary.

    They can later be added to other; we're just making sure that the
    arguments that are passed here don't include ones that have issue
    with [`deepcopy`][copy.deepcopy].

    Returns:
        A dictionary of the arguments of the action.
    """
    return {"xy": self.xy, "type": self.type}

CULeftMouseUp dataclass

CULeftMouseUp(
    environment: ComputerUseEnvironment,
    environment_variable: RuntimeVariable,
    call_id: str | None,
    xy: tuple[int, int] | None = None,
    type: Literal["left_mouse_up"] = "left_mouse_up",
)

Bases: CUAction

A left mouse up action.

ATTRIBUTE DESCRIPTION
xy

The coordinates of the mouse up.
If None, the mouse up is at the current mouse position.

TYPE: tuple[int, int] | None

type

The type of the action. Always "left_mouse_up".

TYPE: Literal['left_mouse_up']

safe_asdict

safe_asdict() -> dict[str, JSONType]

The arguments of the action as a dictionary.

They can later be added to other; we're just making sure that the arguments that are passed here don't include ones that have issue with deepcopy.

RETURNS DESCRIPTION
dict[str, JSONType]

A dictionary of the arguments of the action.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def safe_asdict(self) -> dict[str, JSONType]:
    """The arguments of the action as a dictionary.

    They can later be added to other; we're just making sure that the
    arguments that are passed here don't include ones that have issue
    with [`deepcopy`][copy.deepcopy].

    Returns:
        A dictionary of the arguments of the action.
    """
    return {"xy": self.xy, "type": self.type}

CULeftMouseClick dataclass

CULeftMouseClick(
    environment: ComputerUseEnvironment,
    environment_variable: RuntimeVariable,
    call_id: str | None,
    xy: tuple[int, int] | None = None,
    type: Literal["left_mouse_click"] = "left_mouse_click",
)

Bases: CUAction

A left mouse click action.

ATTRIBUTE DESCRIPTION
xy

The coordinates of the mouse click.
If None, the mouse click is at the current mouse position.

TYPE: tuple[int, int] | None

type

The type of the action. Always "left_mouse_click".

TYPE: Literal['left_mouse_click']

safe_asdict

safe_asdict() -> dict[str, JSONType]

The arguments of the action as a dictionary.

They can later be added to other; we're just making sure that the arguments that are passed here don't include ones that have issue with deepcopy.

RETURNS DESCRIPTION
dict[str, JSONType]

A dictionary of the arguments of the action.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def safe_asdict(self) -> dict[str, JSONType]:
    """The arguments of the action as a dictionary.

    They can later be added to other; we're just making sure that the
    arguments that are passed here don't include ones that have issue
    with [`deepcopy`][copy.deepcopy].

    Returns:
        A dictionary of the arguments of the action.
    """
    return {"xy": self.xy, "type": self.type}

CULeftMouseDoubleClick dataclass

CULeftMouseDoubleClick(
    environment: ComputerUseEnvironment,
    environment_variable: RuntimeVariable,
    call_id: str | None,
    xy: tuple[int, int] | None = None,
    type: Literal[
        "left_mouse_double_click"
    ] = "left_mouse_double_click",
)

Bases: CUAction

A left mouse double click action.

ATTRIBUTE DESCRIPTION
xy

The coordinates of the mouse double click.
If None, the mouse double click is at the current mouse position.

TYPE: tuple[int, int] | None

type

The type of the action. Always "left_mouse_double_click".

TYPE: Literal['left_mouse_double_click']

safe_asdict

safe_asdict() -> dict[str, JSONType]

The arguments of the action as a dictionary.

They can later be added to other; we're just making sure that the arguments that are passed here don't include ones that have issue with deepcopy.

RETURNS DESCRIPTION
dict[str, JSONType]

A dictionary of the arguments of the action.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def safe_asdict(self) -> dict[str, JSONType]:
    """The arguments of the action as a dictionary.

    They can later be added to other; we're just making sure that the
    arguments that are passed here don't include ones that have issue
    with [`deepcopy`][copy.deepcopy].

    Returns:
        A dictionary of the arguments of the action.
    """
    return {"xy": self.xy, "type": self.type}

CULeftMouseTripleClick dataclass

CULeftMouseTripleClick(
    environment: ComputerUseEnvironment,
    environment_variable: RuntimeVariable,
    call_id: str | None,
    xy: tuple[int, int] | None = None,
    type: Literal[
        "left_mouse_triple_click"
    ] = "left_mouse_triple_click",
)

Bases: CUAction

A left mouse triple click action.

ATTRIBUTE DESCRIPTION
xy

The coordinates of the mouse triple click.
If None, the mouse triple click is at the current mouse position.

TYPE: tuple[int, int] | None

type

The type of the action. Always "left_mouse_triple_click".

TYPE: Literal['left_mouse_triple_click']

safe_asdict

safe_asdict() -> dict[str, JSONType]

The arguments of the action as a dictionary.

They can later be added to other; we're just making sure that the arguments that are passed here don't include ones that have issue with deepcopy.

RETURNS DESCRIPTION
dict[str, JSONType]

A dictionary of the arguments of the action.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def safe_asdict(self) -> dict[str, JSONType]:
    """The arguments of the action as a dictionary.

    They can later be added to other; we're just making sure that the
    arguments that are passed here don't include ones that have issue
    with [`deepcopy`][copy.deepcopy].

    Returns:
        A dictionary of the arguments of the action.
    """
    return {"xy": self.xy, "type": self.type}

CUMiddleClick dataclass

CUMiddleClick(
    environment: ComputerUseEnvironment,
    environment_variable: RuntimeVariable,
    call_id: str | None,
    xy: tuple[int, int] | None = None,
    type: Literal["middle_click"] = "middle_click",
)

Bases: CUAction

A middle click action.

ATTRIBUTE DESCRIPTION
xy

The coordinates of the middle click.
If None, the middle click is at the current mouse position.

TYPE: tuple[int, int] | None

type

The type of the action. Always "middle_click".

TYPE: Literal['middle_click']

safe_asdict

safe_asdict() -> dict[str, JSONType]

The arguments of the action as a dictionary.

They can later be added to other; we're just making sure that the arguments that are passed here don't include ones that have issue with deepcopy.

RETURNS DESCRIPTION
dict[str, JSONType]

A dictionary of the arguments of the action.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def safe_asdict(self) -> dict[str, JSONType]:
    """The arguments of the action as a dictionary.

    They can later be added to other; we're just making sure that the
    arguments that are passed here don't include ones that have issue
    with [`deepcopy`][copy.deepcopy].

    Returns:
        A dictionary of the arguments of the action.
    """
    return {"xy": self.xy, "type": self.type}

CURightClick dataclass

CURightClick(
    environment: ComputerUseEnvironment,
    environment_variable: RuntimeVariable,
    call_id: str | None,
    xy: tuple[int, int] | None = None,
    type: Literal["right_click"] = "right_click",
)

Bases: CUAction

A right click action.

ATTRIBUTE DESCRIPTION
xy

The coordinates of the right click.
If None, the right click is at the current mouse position.

TYPE: tuple[int, int] | None

type

The type of the action. Always "right_click".

TYPE: Literal['right_click']

safe_asdict

safe_asdict() -> dict[str, JSONType]

The arguments of the action as a dictionary.

They can later be added to other; we're just making sure that the arguments that are passed here don't include ones that have issue with deepcopy.

RETURNS DESCRIPTION
dict[str, JSONType]

A dictionary of the arguments of the action.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def safe_asdict(self) -> dict[str, JSONType]:
    """The arguments of the action as a dictionary.

    They can later be added to other; we're just making sure that the
    arguments that are passed here don't include ones that have issue
    with [`deepcopy`][copy.deepcopy].

    Returns:
        A dictionary of the arguments of the action.
    """
    return {"xy": self.xy, "type": self.type}

CUBackClick dataclass

CUBackClick(
    environment: ComputerUseEnvironment,
    environment_variable: RuntimeVariable,
    call_id: str | None,
    xy: tuple[int, int] | None = None,
    type: Literal["back_click"] = "back_click",
)

Bases: CUAction

A back click action.

ATTRIBUTE DESCRIPTION
xy

The coordinates of the back click.
If None, the back click is at the current mouse position.

TYPE: tuple[int, int] | None

type

The type of the action. Always "back_click".

TYPE: Literal['back_click']

safe_asdict

safe_asdict() -> dict[str, JSONType]

The arguments of the action as a dictionary.

They can later be added to other; we're just making sure that the arguments that are passed here don't include ones that have issue with deepcopy.

RETURNS DESCRIPTION
dict[str, JSONType]

A dictionary of the arguments of the action.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def safe_asdict(self) -> dict[str, JSONType]:
    """The arguments of the action as a dictionary.

    They can later be added to other; we're just making sure that the
    arguments that are passed here don't include ones that have issue
    with [`deepcopy`][copy.deepcopy].

    Returns:
        A dictionary of the arguments of the action.
    """
    return {"xy": self.xy, "type": self.type}

CUForwardClick dataclass

CUForwardClick(
    environment: ComputerUseEnvironment,
    environment_variable: RuntimeVariable,
    call_id: str | None,
    xy: tuple[int, int] | None = None,
    type: Literal["forward_click"] = "forward_click",
)

Bases: CUAction

A forward click action.

ATTRIBUTE DESCRIPTION
xy

The coordinates of the forward click.
If None, the forward click is at the current mouse position.

TYPE: tuple[int, int] | None

type

The type of the action. Always "forward_click".

TYPE: Literal['forward_click']

safe_asdict

safe_asdict() -> dict[str, JSONType]

The arguments of the action as a dictionary.

They can later be added to other; we're just making sure that the arguments that are passed here don't include ones that have issue with deepcopy.

RETURNS DESCRIPTION
dict[str, JSONType]

A dictionary of the arguments of the action.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def safe_asdict(self) -> dict[str, JSONType]:
    """The arguments of the action as a dictionary.

    They can later be added to other; we're just making sure that the
    arguments that are passed here don't include ones that have issue
    with [`deepcopy`][copy.deepcopy].

    Returns:
        A dictionary of the arguments of the action.
    """
    return {"xy": self.xy, "type": self.type}

CUDrag dataclass

CUDrag(
    environment: ComputerUseEnvironment,
    environment_variable: RuntimeVariable,
    call_id: str | None,
    xy: list[tuple[int, int]],
    type: Literal["drag"] = "drag",
)

Bases: CUAction

A drag action.

ATTRIBUTE DESCRIPTION
xy

The coordinates of the drag. Some providers will provide only the coordinates of the drag end, and not the drag start. Sometimes they provide a full path of the drag, in which case the list might have more than two elements.

TYPE: list[tuple[int, int]]

type

The type of the action. Always "drag".

TYPE: Literal['drag']

safe_asdict

safe_asdict() -> dict[str, JSONType]

The arguments of the action as a dictionary.

They can later be added to other; we're just making sure that the arguments that are passed here don't include ones that have issue with deepcopy.

RETURNS DESCRIPTION
dict[str, JSONType]

A dictionary of the arguments of the action.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def safe_asdict(self) -> dict[str, JSONType]:
    """The arguments of the action as a dictionary.

    They can later be added to other; we're just making sure that the
    arguments that are passed here don't include ones that have issue
    with [`deepcopy`][copy.deepcopy].

    Returns:
        A dictionary of the arguments of the action.
    """
    return {"xy": self.xy, "type": self.type}  # type: ignore[dict-item] # pyright: ignore[reportReturnType]

__hash__

__hash__() -> int

Hash the drag action.

RETURNS DESCRIPTION
int

The hash of the drag action.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def __hash__(self) -> int:
    """Hash the drag action.

    Returns:
        The hash of the drag action.
    """
    return hash(tuple(self.xy))

CUKeypress dataclass

CUKeypress(
    environment: ComputerUseEnvironment,
    environment_variable: RuntimeVariable,
    call_id: str | None,
    keys: list[str],
    type: Literal["keypress"] = "keypress",
)

Bases: CUAction

A keypress action.

ATTRIBUTE DESCRIPTION
keys

The keys to press.

TYPE: list[str]

type

The type of the action. Always "keypress".

TYPE: Literal['keypress']

safe_asdict

safe_asdict() -> dict[str, JSONType]

The arguments of the action as a dictionary.

They can later be added to other; we're just making sure that the arguments that are passed here don't include ones that have issue with deepcopy.

RETURNS DESCRIPTION
dict[str, JSONType]

A dictionary of the arguments of the action.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def safe_asdict(self) -> dict[str, JSONType]:
    """The arguments of the action as a dictionary.

    They can later be added to other; we're just making sure that the
    arguments that are passed here don't include ones that have issue
    with [`deepcopy`][copy.deepcopy].

    Returns:
        A dictionary of the arguments of the action.
    """
    return {"keys": self.keys, "type": self.type}  # type: ignore[dict-item] # pyright: ignore[reportReturnType]

__hash__

__hash__() -> int

Hash the keypress action.

RETURNS DESCRIPTION
int

The hash of the keypress action.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def __hash__(self) -> int:
    """Hash the keypress action.

    Returns:
        The hash of the keypress action.
    """
    return hash(tuple(self.keys))

CUKeypressHold dataclass

CUKeypressHold(
    environment: ComputerUseEnvironment,
    environment_variable: RuntimeVariable,
    call_id: str | None,
    keys: list[str],
    duration: float,
    type: Literal["keypress_hold"] = "keypress_hold",
)

Bases: CUAction

A keypress hold action.

ATTRIBUTE DESCRIPTION
keys

The keys to press.

TYPE: list[str]

duration

The duration of the keypress hold.

TYPE: float

type

The type of the action. Always "keypress_hold".

TYPE: Literal['keypress_hold']

safe_asdict

safe_asdict() -> dict[str, JSONType]

The arguments of the action as a dictionary.

They can later be added to other; we're just making sure that the arguments that are passed here don't include ones that have issue with deepcopy.

RETURNS DESCRIPTION
dict[str, JSONType]

A dictionary of the arguments of the action.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def safe_asdict(self) -> dict[str, JSONType]:
    """The arguments of the action as a dictionary.

    They can later be added to other; we're just making sure that the
    arguments that are passed here don't include ones that have issue
    with [`deepcopy`][copy.deepcopy].

    Returns:
        A dictionary of the arguments of the action.
    """
    return {
        "keys": self.keys,  # type: ignore[dict-item] # pyright: ignore[reportReturnType]
        "duration": self.duration,
        "type": self.type,
    }

__hash__

__hash__() -> int

Hash the keypress hold action.

RETURNS DESCRIPTION
int

The hash of the keypress hold action.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def __hash__(self) -> int:
    """Hash the keypress hold action.

    Returns:
        The hash of the keypress hold action.
    """
    return hash((tuple(self.keys), self.duration))

CUMove dataclass

CUMove(
    environment: ComputerUseEnvironment,
    environment_variable: RuntimeVariable,
    call_id: str | None,
    xy: tuple[int, int],
    type: Literal["move"] = "move",
)

Bases: CUAction

A mouse move action.

ATTRIBUTE DESCRIPTION
xy

The coordinates of the mouse move target.

TYPE: tuple[int, int]

type

The type of the action. Always "move".

TYPE: Literal['move']

safe_asdict

safe_asdict() -> dict[str, JSONType]

The arguments of the action as a dictionary.

They can later be added to other; we're just making sure that the arguments that are passed here don't include ones that have issue with deepcopy.

RETURNS DESCRIPTION
dict[str, JSONType]

A dictionary of the arguments of the action.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def safe_asdict(self) -> dict[str, JSONType]:
    """The arguments of the action as a dictionary.

    They can later be added to other; we're just making sure that the
    arguments that are passed here don't include ones that have issue
    with [`deepcopy`][copy.deepcopy].

    Returns:
        A dictionary of the arguments of the action.
    """
    return {"xy": self.xy, "type": self.type}

CUScreenshot dataclass

CUScreenshot(
    environment: ComputerUseEnvironment,
    environment_variable: RuntimeVariable,
    call_id: str | None,
    type: Literal["screenshot"] = "screenshot",
)

Bases: CUAction

A screenshot action.

ATTRIBUTE DESCRIPTION
type

The type of the action. Always "screenshot".

TYPE: Literal['screenshot']

safe_asdict

safe_asdict() -> dict[str, JSONType]

The arguments of the action as a dictionary.

They can later be added to other; we're just making sure that the arguments that are passed here don't include ones that have issue with deepcopy.

RETURNS DESCRIPTION
dict[str, JSONType]

A dictionary of the arguments of the action.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def safe_asdict(self) -> dict[str, JSONType]:
    """The arguments of the action as a dictionary.

    They can later be added to other; we're just making sure that the
    arguments that are passed here don't include ones that have issue
    with [`deepcopy`][copy.deepcopy].

    Returns:
        A dictionary of the arguments of the action.
    """
    return {"type": self.type}

CUScroll dataclass

CUScroll(
    environment: ComputerUseEnvironment,
    environment_variable: RuntimeVariable,
    call_id: str | None,
    start_xy: tuple[int, int] | None = None,
    distance_xy: tuple[int, int] | None = None,
    magnitude: float | None = None,
    direction: (
        Literal["up", "down", "left", "right"] | None
    ) = None,
    type: Literal["scroll"] = "scroll",
)

Bases: CUAction

A scroll action.

ATTRIBUTE DESCRIPTION
start_xy

The coordinates of the scroll start.
If None, the scroll start is at the current mouse position.

TYPE: tuple[int, int] | None

distance_xy

The distance to scroll.
If None, you should rely on the magnitude.

TYPE: tuple[int, int] | None

magnitude

The relative magnitude of the scroll.
If None, you should rely on the distance.

TYPE: float | None

direction

The direction of the scroll.
If None, you should rely on the distance or magnitude.

TYPE: Literal['up', 'down', 'left', 'right'] | None

safe_asdict

safe_asdict() -> dict[str, JSONType]

The arguments of the action as a dictionary.

They can later be added to other; we're just making sure that the arguments that are passed here don't include ones that have issue with deepcopy.

RETURNS DESCRIPTION
dict[str, JSONType]

A dictionary of the arguments of the action.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def safe_asdict(self) -> dict[str, JSONType]:
    """The arguments of the action as a dictionary.

    They can later be added to other; we're just making sure that the
    arguments that are passed here don't include ones that have issue
    with [`deepcopy`][copy.deepcopy].

    Returns:
        A dictionary of the arguments of the action.
    """
    return {
        "start_xy": self.start_xy,
        "distance_xy": self.distance_xy,
        "magnitude": self.magnitude,
        "direction": self.direction,
        "type": self.type,
    }

CUType dataclass

CUType(
    environment: ComputerUseEnvironment,
    environment_variable: RuntimeVariable,
    call_id: str | None,
    text: str,
    type: Literal["type"] = "type",
)

Bases: CUAction

A type action.

ATTRIBUTE DESCRIPTION
text

The text to type.

TYPE: str

type

The type of the action. Always "type".

TYPE: Literal['type']

safe_asdict

safe_asdict() -> dict[str, JSONType]

The arguments of the action as a dictionary.

They can later be added to other; we're just making sure that the arguments that are passed here don't include ones that have issue with deepcopy.

RETURNS DESCRIPTION
dict[str, JSONType]

A dictionary of the arguments of the action.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def safe_asdict(self) -> dict[str, JSONType]:
    """The arguments of the action as a dictionary.

    They can later be added to other; we're just making sure that the
    arguments that are passed here don't include ones that have issue
    with [`deepcopy`][copy.deepcopy].

    Returns:
        A dictionary of the arguments of the action.
    """
    return {"text": self.text, "type": self.type}

CUWait dataclass

CUWait(
    environment: ComputerUseEnvironment,
    environment_variable: RuntimeVariable,
    call_id: str | None,
    duration: float | None = None,
    type: Literal["wait"] = "wait",
)

Bases: CUAction

A wait action.

ATTRIBUTE DESCRIPTION
duration

The duration of the wait.
Not always provided by the AI provider.

TYPE: float | None

type

The type of the action. Always "wait".

TYPE: Literal['wait']

safe_asdict

safe_asdict() -> dict[str, JSONType]

The arguments of the action as a dictionary.

They can later be added to other; we're just making sure that the arguments that are passed here don't include ones that have issue with deepcopy.

RETURNS DESCRIPTION
dict[str, JSONType]

A dictionary of the arguments of the action.

Source code in conatus/models/inputs_outputs/tool_calls.py
@override
def safe_asdict(self) -> dict[str, JSONType]:
    """The arguments of the action as a dictionary.

    They can later be added to other; we're just making sure that the
    arguments that are passed here don't include ones that have issue
    with [`deepcopy`][copy.deepcopy].

    Returns:
        A dictionary of the arguments of the action.
    """
    return {"duration": self.duration, "type": self.type}