> Documentation index: https://sema4.ai/docs/llms.txt
> Web page: https://sema4.ai/docs/v3/task-engine/runtime

# Robot runtime reference

What a robot sees while it runs on Sema4.ai: its run variables, how its library calls are answered, and the limits that apply.

**Audience:** builders who write robots

> **Task Engine is in private preview.** To get access, [contact us](https://sema4.ai/contact-us/).

## Library calls

The robot libraries talk to Sema4.ai the way they talk to Control Room, so a robot runs without changes:

| Library                                        | Works with                                                                        |
| ---------------------------------------------- | --------------------------------------------------------------------------------- |
| `robocorp.workitems`, `RPA.Robocorp.WorkItems` | The step's task items and output items                                            |
| `robocorp.vault`, `RPA.Robocorp.Vault`         | The workspace's [Secrets](https://sema4.ai/docs/v3/task-engine/secrets-assets.md) |
| `robocorp.storage`                             | The workspace's [Assets](https://sema4.ai/docs/v3/task-engine/secrets-assets.md)  |

When Sema4.ai refuses a call, the library gets a 4xx answer whose message names the problem, and the robot logs it as the reason its step failed.
A refused call changes nothing.
The libraries retry server and network errors on their own, up to five attempts.

## Run variables

Each robot run gets the variables Control Room sets, filled from the Workflow:

| Variable                 | Control Room            | Sema4.ai                             |
| ------------------------ | ----------------------- | ------------------------------------ |
| `RC_WORKSPACE_ID`        | The workspace           | The workspace's ID                   |
| `RC_PROCESS_ID`          | The process             | The Workflow's ID                    |
| `RC_PROCESS_NAME`        | The process name        | The Workflow's name                  |
| `RC_PROCESS_RUN_ID`      | The process run         | The work item's run                  |
| `RC_ACTIVITY_ID`         | The step's ID           | The step's key, such as `erp_lookup` |
| `RC_ACTIVITY_NAME`       | The step name           | The step's label, or the task name   |
| `RC_ACTIVITY_RUN_ID`     | The step run            | The robot run's ID                   |
| `RC_ORGANIZATION_ID`     | The organization        | Not set                              |
| `RC_PROCESS_RUN_NUMBER`  | The process's run count | Not set                              |
| `RC_ACTIVITY_RUN_NUMBER` | The step run's number   | Not set                              |

When an agent starts a robot instead of a step, `RC_PROCESS_ID` and `RC_PROCESS_NAME` name the task package, and `RC_ACTIVITY_ID` names the task.

The step's own [variables](https://sema4.ai/docs/v3/task-engine/robot-step.md#step-settings) are set as well.
A step can't set a variable whose name starts with `RC_`.

> **Check robots that read the run numbers.**
> A robot that builds a file name or a reference from `RC_PROCESS_RUN_NUMBER` gets no value on Sema4.ai.
> Use `RC_PROCESS_RUN_ID` instead, which is unique for every run.

## Work items

- **Releasing an item.** A robot releases each input item as done or failed. A failure carries a type, `BUSINESS` or `APPLICATION`, a code of up to 50 characters, and a message of up to 1,000 characters. They show on the item in Sema4.ai.
- **Items the robot doesn't release.** When a run ends while the robot still holds items, they are settled for it: done if the run succeeded, and failed with the type `ORCHESTRATOR` if the run failed, was stopped, or lost its worker.
- **Output items can be created twice.** As on Control Room, the library retries a request whose answer was lost, so a network error can create a second output item with the same data. When duplicates matter, have the next robot check what it has already done.
- **An item keeps its ID.** A resumed item and an output item a later step takes keep their IDs, as on Control Room.
- **Files.** An item holds one file per name: adding a file under a name the item already has replaces it. Each file can be up to 50 MB.

## Secrets

- A secret is a map of items, such as `username` and `password`, read with `vault.get_secret("erp_login")["password"]`.
- A secret's value is at most 10,000 bytes.
- Names are case sensitive: `erp` and `ERP` are two secrets.
- A robot may write a secret. The name it writes under can't contain whitespace or `/`.
- If a robot changed a secret's value after an admin opened it for editing, the admin's save is refused, so an admin never overwrites a newer value without seeing it.

## Assets

- A robot reads an asset by name: `storage.get_text("price_list")`, `storage.get_json(...)`, or `storage.get_file(...)`.
- A robot can write an asset, including larger and binary values. Admins set text and JSON values on the **Assets** page.

## Artifacts

A run's artifacts are the files the worker uploads when the robot ends, such as `console.txt`, the robot's log, screenshots, and `result.json`.
Each can be up to 50 MB.
People open them on the [robot run page](https://sema4.ai/docs/v3/task-engine/robot-runs.md).
A later agent step can't read them, so put what it needs in the output items' data.

Robot runs, their artifacts, and their items are kept for 90 days.
