> For the complete documentation index, see [llms.txt](https://utca.knowledgator.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://utca.knowledgator.com/core/action.md).

# Action

Base action class

## Module: [core](/framework-structure.md#core)

## Methods and properties

Main methods and properties

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**name**</mark>**&#x20;(Optional\[str], optional):** Name for identification. If equals to None, class name will be used. Defaults to None.
* <mark style="color:orange;">**default\_key**</mark>**&#x20;(str, optional):** Default key used for results that is not of type *Dict*. Defaults to "output".
* <mark style="color:orange;">**replace**</mark>**&#x20;(**[**ReplacingScope**](/core/schemas.md#replacingscope)**, optional):** Replacing strategy. Defaults to [**ReplacingScope**](/core/schemas.md#replacingscope)**.**[**INPLACE**](/core/schemas.md#inplace).

***

### <mark style="color:blue;">\_\_call\_\_</mark>

Component Call

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(**[**Transformable**](/core/schemas.md#transformable)**):** Data for processing
* <mark style="color:orange;">**evaluator**</mark>**&#x20;(Optional\[**[**Evaluator**](/core/evaluator.md)**], optional):** Evaluator in context of which component executed. If equals to None, default evaluator will be created. Defaults to None.

#### Raises:

* **ActionError:** Raised if action was executed unsuccessfully

#### Returns:

* [**Transformable**](/core/schemas.md#transformable)**:** Result of executed component.

{% hint style="warning" %}
If result of Action.execute is None, will return input\_data.

If result of Action.execute is not of type Dict, result will be seted to **default\_key** (By default equals to "output").
{% endhint %}

***

### <mark style="color:blue;">execute</mark>

Main logic of action

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(**[**ActionInput**](/core/schemas.md#actioninput)**):** Data for processing.

#### Returns:

* [**ActionOutput**](/core/schemas.md#actionoutput)**:** Result of execution.

***

### <mark style="color:blue;">use</mark>

Creates ActionExecutor which manages context

#### Arguments:

* <mark style="color:orange;">**get\_key**</mark>**&#x20;(Optional\[str], optional):** Which key value of input\_data will be used. If value equal to None, root dict will be used. Defaults to None.
* <mark style="color:orange;">**set\_key**</mark>**&#x20;(Optional\[str], optional):** Which key will be used to set result value. If set\_key value equal to None: \
  \- if result of type Dict\[str, Any], update root dict; \
  \- else, set result to default\_key.\
  Defaults to None.
* <mark style="color:orange;">**default\_key**</mark>**&#x20;(str, optional):** Default key used for results that is not of type Dict. Defaults to "output".
* <mark style="color:orange;">**replace**</mark>**&#x20;(**[**ReplacingScope**](/core/schemas.md#replacingscope)**, optional):** Replacing strategy for executor. If equals to None, this action strategy will be used. Defaults to None.

#### Returns:

* **ActionExecutor:** Wrapper of Action

***

***

***

## <mark style="color:green;">ActionExecutor</mark>

Subclass of [**BaseExecutor**](/core/baseexecutor.md). Wrapper of[ **Action**](/core/action.md).

***

### <mark style="color:blue;">\_\_call\_\_</mark>

Component Call

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(**[**Transformable**](/core/schemas.md#transformable)**):** Data for processing
* <mark style="color:orange;">**evaluator**</mark>**&#x20;(Optional\[**[**Evaluator**](/core/evaluator.md)**], optional):** Evaluator in context of which component executed. If equals to None, default evaluator will be created. Defaults to None.

#### Raises:

* **ActionError:** Raised if action was executed unsuccessfully

#### Returns:

* [**Transformable**](/core/schemas.md#transformable)**:** Result of executed component.

{% hint style="warning" %}
If result of Action.execute is None, will return input\_data.

If result of Action.execute is not of type Dict and **set\_key** is not specified, result will be seted to **default\_key** (By default equals to "output").
{% endhint %}

***

***
